Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / include / wx / gtk1 / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/spinctrl.h
3 // Purpose: wxSpinCtrl class
4 // Author: Robert Roebling
5 // Modified by:
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKSPINCTRLH__
11 #define __GTKSPINCTRLH__
12
13 #include "wx/defs.h"
14
15 #if wxUSE_SPINCTRL
16
17 #include "wx/control.h"
18
19 //-----------------------------------------------------------------------------
20 // wxSpinCtrl
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
24 {
25 public:
26 wxSpinCtrl() {}
27 wxSpinCtrl(wxWindow *parent,
28 wxWindowID id = -1,
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"))
35 {
36 Create(parent, id, value, pos, size, style, min, max, initial, name);
37 }
38
39 bool Create(wxWindow *parent,
40 wxWindowID id = -1,
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"));
47
48 void SetValue(const wxString& text);
49 void SetSelection(long from, long to);
50
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;
56
57 static wxVisualAttributes
58 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
59
60 // implementation
61 void OnChar( wxKeyEvent &event );
62
63 bool IsOwnGtkWindow( GdkWindow *window );
64 void GtkDisableEvents();
65 void GtkEnableEvents();
66
67 GtkAdjustment *m_adjust;
68 float m_oldPos;
69
70 virtual int GetBase() const { return m_base; }
71 virtual bool SetBase(int base);
72
73 protected:
74 virtual wxSize DoGetBestSize() const;
75
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; }
79
80 private:
81 // Common part of all ctors.
82 void Init()
83 {
84 m_base = 10;
85 }
86
87 int m_base;
88
89 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
90 DECLARE_EVENT_TABLE()
91 };
92
93 #endif
94 // wxUSE_SPINCTRL
95
96 #endif
97 // __GTKSPINCTRLH__