2014-09-25 18:28:00 +00:00
|
|
|
#ifndef OPENMW_NUMERIC_EDIT_BOX_H
|
|
|
|
#define OPENMW_NUMERIC_EDIT_BOX_H
|
|
|
|
|
|
|
|
#include <MyGUI_EditBox.h>
|
|
|
|
|
2018-06-18 09:43:39 +00:00
|
|
|
#include "fontwrapper.hpp"
|
|
|
|
|
2014-09-25 18:28:00 +00:00
|
|
|
namespace Gui
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief A variant of the EditBox that only allows integer inputs
|
|
|
|
*/
|
2018-06-18 09:43:39 +00:00
|
|
|
class NumericEditBox : public FontWrapper<MyGUI::EditBox>
|
2014-09-25 18:28:00 +00:00
|
|
|
{
|
|
|
|
MYGUI_RTTI_DERIVED(NumericEditBox)
|
|
|
|
|
|
|
|
public:
|
|
|
|
NumericEditBox()
|
2014-10-12 21:26:03 +00:00
|
|
|
: mValue(0), mMinValue(std::numeric_limits<int>::min()),
|
|
|
|
mMaxValue(std::numeric_limits<int>::max())
|
2018-06-18 09:43:39 +00:00
|
|
|
{
|
|
|
|
}
|
2014-09-25 18:28:00 +00:00
|
|
|
|
|
|
|
void initialiseOverride();
|
|
|
|
void shutdownOverride();
|
|
|
|
|
|
|
|
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_ValueChanged;
|
|
|
|
EventHandle_ValueChanged eventValueChanged;
|
|
|
|
|
|
|
|
/// @note Does not trigger eventValueChanged
|
|
|
|
void setValue (int value);
|
2018-09-18 10:57:21 +00:00
|
|
|
int getValue();
|
2014-09-25 18:28:00 +00:00
|
|
|
|
|
|
|
void setMinValue(int minValue);
|
|
|
|
void setMaxValue(int maxValue);
|
|
|
|
private:
|
|
|
|
void onEditTextChange(MyGUI::EditBox* sender);
|
|
|
|
void onKeyLostFocus(MyGUI::Widget* _new);
|
2017-09-24 11:17:08 +00:00
|
|
|
void onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character);
|
2014-09-25 18:28:00 +00:00
|
|
|
|
|
|
|
int mValue;
|
|
|
|
|
|
|
|
int mMinValue;
|
|
|
|
int mMaxValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|