0ad/source/tools/fontbuilder/wxspinner.h
Ykkrosh 9bc8559c49 Even more Linuxness
This was SVN commit r547.
2004-06-19 12:56:09 +00:00

25 lines
653 B
C++
Executable File

// $Id: wxspinner.h,v 1.2 2004/06/19 12:56:09 philip Exp $
#include "wx/spinctrl.h"
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;
}
};