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