LumaSystem.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace iv
6 {
7 
8 class LumaSystem;
9 
12 class LumaStyleId : public iv::RuntimeId< LumaStyleId >
13 {
14 public:
15  static constexpr char TypeName[] = "LumaStyleId";
18 };
19 
20 }
21 
22 namespace std
23 {
24 template<>
25 struct hash< iv::LumaStyleId > : public iv::hash< iv::LumaStyleId >{};
26 }
27 
28 namespace iv
29 {
30 
33 struct LumaStyle
34 {
35 public:
36  LumaStyle();
37 
41 
45 
48 };
49 
54 {
55 public:
57 
59  ~LumaListener();
60  Instance * instance() const;
61 
62  LumaStyleId style_id() const;
63  LumaStyle const & style() const;
64 
65  virtual void LumaStyleChanged( LumaStyle const & ) = 0;
66 
67 
68 private:
69  Instance * inst;
70  LumaStyleId id;
71 };
72 
76 {
77 public:
79  LumaStyler( Instance * inst );
80  Instance * instance() const;
81 
84  void current_style( LumaStyleId );
85  LumaStyleId current_style() const;
86 
89  void style( LumaStyleId, LumaStyle const & );
90  LumaStyle const & style( LumaStyleId ) const;
91 
92 private:
93  Instance * inst;
94  LumaSystem * ls;
95 };
96 
99 class LumaSystem : public iv::System
100 {
101 public:
102  LumaSystem( SystemContainer * sc );
103  virtual std::string debug_name() const override { return "LumaSystem"; }
104 
108  void current_style( LumaStyleId );
109  LumaStyleId current_style() const;
110 
113  void style( LumaStyleId, LumaStyle const & );
114  LumaStyle const & style( LumaStyleId ) const;
115 
119  void AddListener( LumaListener * );
120  void RemoveListener( LumaListener * );
121 
122 private:
123  LumaStyleId _current_style;
124  std::unordered_map< LumaStyleId, LumaStyle > _styles;
126 };
127 
128 }