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