Crazy Eddies GUI System
0.7.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
cegui
include
elements
CEGUISlider.h
1
/***********************************************************************
2
filename: CEGUISlider.h
3
created: 13/4/2004
4
author: Paul D Turner
5
6
purpose: Interface to base class for Slider widget
7
*************************************************************************/
8
/***************************************************************************
9
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10
*
11
* Permission is hereby granted, free of charge, to any person obtaining
12
* a copy of this software and associated documentation files (the
13
* "Software"), to deal in the Software without restriction, including
14
* without limitation the rights to use, copy, modify, merge, publish,
15
* distribute, sublicense, and/or sell copies of the Software, and to
16
* permit persons to whom the Software is furnished to do so, subject to
17
* the following conditions:
18
*
19
* The above copyright notice and this permission notice shall be
20
* included in all copies or substantial portions of the Software.
21
*
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28
* OTHER DEALINGS IN THE SOFTWARE.
29
***************************************************************************/
30
#ifndef _CEGUISlider_h_
31
#define _CEGUISlider_h_
32
33
#include "../CEGUIBase.h"
34
#include "../CEGUIWindow.h"
35
#include "CEGUISliderProperties.h"
36
37
38
#if defined(_MSC_VER)
39
# pragma warning(push)
40
# pragma warning(disable : 4251)
41
#endif
42
43
44
// Start of CEGUI namespace section
45
namespace
CEGUI
46
{
47
52
class
CEGUIEXPORT
SliderWindowRenderer
:
public
WindowRenderer
53
{
54
public
:
59
SliderWindowRenderer
(
const
String
& name);
60
65
virtual
void
updateThumb(
void
) = 0;
66
74
virtual
float
getValueFromThumb(
void
)
const
= 0;
75
89
virtual
float
getAdjustDirectionFromPoint(
const
Point
& pt)
const
= 0;
90
};
91
92
100
class
CEGUIEXPORT
Slider
:
public
Window
101
{
102
public
:
103
static
const
String
EventNamespace
;
104
static
const
String
WidgetTypeName
;
105
106
/*************************************************************************
107
Event name constants
108
*************************************************************************/
113
static
const
String
EventValueChanged
;
119
static
const
String
EventThumbTrackStarted
;
124
static
const
String
EventThumbTrackEnded
;
125
126
/*************************************************************************
127
Child Widget name suffix constants
128
*************************************************************************/
129
static
const
String
ThumbNameSuffix
;
130
131
/*************************************************************************
132
Accessors
133
*************************************************************************/
141
float
getCurrentValue
(
void
)
const
{
return
d_value;}
142
143
151
float
getMaxValue
(
void
)
const
{
return
d_maxValue;}
152
153
164
float
getClickStep
(
void
)
const
{
return
d_step;}
165
166
177
Thumb
* getThumb()
const
;
178
179
180
/*************************************************************************
181
Manipulators
182
*************************************************************************/
193
virtual
void
initialiseComponents(
void
);
194
195
206
void
setMaxValue(
float
maxVal);
207
208
219
void
setCurrentValue(
float
value);
220
221
235
void
setClickStep
(
float
step) {d_step = step;}
236
237
238
/*************************************************************************
239
Construction / Destruction
240
*************************************************************************/
245
Slider
(
const
String
& type,
const
String
& name);
246
247
252
virtual
~
Slider
(
void
);
253
254
255
protected
:
256
/*************************************************************************
257
Implementation Functions
258
*************************************************************************/
263
virtual
void
updateThumb(
void
);
264
265
273
virtual
float
getValueFromThumb(
void
)
const
;
274
275
289
virtual
float
getAdjustDirectionFromPoint(
const
Point
& pt)
const
;
290
291
296
//virtual void updateThumb_impl(void) = 0;
297
298
306
//virtual float getValueFromThumb_impl(void) const = 0;
307
308
322
//virtual float getAdjustDirectionFromPoint_impl(const Point& pt) const = 0;
323
328
bool
handleThumbMoved(
const
EventArgs
& e);
329
330
335
bool
handleThumbTrackStarted(
const
EventArgs
& e);
336
337
342
bool
handleThumbTrackEnded(
const
EventArgs
& e);
343
344
355
virtual
bool
testClassName_impl(
const
String
& class_name)
const
356
{
357
if
(class_name==
"Slider"
)
return
true
;
358
return
Window::testClassName_impl
(class_name);
359
}
360
361
362
// validate window renderer
363
virtual
bool
validateWindowRenderer(
const
String
& name)
const
364
{
365
return
(name ==
"Slider"
);
366
}
367
368
369
/*************************************************************************
370
New event handlers for slider widget
371
*************************************************************************/
376
virtual
void
onValueChanged(
WindowEventArgs
& e);
377
378
383
virtual
void
onThumbTrackStarted(
WindowEventArgs
& e);
384
385
390
virtual
void
onThumbTrackEnded(
WindowEventArgs
& e);
391
392
393
/*************************************************************************
394
Overridden event handlers
395
*************************************************************************/
396
virtual
void
onMouseButtonDown(
MouseEventArgs
& e);
397
virtual
void
onMouseWheel(
MouseEventArgs
& e);
398
399
400
/*************************************************************************
401
Implementation Data
402
*************************************************************************/
403
float
d_value
;
404
float
d_maxValue
;
405
float
d_step
;
406
407
private
:
408
/*************************************************************************
409
Static Properties for this class
410
*************************************************************************/
411
static
SliderProperties::CurrentValue
d_currentValueProperty;
412
static
SliderProperties::MaximumValue
d_maximumValueProperty;
413
static
SliderProperties::ClickStepSize
d_clickStepSizeProperty;
414
415
416
/*************************************************************************
417
Private methods
418
*************************************************************************/
419
void
addSliderProperties(
void
);
420
};
421
422
}
// End of CEGUI namespace section
423
424
#if defined(_MSC_VER)
425
# pragma warning(pop)
426
#endif
427
428
#endif // end of guard _CEGUISlider_h_
Generated by
1.8.3.1