HoverRace  2.0
SymbolIcon.h
Go to the documentation of this file.
1 
2 // SymbolIcon.h
3 //
4 // Copyright (c) 2013, 2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "Box.h"
25 
26 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
27 # ifdef MR_ENGINE
28 # define MR_DllDeclare __declspec( dllexport )
29 # else
30 # define MR_DllDeclare __declspec( dllimport )
31 # endif
32 #else
33 # define MR_DllDeclare
34 #endif
35 
36 namespace HoverRace {
37  namespace Display {
38  class Display;
39  }
40 }
41 
42 namespace HoverRace {
43 namespace Display {
44 
50 {
51  using SUPER = Box;
52 
53 public:
54  struct Props
55  {
56  enum
57  {
58  SYMBOL = SUPER::Props::NEXT_,
61  };
62  };
63 
64 public:
65  SymbolIcon(const Vec2 &size, int symbol,
66  const Color color = COLOR_WHITE, uiLayoutFlags_t layoutFlags = 0);
67  SymbolIcon(double w, double h, int symbol,
68  const Color color = COLOR_WHITE, uiLayoutFlags_t layoutFlags = 0);
69  virtual ~SymbolIcon() { }
70 
71 public:
72  virtual void AttachView(Display &disp) { AttachViewDynamic(disp, this); }
73 
74 public:
75  int GetSymbol() const { return symbol; }
76  void SetSymbol(int symbol);
77 
78  const Color GetColor() const { return color; }
79  void SetColor(const Color color);
80 
81 private:
82  int symbol;
84 };
85 
86 } // namespace Display
87 } // namespace HoverRace
88 
89 #undef MR_DllDeclare
Definition: Color.h:40
Base class for UI (2D) components.
Definition: UiViewModel.h:56
virtual ~SymbolIcon()
Definition: SymbolIcon.h:69
constexpr Color COLOR_WHITE
Definition: Color.h:64
const Color GetColor() const
Definition: SymbolIcon.h:78
Base class for low-level bounded widgets.
Definition: Box.h:51
int GetSymbol() const
Definition: SymbolIcon.h:75
int symbol
Definition: SymbolIcon.h:82
Definition: Vec.h:38
MR_UInt32 uiLayoutFlags_t
Definition: UiLayoutFlags.h:53
Definition: SymbolIcon.h:54
virtual void AttachView(Display &disp)
Definition: SymbolIcon.h:72
#define MR_DllDeclare
Definition: SymbolIcon.h:33
Base class for display managers.
Definition: Display.h:73
Color color
Definition: SymbolIcon.h:83
One of the predefined icons from the symbol font.
Definition: SymbolIcon.h:49
Definition: Announcement.h:24
First index for subclasses.
Definition: SymbolIcon.h:60