Pyrogenesis  trunk
CGUIScrollBarVertical.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19 A GUI ScrollBar
20 
21 --Overview--
22 
23  A GUI Scrollbar, this class doesn't present all functionality
24  to the scrollbar, it just controls the drawing and a wrapper
25  for interaction with it.
26 
27 --Usage--
28 
29  Used in everywhere scrollbars are needed, like in a combobox for instance.
30 
31 --More info--
32 
33  Check GUI.h
34 
35 */
36 
37 #ifndef INCLUDED_CGUISCROLLBARVERTICAL
38 #define INCLUDED_CGUISCROLLBARVERTICAL
39 
40 #include "IGUIScrollBar.h"
41 #include "GUI.h"
42 
43 /**
44  * Vertical implementation of IGUIScrollBar
45  *
46  * @see IGUIScrollBar
47  */
49 {
50 public:
52  virtual ~CGUIScrollBarVertical();
53 
54 public:
55  /**
56  * Draw the scroll-bar
57  */
58  virtual void Draw();
59 
60  /**
61  * If an object that contains a scrollbar has got messages, send
62  * them to the scroll-bar and it will see if the message regarded
63  * itself.
64  *
65  * @see IGUIObject#HandleMessage()
66  */
67  virtual void HandleMessage(SGUIMessage& Message);
68 
69  /**
70  * Set m_Pos with g_mouse_x/y input, i.e. when dragging.
71  */
72  virtual void SetPosFromMousePos(const CPos& mouse);
73 
74  /**
75  * @see IGUIScrollBar#HoveringButtonMinus
76  */
77  virtual bool HoveringButtonMinus(const CPos& mouse);
78 
79  /**
80  * @see IGUIScrollBar#HoveringButtonPlus
81  */
82  virtual bool HoveringButtonPlus(const CPos& mouse);
83 
84  /**
85  * Set Right Aligned
86  * @param align Alignment
87  */
88  void SetRightAligned(const bool& align) { m_RightAligned = align; }
89 
90  /**
91  * Get the rectangle of the actual BAR.
92  * @return Rectangle, CRect
93  */
94  virtual CRect GetBarRect() const;
95 
96  /**
97  * Get the rectangle of the outline of the scrollbar, every component of the
98  * scroll-bar should be inside this area.
99  * @return Rectangle, CRect
100  */
101  virtual CRect GetOuterRect() const;
102 
103 protected:
104  /**
105  * Should the scroll bar proceed to the left or to the right of the m_X value.
106  * Notice, this has nothing to do with where the owner places it.
107  */
109 };
110 
111 #endif // INCLUDED_CGUISCROLLBARVERTICAL
CGUIScrollBarVertical()
Definition: CGUIScrollBarVertical.cpp:27
virtual void HandleMessage(SGUIMessage &Message)
If an object that contains a scrollbar has got messages, send them to the scroll-bar and it will see ...
Definition: CGUIScrollBarVertical.cpp:134
virtual CRect GetOuterRect() const
Get the rectangle of the outline of the scrollbar, every component of the scroll-bar should be inside...
Definition: CGUIScrollBarVertical.cpp:163
virtual void SetPosFromMousePos(const CPos &mouse)
Set m_Pos with g_mouse_x/y input, i.e.
Definition: CGUIScrollBarVertical.cpp:35
virtual void Draw()
Draw the scroll-bar.
Definition: CGUIScrollBarVertical.cpp:51
Vertical implementation of IGUIScrollBar.
Definition: CGUIScrollBarVertical.h:48
virtual CRect GetBarRect() const
Get the rectangle of the actual BAR.
Definition: CGUIScrollBarVertical.cpp:139
Made to represent screen positions and delta values.
Definition: Shapes.h:169
virtual bool HoveringButtonMinus(const CPos &mouse)
Definition: CGUIScrollBarVertical.cpp:177
void SetRightAligned(const bool &align)
Set Right Aligned.
Definition: CGUIScrollBarVertical.h:88
The GUI Scroll-bar, used everywhere there is a scroll-bar in the game.
Definition: IGUIScrollBar.h:155
virtual bool HoveringButtonPlus(const CPos &mouse)
Definition: CGUIScrollBarVertical.cpp:190
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:91
virtual ~CGUIScrollBarVertical()
Definition: CGUIScrollBarVertical.cpp:31
bool m_RightAligned
Should the scroll bar proceed to the left or to the right of the m_X value.
Definition: CGUIScrollBarVertical.h:108
Rectangle class used for screen rectangles.
Definition: Shapes.h:73