All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RouteViewStyleCallback.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Routes.h"
6 
7 namespace Eegeo
8 {
9  namespace Routes
10  {
11  namespace View
12  {
14  {
15  public:
16  virtual void operator()(const Route* route, const Style::RouteStyle& routeStyle) = 0;
17  };
18 
19  template <class T> class TRouteViewStyleCallback : public IRouteViewStyleCallback
20  {
21  private:
22  void (T::*m_callback)(const Route* route, const Style::RouteStyle& routeStyle);
23  T* m_context;
24  public:
25  TRouteViewStyleCallback(T* context, void (T::*callback)(const Route* route, const Style::RouteStyle& routeStyle))
26  : m_callback(callback)
27  , m_context(context)
28  {
29  }
30 
31  virtual void operator()(const Route* route, const Style::RouteStyle& routeStyle)
32  {
33  (*m_context.*m_callback)(route, routeStyle);
34  }
35  };
36  }
37  }
38 }