1
0
forked from 0ad/0ad
0ad/source/tools/fontbuilder/wxspinner.h
Ykkrosh b65d35ea2e Font builder code
This was SVN commit r527.
2004-06-17 19:32:04 +00:00

23 lines
627 B
C++
Executable File

// $Id: wxspinner.h,v 1.1 2004/06/17 19:32:04 philip Exp $
class StyleSpinCtrl : public wxSpinCtrl
{
public:
StyleSpinCtrl(wxWindow* parent, wxWindowID win_id, int min_val, int max_val, int initial_val)
: wxSpinCtrl(parent, win_id, wxEmptyString, wxDefaultPosition, wxSize(50, 20), wxSP_ARROW_KEYS, min_val, max_val, initial_val)
{
SetValue(initial_val);
}
// Like GetValue, but guaranteed to be inside the range (Min..Max)
// no matter what people type in
int GetValidValue()
{
int Value = GetValue();
int Min = GetMin();
int Max = GetMax();
return Value <= Min ? Min : Value >= Max ? Max : Value;
}
};