Crazy Eddies GUI System
0.7.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
cegui
include
elements
CEGUISpinner.h
1
/***********************************************************************
2
filename: CEGUISpinner.h
3
created: 3/2/2005
4
author: Paul D Turner
5
*************************************************************************/
6
/***************************************************************************
7
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
8
*
9
* Permission is hereby granted, free of charge, to any person obtaining
10
* a copy of this software and associated documentation files (the
11
* "Software"), to deal in the Software without restriction, including
12
* without limitation the rights to use, copy, modify, merge, publish,
13
* distribute, sublicense, and/or sell copies of the Software, and to
14
* permit persons to whom the Software is furnished to do so, subject to
15
* the following conditions:
16
*
17
* The above copyright notice and this permission notice shall be
18
* included in all copies or substantial portions of the Software.
19
*
20
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
* OTHER DEALINGS IN THE SOFTWARE.
27
***************************************************************************/
28
#ifndef _CEGUISpinner_h_
29
#define _CEGUISpinner_h_
30
31
#include "../CEGUIBase.h"
32
#include "../CEGUIWindow.h"
33
#include "CEGUISpinnerProperties.h"
34
35
#if defined(_MSC_VER)
36
# pragma warning(push)
37
# pragma warning(disable : 4251)
38
#endif
39
40
41
// Start of CEGUI namespace section
42
namespace
CEGUI
43
{
52
class
CEGUIEXPORT
Spinner
:
public
Window
53
{
54
public
:
59
enum
TextInputMode
60
{
61
FloatingPoint
,
62
Integer
,
63
Hexadecimal
,
64
Octal
65
};
66
67
/*************************************************************************
68
Events system constants
69
*************************************************************************/
70
static
const
String
WidgetTypeName
;
71
static
const
String
EventNamespace
;
72
static
const
String
EventValueChanged
;
73
static
const
String
EventStepChanged
;
74
static
const
String
EventMaximumValueChanged
;
75
static
const
String
EventMinimumValueChanged
;
76
static
const
String
EventTextInputModeChanged
;
77
78
/*************************************************************************
79
Component widget name suffix strings
80
*************************************************************************/
81
static
const
String
EditboxNameSuffix
;
82
static
const
String
IncreaseButtonNameSuffix
;
83
static
const
String
DecreaseButtonNameSuffix
;
84
85
/*************************************************************************
86
Object Construction and Destruction
87
*************************************************************************/
92
Spinner
(
const
String
& type,
const
String
& name);
93
98
virtual
~
Spinner
(
void
);
99
110
void
initialiseComponents(
void
);
111
112
113
/*************************************************************************
114
Accessors
115
*************************************************************************/
123
double
getCurrentValue(
void
)
const
;
124
133
double
getStepSize(
void
)
const
;
134
142
double
getMaximumValue(
void
)
const
;
143
151
double
getMinimumValue(
void
)
const
;
152
161
TextInputMode
getTextInputMode(
void
)
const
;
162
163
/*************************************************************************
164
Manipulators
165
*************************************************************************/
176
void
setCurrentValue(
double
value);
177
189
void
setStepSize(
double
step);
190
201
void
setMaximumValue(
double
maxValue);
202
213
void
setMinimumValue(
double
minVaue);
214
226
void
setTextInputMode(
TextInputMode
mode);
227
228
protected
:
229
/*************************************************************************
230
Constants
231
*************************************************************************/
232
static
const
String
FloatValidator
;
233
static
const
String
IntegerValidator
;
234
static
const
String
HexValidator
;
235
static
const
String
OctalValidator
;
236
237
/*************************************************************************
238
Protected Implementation Methods
239
*************************************************************************/
249
virtual
double
getValueFromText(
void
)
const
;
250
258
virtual
String
getTextFromValue(
void
)
const
;
259
260
271
virtual
bool
testClassName_impl(
const
String
& class_name)
const
272
{
273
if
(class_name==
"Spinner"
)
return
true
;
274
return
Window::testClassName_impl
(class_name);
275
}
276
288
PushButton
* getIncreaseButton()
const
;
289
301
PushButton
* getDecreaseButton()
const
;
302
313
Editbox
* getEditbox()
const
;
314
315
/*************************************************************************
316
Overrides for Event handler methods
317
*************************************************************************/
318
virtual
void
onFontChanged(
WindowEventArgs
& e);
319
virtual
void
onTextChanged(
WindowEventArgs
& e);
320
virtual
void
onActivated(
ActivationEventArgs
& e);
321
322
/*************************************************************************
323
New Event handler methods
324
*************************************************************************/
335
virtual
void
onValueChanged(
WindowEventArgs
& e);
336
347
virtual
void
onStepChanged(
WindowEventArgs
& e);
348
359
virtual
void
onMaximumValueChanged(
WindowEventArgs
& e);
360
371
virtual
void
onMinimumValueChanged(
WindowEventArgs
& e);
372
383
virtual
void
onTextInputModeChanged(
WindowEventArgs
& e);
384
385
/*************************************************************************
386
Internal event listener methods
387
*************************************************************************/
388
bool
handleIncreaseButton(
const
EventArgs
& e);
389
bool
handleDecreaseButton(
const
EventArgs
& e);
390
bool
handleEditTextChange(
const
EventArgs
& e);
391
392
393
/*************************************************************************
394
Data Fields
395
*************************************************************************/
396
double
d_stepSize
;
397
double
d_currentValue
;
398
double
d_maxValue
;
399
double
d_minValue
;
400
TextInputMode
d_inputMode
;
401
402
private
:
403
/*************************************************************************
404
Static properties for the Spinner widget
405
*************************************************************************/
406
static
SpinnerProperties::CurrentValue
d_currentValueProperty;
407
static
SpinnerProperties::StepSize
d_stepSizeProperty;
408
static
SpinnerProperties::MaximumValue
d_maxValueProperty;
409
static
SpinnerProperties::MinimumValue
d_minValueProperty;
410
static
SpinnerProperties::TextInputMode
d_textInputModeProperty;
411
412
/*************************************************************************
413
Private Implementation Methods
414
*************************************************************************/
422
void
addSpinnerProperties(
void
);
423
};
424
425
}
// End of CEGUI namespace section
426
427
#if defined(_MSC_VER)
428
# pragma warning(pop)
429
#endif
430
431
#endif // end of guard _CEGUISpinner_h_
Generated by
1.8.3.1