Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CGUIScrollBarHorizontal.h
Go to the documentation of this file.
1/* Copyright (C) 2025 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, this class doesn't present all functionality
20 to the scrollbar, it just controls the drawing and a wrapper
21 for interaction with it.
22 */
23
24#ifndef INCLUDED_CGUISCROLLBARHORIZONTAL
25#define INCLUDED_CGUISCROLLBARHORIZONTAL
26
27#include "IGUIScrollBar.h"
28
29class CGUI;
30
31 /**
32 * Horizontal implementation of IGUIScrollBar
33 *
34 * @see IGUIScrollBar
35 */
37{
38public:
41
42 /**
43 * Draw the scroll-bar
44 */
45 virtual void Draw(CCanvas2D& canvas);
46
47 /**
48 * If an object that contains a scrollbar has got messages, send
49 * them to the scroll-bar and it will see if the message regarded
50 * itself.
51 *
52 * @see IGUIObject#HandleMessage()
53 */
54 virtual void HandleMessage(SGUIMessage& Message);
55
56 /**
57 * Set m_Pos with g_mouse_x/y input, i.e. when dragging.
58 */
59 virtual void SetPosFromMousePos(const CVector2D& mouse);
60
61 virtual void SetScrollPlentyFromMousePos(const CVector2D& mouse);
62
63 /**
64 * @see IGUIScrollBar#HoveringButtonMinus
65 */
66 virtual bool HoveringButtonMinus(const CVector2D& mouse);
67
68 /**
69 * @see IGUIScrollBar#HoveringButtonPlus
70 */
71 virtual bool HoveringButtonPlus(const CVector2D& mouse);
72
73 /**
74 * Set Right Aligned
75 * @param align Alignment
76 */
77 void SetBottomAligned(const bool& align) { m_BottomAligned = align; }
78
79 /**
80 * Get the rectangle of the actual BAR.
81 * @return Rectangle, CRect
82 */
83 virtual CRect GetBarRect() const;
84
85 /**
86 * Get the rectangle of the outline of the scrollbar, every component of the
87 * scroll-bar should be inside this area.
88 * @return Rectangle, CRect
89 */
90 virtual CRect GetOuterRect() const;
91
92protected:
93 /**
94 * Should the scroll bar proceed to the top or to the bottom of the m_Y value.
95 * Notice, this has nothing to do with where the owner places it.
96 */
98};
99
100#endif // INCLUDED_CGUISCROLLBARHORIZONTAL
Definition: Canvas2D.h:36
Horizontal implementation of IGUIScrollBar.
Definition: CGUIScrollBarHorizontal.h:37
virtual void Draw(CCanvas2D &canvas)
Draw the scroll-bar.
Definition: CGUIScrollBarHorizontal.cpp:53
virtual void SetPosFromMousePos(const CVector2D &mouse)
Set m_Pos with g_mouse_x/y input, i.e.
Definition: CGUIScrollBarHorizontal.cpp:39
virtual CRect GetBarRect() const
Get the rectangle of the actual BAR.
Definition: CGUIScrollBarHorizontal.cpp:158
void SetBottomAligned(const bool &align)
Set Right Aligned.
Definition: CGUIScrollBarHorizontal.h:77
virtual CRect GetOuterRect() const
Get the rectangle of the outline of the scrollbar, every component of the scroll-bar should be inside...
Definition: CGUIScrollBarHorizontal.cpp:182
virtual bool HoveringButtonPlus(const CVector2D &mouse)
Definition: CGUIScrollBarHorizontal.cpp:209
virtual void SetScrollPlentyFromMousePos(const CVector2D &mouse)
Definition: CGUIScrollBarHorizontal.cpp:222
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: CGUIScrollBarHorizontal.cpp:126
virtual ~CGUIScrollBarHorizontal()
Definition: CGUIScrollBarHorizontal.cpp:35
virtual bool HoveringButtonMinus(const CVector2D &mouse)
Definition: CGUIScrollBarHorizontal.cpp:196
CGUIScrollBarHorizontal(CGUI &pGUI)
Definition: CGUIScrollBarHorizontal.cpp:30
bool m_BottomAligned
Should the scroll bar proceed to the top or to the bottom of the m_Y value.
Definition: CGUIScrollBarHorizontal.h:97
The main object that represents a whole GUI page.
Definition: CGUI.h:80
Rectangle class used for screen rectangles.
Definition: Rect.h:31
Definition: Vector2D.h:32
The GUI Scroll-bar, used everywhere there is a scroll-bar in the game.
Definition: IGUIScrollBar.h:163
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:73