1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/spinctrl.h
3 // Purpose: wxSpinCtrl class
4 // Author: Robert Roebling
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKSPINCTRLH__
11 #define __GTKSPINCTRLH__
17 #include "wx/control.h"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxSpinCtrl
: public wxControl
27 wxSpinCtrl(wxWindow
*parent
,
29 const wxString
& value
= wxEmptyString
,
30 const wxPoint
& pos
= wxDefaultPosition
,
31 const wxSize
& size
= wxDefaultSize
,
32 long style
= wxSP_ARROW_KEYS
,
33 int min
= 0, int max
= 100, int initial
= 0,
34 const wxString
& name
= wxT("wxSpinCtrl"))
36 Create(parent
, id
, value
, pos
, size
, style
, min
, max
, initial
, name
);
39 bool Create(wxWindow
*parent
,
41 const wxString
& value
= wxEmptyString
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
44 long style
= wxSP_ARROW_KEYS
,
45 int min
= 0, int max
= 100, int initial
= 0,
46 const wxString
& name
= wxT("wxSpinCtrl"));
48 void SetValue(const wxString
& text
);
49 void SetSelection(long from
, long to
);
51 virtual int GetValue() const;
52 virtual void SetValue( int value
);
53 virtual void SetRange( int minVal
, int maxVal
);
54 virtual int GetMin() const;
55 virtual int GetMax() const;
57 static wxVisualAttributes
58 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
61 void OnChar( wxKeyEvent
&event
);
63 bool IsOwnGtkWindow( GdkWindow
*window
);
64 void GtkDisableEvents();
65 void GtkEnableEvents();
67 GtkAdjustment
*m_adjust
;
70 virtual int GetBase() const { return m_base
; }
71 virtual bool SetBase(int base
);
74 virtual wxSize
DoGetBestSize() const;
76 // Widgets that use the style->base colour for the BG colour should
77 // override this and return true.
78 virtual bool UseGTKStyleBase() const { return true; }
81 // Common part of all ctors.
89 DECLARE_DYNAMIC_CLASS(wxSpinCtrl
)