Neo  0.5.0
Developer Documentation
Slider.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 (C) Yannick Pflanzer <neo-engine.de>
3  *
4  * This file is part of Neo2D.
5  *
6  * Neo2D is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Neo2D is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with Neo2D. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Diese Datei ist Teil von Neo2D.
20  *
21  * Neo2D ist Freie Software: Sie können es unter den Bedingungen
22  * der GNU Lesser General Public License, wie von der Free Software Foundation,
23  * Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
24  * veröffentlichten Version, weiterverbreiten und/oder modifizieren.
25  *
26  * Neo2D wird in der Hoffnung, dass es nützlich sein wird, aber
27  * OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
28  * Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
29  * Siehe die GNU Lesser General Public License für weitere Details.
30  *
31  * Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit
32  *diesem
33  * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
34  */
35 
36 #ifndef __SLIDER_H__
37 #define __SLIDER_H__
38 
39 #include <string>
40 #include <NeoEngine.h>
41 #include <Widget.h>
42 
43 namespace Neo2D
44 {
45 namespace Gui
46 {
47 
48 using namespace Neo;
49 
51 {
54 };
55 
57 {
60 };
61 
68 class NEO2D_EXPORT Slider : public Widget
69 {
70  SLIDER_DIRECTION m_direction;
71  SLIDER_STATE m_state;
72 
73  Vector2 m_range;
74  float m_value;
75 
76  float m_mx;
77  float m_my;
78 
79 public:
80  Slider(unsigned int x, unsigned int y, unsigned int width,
81  unsigned int height, float min, float max, SLIDER_DIRECTION dir)
82  : Widget(x, y, width, height, ""),
83  m_direction(dir),
84  m_range(min, max),
85  m_mx(0),
86  m_my(0),
87  m_value(0),
88  m_state(SLIDER_NORMAL)
89  {}
90 
91  Vector2 getRange() { return m_range; }
92  void setRange(Vector2 range) { m_range = range; }
93 
94  void setValue(float value) { m_value = value; }
95  float getValue() { return m_value; }
96 
97  void draw(Vector2 offset);
98  void update();
99 };
100 }
101 }
102 #endif
void setRange(Vector2 range)
Definition: Slider.h:92
The Slider class implements a slider that interpolates values in a given range.
Definition: Slider.h:68
Definition: Slider.h:59
Definition: Slider.h:53
The Widget class contains all information that is common to all GUI widgets.
Definition: Widget.h:72
Vector2 getRange()
Definition: Slider.h:91
void setValue(float value)
Definition: Slider.h:94
Definition: Vector2.h:31
Definition: Button.h:42
Definition: Slider.h:52
Definition: Slider.h:58
SLIDER_DIRECTION
Definition: Slider.h:50
Slider(unsigned int x, unsigned int y, unsigned int width, unsigned int height, float min, float max, SLIDER_DIRECTION dir)
Definition: Slider.h:80
Definition: Color.h:29
float getValue()
Definition: Slider.h:95
SLIDER_STATE
Definition: Slider.h:56