1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/spinctrl.h
3 // Purpose: wxSpinCtrl class
4 // Author: Robert Roebling
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKSPINCTRLH__
12 #define __GTKSPINCTRLH__
18 #include "wx/control.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 class WXDLLIMPEXP_CORE wxSpinCtrl
: public wxControl
28 wxSpinCtrl(wxWindow
*parent
,
30 const wxString
& value
= wxEmptyString
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
33 long style
= wxSP_ARROW_KEYS
,
34 int min
= 0, int max
= 100, int initial
= 0,
35 const wxString
& name
= wxT("wxSpinCtrl"))
37 Create(parent
, id
, value
, pos
, size
, style
, min
, max
, initial
, name
);
40 bool Create(wxWindow
*parent
,
42 const wxString
& value
= wxEmptyString
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 long style
= wxSP_ARROW_KEYS
,
46 int min
= 0, int max
= 100, int initial
= 0,
47 const wxString
& name
= wxT("wxSpinCtrl"));
49 void SetValue(const wxString
& text
);
50 void SetSelection(long from
, long to
);
52 virtual int GetValue() const;
53 virtual void SetValue( int value
);
54 virtual void SetRange( int minVal
, int maxVal
);
55 virtual int GetMin() const;
56 virtual int GetMax() const;
58 static wxVisualAttributes
59 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
62 void OnChar( wxKeyEvent
&event
);
64 bool IsOwnGtkWindow( GdkWindow
*window
);
65 void GtkDisableEvents();
66 void GtkEnableEvents();
68 GtkAdjustment
*m_adjust
;
71 virtual int GetBase() const { return m_base
; }
72 virtual bool SetBase(int base
);
75 virtual wxSize
DoGetBestSize() const;
77 // Widgets that use the style->base colour for the BG colour should
78 // override this and return true.
79 virtual bool UseGTKStyleBase() const { return true; }
82 // Common part of all ctors.
90 DECLARE_DYNAMIC_CLASS(wxSpinCtrl
)