HoverRace  2.0
RuleLine.h
Go to the documentation of this file.
1 
2 // RuleLine.h
3 //
4 // Copyright (c) 2014, 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 "Color.h"
25 
26 #include "UiViewModel.h"
27 
28 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
29 # ifdef MR_ENGINE
30 # define MR_DllDeclare __declspec( dllexport )
31 # else
32 # define MR_DllDeclare __declspec( dllimport )
33 # endif
34 #else
35 # define MR_DllDeclare
36 #endif
37 
38 namespace HoverRace {
39  namespace Display {
40  class Display;
41  }
42 }
43 
44 namespace HoverRace {
45 namespace Display {
46 
55 {
56  using SUPER = UiViewModel;
57 
58 public:
59  struct Props
60  {
61  enum
62  {
63  DIRECTION = SUPER::Props::NEXT_,
67  };
68  };
69 
70  enum class Direction { H, V };
71 
72 public:
73  RuleLine(Direction direction, double length, double width,
74  const Color color, uiLayoutFlags_t layoutFlags = 0);
75  virtual ~RuleLine() { }
76 
77 public:
78  void AttachView(Display &disp) override { AttachViewDynamic(disp, this); }
79 
80 public:
81  Direction GetDirection() const { return direction; }
82  void SetDirection(Direction direction);
83 
84  double GetLength() const { return length; }
85  void SetLength(double length);
86 
87  double GetWidth() const { return width; }
88  void SetWidth(double width);
89 
90  const Color GetColor() const { return color; }
91  void SetColor(const Color color);
92 
93 public:
94  Vec3 Measure() override;
95 
96 private:
98  double length;
99  double width;
101 };
102 
103 } // namespace Display
104 } // namespace HoverRace
105 
106 #undef MR_DllDeclare
Definition: Color.h:40
A horizontal or vertical line.
Definition: RuleLine.h:54
Base class for UI (2D) components.
Definition: UiViewModel.h:56
First index for subclasses.
Definition: RuleLine.h:66
double GetWidth() const
Definition: RuleLine.h:87
double width
Definition: RuleLine.h:99
MR_UInt32 uiLayoutFlags_t
Definition: UiLayoutFlags.h:53
Base class for display managers.
Definition: Display.h:73
const Color GetColor() const
Definition: RuleLine.h:90
Definition: RuleLine.h:59
Direction GetDirection() const
Definition: RuleLine.h:81
Direction direction
Definition: RuleLine.h:97
double GetLength() const
Definition: RuleLine.h:84
#define MR_DllDeclare
Definition: RuleLine.h:35
Definition: Announcement.h:24
double length
Definition: RuleLine.h:98
Definition: Vec.h:114
Direction
Definition: RuleLine.h:70
void AttachView(Display &disp) override
Definition: RuleLine.h:78
Color color
Definition: RuleLine.h:100
virtual ~RuleLine()
Definition: RuleLine.h:75