Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CGUIScrollBarVertical.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_CGUISCROLLBARVERTICAL
25#define INCLUDED_CGUISCROLLBARVERTICAL
26
27#include "IGUIScrollBar.h"
28
29class CGUI;
30
31/**
32 * Vertical implementation of IGUIScrollBar
33 *
34 * @see IGUIScrollBar
35 */
37{
38public:
40 virtual ~CGUIScrollBarVertical();
41
42public:
43 /**
44 * Draw the scroll-bar
45 */
46 virtual void Draw(CCanvas2D& canvas);
47
48 /**
49 * If an object that contains a scrollbar has got messages, send
50 * them to the scroll-bar and it will see if the message regarded
51 * itself.
52 *
53 * @see IGUIObject#HandleMessage()
54 */
55 virtual void HandleMessage(SGUIMessage& Message);
56
57 /**
58 * Set m_Pos with g_mouse_x/y input, i.e. when dragging.
59 */
60 virtual void SetPosFromMousePos(const CVector2D& mouse);
61
62 virtual void SetScrollPlentyFromMousePos(const CVector2D& mouse);
63
64 /**
65 * @see IGUIScrollBar#HoveringButtonMinus
66 */
67 virtual bool HoveringButtonMinus(const CVector2D& mouse);
68
69 /**
70 * @see IGUIScrollBar#HoveringButtonPlus
71 */
72 virtual bool HoveringButtonPlus(const CVector2D& mouse);
73
74 /**
75 * Set Right Aligned
76 * @param align Alignment
77 */
78 void SetRightAligned(const bool& align) { m_RightAligned = align; }
79
80 /**
81 * Get the rectangle of the actual BAR.
82 * @return Rectangle, CRect
83 */
84 virtual CRect GetBarRect() const;
85
86 /**
87 * Get the rectangle of the outline of the scrollbar, every component of the
88 * scroll-bar should be inside this area.
89 * @return Rectangle, CRect
90 */
91 virtual CRect GetOuterRect() const;
92
93protected:
94 /**
95 * Should the scroll bar proceed to the left or to the right of the m_X value.
96 * Notice, this has nothing to do with where the owner places it.
97 */
99};
100
101#endif // INCLUDED_CGUISCROLLBARVERTICAL
Definition: Canvas2D.h:36
Vertical implementation of IGUIScrollBar.
Definition: CGUIScrollBarVertical.h:37
void SetRightAligned(const bool &align)
Set Right Aligned.
Definition: CGUIScrollBarVertical.h:78
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:190
virtual bool HoveringButtonMinus(const CVector2D &mouse)
Definition: CGUIScrollBarVertical.cpp:204
virtual CRect GetBarRect() const
Get the rectangle of the actual BAR.
Definition: CGUIScrollBarVertical.cpp:166
virtual void Draw(CCanvas2D &canvas)
Draw the scroll-bar.
Definition: CGUIScrollBarVertical.cpp:55
bool m_RightAligned
Should the scroll bar proceed to the left or to the right of the m_X value.
Definition: CGUIScrollBarVertical.h:98
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 ~CGUIScrollBarVertical()
Definition: CGUIScrollBarVertical.cpp:35
CGUIScrollBarVertical(CGUI &pGUI)
Definition: CGUIScrollBarVertical.cpp:30
virtual void SetScrollPlentyFromMousePos(const CVector2D &mouse)
Definition: CGUIScrollBarVertical.cpp:230
virtual bool HoveringButtonPlus(const CVector2D &mouse)
Definition: CGUIScrollBarVertical.cpp:217
virtual void SetPosFromMousePos(const CVector2D &mouse)
Set m_Pos with g_mouse_x/y input, i.e.
Definition: CGUIScrollBarVertical.cpp:39
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