-
Notifications
You must be signed in to change notification settings - Fork 2
/
uicore_Slider.h
156 lines (126 loc) · 5.58 KB
/
uicore_Slider.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
Copyright (C) 2007 Benjamin Litzelmann
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _UICORE_SLIDER_H_
#define _UICORE_SLIDER_H_
#include "uicore_Button.h"
#include "uicore_Label.h"
namespace UICore
{
class Slider : public BaseObject
{
protected:
Button *minus;
Button *plus;
Button *cursor;
Button *scrollbar;
bool horizontal;
int minvalue;
int maxvalue;
int curvalue;
int buttonstep;
int clickstep;
static void MinusClickHandler( BaseObject *target );
static void PlusClickHandler( BaseObject *target );
static void ScrollbarMouseDownClickHandler( BaseObject *target, float x, float y, int button );
static void DraggingCursorHandler( BaseObject *target, float, float );
static void MouseUpCursorHandler( BaseObject *target, float, float, int );
void (*ValueChange)( BaseObject *target, int oldvalue, int newvalue );
void refreshCursor( void );
virtual void BaseKeyDown( int key, int charVal );
virtual void Initialize( void );
public:
Slider();
Slider( BaseObject *parent, float x, float y, float w, float h, bool horizontal );
virtual ~Slider();
MEMORY_OPERATORS
virtual void Draw( unsigned int deltatime, const Rect *parentPos = NULL, const Rect *parentPosSrc = NULL, bool enabled = true );
void doMinus( void );
void doPlus( void );
void doScrollMinus( void );
void doScrollPlus( void );
virtual void setHorizontal( bool horizontal );
virtual void setMinValue( int value );
virtual void setMaxValue( int value );
virtual void setBoundValues( int minVal, int maxVal );
virtual void setCurValue( int value );
virtual void setButtonStepValue( int value );
virtual void setBarClickStepValue( int value );
virtual void setStepValues( int buttonStep, int barclickStep );
// Scrollbar panel
virtual void setSize( float w, float h );
virtual void setBackColor( const Color &color );
virtual void setBorderColor( const Color &color );
virtual void setDisabledColor( const Color &color );
virtual void setHighlightColor( const Color &color );
virtual void setBackgroundImage( Image image );
virtual void setDisabledImage( Image image );
virtual void setHighlightImage( Image image );
virtual void setBorderWidth( const float width );
// Buttons
virtual void setButtonBackColor( const Color &color );
virtual void setButtonBorderColor( const Color &color );
virtual void setButtonDisabledColor( const Color &color );
virtual void setButtonBackgroundImage( Image image );
virtual void setButtonDisabledImage( Image image );
virtual void setButtonBorderWidth( const float width );
virtual void setButtonHighlightColor( const Color &color );
virtual void setButtonHighlightImage( Image image );
// Cursor
virtual void setCursorBackColor( const Color &color );
virtual void setCursorBorderColor( const Color &color );
virtual void setCursorDisabledColor( const Color &color );
virtual void setCursorBackgroundImage( Image image );
virtual void setCursorDisabledImage( Image image );
virtual void setCursorBorderWidth( const float width );
virtual void setCursorHighlightColor( const Color &color );
virtual void setCursorHighlightImage( Image image );
virtual bool isHorizontal( void ) const;
virtual int getMinValue( void ) const;
virtual int getMaxValue( void ) const;
virtual int getCurValue( void ) const;
virtual int getButtonStepValue( void ) const;
virtual int getBarClickStepValue( void ) const;
// Scrollbar
virtual Color getBackColor( void ) const;
virtual Color getBorderColor( void ) const;
virtual Color getDisabledColor( void ) const;
virtual Color getHighlightColor( void ) const;
virtual Image getBackgroundImage( void ) const;
virtual Image getDisabledImage( void ) const;
virtual Image getHighlightImage( void ) const;
virtual float getBorderWidth( void ) const;
// Buttons
virtual Color getButtonBackColor( void ) const;
virtual Color getButtonBorderColor( void ) const;
virtual Color getButtonDisabledColor( void ) const;
virtual Image getButtonBackgroundImage( void ) const;
virtual Image getButtonDisabledImage( void ) const;
virtual float getButtonBorderWidth( void ) const;
virtual Color getButtonHighlightColor( void ) const;
virtual Image getButtonHighlightImage( void ) const;
// Cursor
virtual Color getCursorBackColor( void ) const;
virtual Color getCursorBorderColor( void ) const;
virtual Color getCursorDisabledColor( void ) const;
virtual Image getCursorBackgroundImage( void ) const;
virtual Image getCursorDisabledImage( void ) const;
virtual float getCursorBorderWidth( void ) const;
virtual Color getCursorHighlightColor( void ) const;
virtual Image getCursorHighlightImage( void ) const;
virtual void setValueChangeHandler( void (*ValueChange)( BaseObject *target, int oldvalue, int newvalue ) );
virtual std::string getType( void ) const;
};
}
#endif