All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
KeyboardLocationObserver.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "VectorMath.h"
6 
7 namespace Eegeo
8 {
9  namespace UI
10  {
11  namespace NativeInput
12  {
14  {
15  Eegeo::v2 location;
16  Eegeo::v2 size;
17  };
18 
20  {
21  public:
22  virtual ~IKeyboardLocationObserver() { ; }
23  virtual void operator()(const KeyboardLocationData& locationData) = 0;
24  };
25 
26  template <class T> class TKeyboardLocationObserver : public IKeyboardLocationObserver
27  {
28  private:
29  void (T::*m_callback)(const KeyboardLocationData& animationData);
30  T* m_context;
31  public:
32  TKeyboardLocationObserver(T* context, void (T::*callback)(const KeyboardLocationData& locationData))
33  : m_context(context)
34  , m_callback(callback)
35  {
36  }
37 
38  virtual void operator()(const KeyboardLocationData& locationData)
39  {
40  (*m_context.*m_callback)(locationData);
41  }
42  };
43  }
44  }
45 }