📄 ceguispinner.h
字号:
/***********************************************************************
filename: CEGUISpinner.h
created: 3/2/2005
author: Paul D Turner
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUISpinner_h_
#define _CEGUISpinner_h_
#include "CEGUIBase.h"
#include "CEGUIWindow.h"
#include "elements/CEGUISpinnerProperties.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Base class for the Spinner widget.
The spinner widget has a text area where numbers may be entered
and two buttons which may be used to increase or decrease the
value in the text area by a user specified amount.
\note
While the Spinner widget has support for floating point values, the
results of using this support in its current state may not be
satisfactory. The general advice, for the moment, is to avoid
very large or very small values in floating point mode, and to
perform as little manipulation of the values as possible. The
various issues you may see range from scientific notation appearing
in the box, to complete breakdown of 'expected' values upon
manipulation. This is something that we intend to address for a
future release.
*/
class CEGUIEXPORT Spinner : public Window
{
public:
/*!
\brief
Enumerated type specifying possible input and/or display modes for the spinner.
*/
enum TextInputMode
{
FloatingPoint, //!< Floating point decimal.
Integer, //!< Integer decimal.
Hexadecimal, //!< Hexadecimal.
Octal //!< Octal
};
/*************************************************************************
Events system constants
*************************************************************************/
static const String WidgetTypeName; //!< Window factory name
static const String EventNamespace; //!< Namespace for global events
static const String EventValueChanged; //!< Event fired when the spinner value changes.
static const String EventStepChanged; //!< Event fired when the step value changes.
static const String EventMaximumValueChanged; //!< Event fired when the maximum spinner value changes.
static const String EventMinimumValueChanged; //!< Event fired when the minimum spinner value changes.
static const String EventTextInputModeChanged; //!< Event fired when the input/display mode is changed.
/*************************************************************************
Component widget name suffix strings
*************************************************************************/
static const String EditboxNameSuffix; //!< Widget name suffix for the editbox thumb component.
static const String IncreaseButtonNameSuffix; //!< Widget name suffix for the increase button component.
static const String DecreaseButtonNameSuffix; //!< Widget name suffix for the decrease button component.
/*************************************************************************
Object Construction and Destruction
*************************************************************************/
/*!
\brief
Constructor for Spinner objects
*/
Spinner(const String& type, const String& name);
/*!
\brief
Destructor for Spinner objects
*/
virtual ~Spinner(void);
/*!
\brief
Initialises the Window based object ready for use.
\note
This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.
\return
Nothing
*/
void initialiseComponents(void);
/*************************************************************************
Accessors
*************************************************************************/
/*!
\brief
Return the current spinner value.
\return
current float value of the Spinner.
*/
float getCurrentValue(void) const;
/*!
\brief
Return the current step value.
\return
float step value. This is the value added to the spinner vaue when the
up / down buttons are clicked.
*/
float getStepSize(void) const;
/*!
\brief
Return the current maximum limit value for the Spinner.
\return
Maximum value that is allowed for the spinner.
*/
float getMaximumValue(void) const;
/*!
\brief
Return the current minimum limit value for the Spinner.
\return
Minimum value that is allowed for the spinner.
*/
float getMinimumValue(void) const;
/*!
\brief
Return the current text input / display mode setting.
\return
One of the TextInputMode enumerated values indicating the current
text input and display mode.
*/
TextInputMode getTextInputMode(void) const;
/*************************************************************************
Manipulators
*************************************************************************/
/*!
\brief
Set the current spinner value.
\param value
value to be assigned to the Spinner.
\return
Nothing.
*/
void setCurrentValue(float value);
/*!
\brief
Set the current step value.
\param step
The value added to be the spinner value when the
up / down buttons are clicked.
\return
Nothing.
*/
void setStepSize(float step);
/*!
\brief
Set the spinner maximum value.
\param maxValue
The maximum value to be allowed by the spinner.
\return
Nothing.
*/
void setMaximumValue(float maxValue);
/*!
\brief
Set the spinner minimum value.
\param minVaue
The minimum value to be allowed by the spinner.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -