1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00
OpenMW/components/widgets/numericeditbox.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.2 KiB
C++
Raw Normal View History

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
*/
2020-02-13 20:36:56 +00:00
class NumericEditBox final : public FontWrapper<MyGUI::EditBox>
2014-09-25 18:28:00 +00:00
{
MYGUI_RTTI_DERIVED(NumericEditBox)
public:
NumericEditBox()
: 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() override;
void shutdownOverride() override;
2014-09-25 18:28:00 +00:00
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);
2022-09-22 18:26:05 +00:00
2014-09-25 18:28:00 +00:00
private:
void onEditTextChange(MyGUI::EditBox* sender);
void onKeyLostFocus(MyGUI::Widget* _new) override;
void onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char character) override;
2014-09-25 18:28:00 +00:00
int mValue;
int mMinValue;
int mMaxValue;
};
}
#endif