Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CSlider.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#ifndef INCLUDED_CSLIDER
19#define INCLUDED_CSLIDER
20
21#include "gui/CGUISetting.h"
22#include "gui/CGUISprite.h"
25#include "maths/Vector2D.h"
26#include "ps/CStr.h"
27
28class CGUI;
29class CRect;
30
32{
34
35public:
36 CSlider(CGUI& pGUI);
37
38protected:
39 static const CStr EventNameValueChange;
40
41 /**
42 * @see IGUIObject#ResetStates()
43 */
44 virtual void ResetStates();
45
46 /**
47 * @see IGUIObject#HandleMessage()
48 */
49 virtual void HandleMessage(SGUIMessage& Message);
50
51 virtual void Draw(CCanvas2D& canvas);
52
53 /**
54 * Change settings and send the script event
55 */
56 void UpdateValue();
57
58 CRect GetButtonRect() const;
59
60 /**
61 * @return ratio between the value of the slider and its actual size in the GUI
62 */
63 float GetSliderRatio() const;
64
65 void IncrementallyChangeValue(const float value);
66
67 // Settings
74
75private:
77};
78
79#endif // INCLUDED_CSLIDER
#define GUI_OBJECT(obj)
Definition: IGUIObject.h:53
Definition: Canvas2D.h:36
The main object that represents a whole GUI page.
Definition: CGUI.h:80
Rectangle class used for screen rectangles.
Definition: Rect.h:31
Definition: CSlider.h:32
CGUISimpleSetting< CGUISpriteInstance > m_SpriteBar
Definition: CSlider.h:72
virtual void Draw(CCanvas2D &canvas)
Draws the object.
Definition: CSlider.cpp:106
CGUISimpleSetting< float > m_ButtonSide
Definition: CSlider.h:68
CGUISimpleSetting< float > m_MinValue
Definition: CSlider.h:69
CGUISimpleSetting< CGUISpriteInstance > m_Sprite
Definition: CSlider.h:71
void UpdateValue()
Change settings and send the script event.
Definition: CSlider.cpp:115
virtual void ResetStates()
Definition: CSlider.cpp:44
CSlider(CGUI &pGUI)
Definition: CSlider.cpp:29
CGUISimpleSetting< float > m_MaxValue
Definition: CSlider.h:70
CGUISimpleSetting< CGUISpriteInstance > m_SpriteBarDisabled
Definition: CSlider.h:72
CGUISimpleSetting< CGUISpriteInstance > m_SpriteDisabled
Definition: CSlider.h:71
CRect GetButtonRect() const
Definition: CSlider.cpp:120
void IncrementallyChangeValue(const float value)
Definition: CSlider.cpp:55
float GetSliderRatio() const
Definition: CSlider.cpp:50
static const CStr EventNameValueChange
Definition: CSlider.h:39
virtual void HandleMessage(SGUIMessage &Message)
Definition: CSlider.cpp:61
CVector2D m_Mouse
Definition: CSlider.h:76
CGUISimpleSetting< float > m_Value
Definition: CSlider.h:73
Definition: Vector2D.h:32
Appends button behaviours to the IGUIObject.
Definition: IGUIButtonBehavior.h:43
GUI object such as a button or an input-box.
Definition: IGUIObject.h:63
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:73