]>
Commit | Line | Data |
---|---|---|
738f9e5a RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: spinctrl.h | |
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 | ||
12028905 | 14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
738f9e5a RR |
15 | #pragma interface |
16 | #endif | |
17 | ||
a075e27b RR |
18 | #include "wx/defs.h" |
19 | ||
20 | #if wxUSE_SPINCTRL | |
21 | ||
22 | #include "wx/control.h" | |
23 | ||
738f9e5a | 24 | //----------------------------------------------------------------------------- |
ce89fdd2 | 25 | // wxSpinCtrl |
738f9e5a RR |
26 | //----------------------------------------------------------------------------- |
27 | ||
20123d49 | 28 | class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl |
738f9e5a RR |
29 | { |
30 | public: | |
31 | wxSpinCtrl() {} | |
32 | wxSpinCtrl(wxWindow *parent, | |
33 | wxWindowID id = -1, | |
ce89fdd2 | 34 | const wxString& value = wxEmptyString, |
738f9e5a RR |
35 | const wxPoint& pos = wxDefaultPosition, |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxSP_ARROW_KEYS, | |
38 | int min = 0, int max = 100, int initial = 0, | |
39 | const wxString& name = _T("wxSpinCtrl")) | |
40 | { | |
ce89fdd2 | 41 | Create(parent, id, value, pos, size, style, min, max, initial, name); |
738f9e5a RR |
42 | } |
43 | ||
44 | bool Create(wxWindow *parent, | |
45 | wxWindowID id = -1, | |
ce89fdd2 | 46 | const wxString& value = wxEmptyString, |
738f9e5a RR |
47 | const wxPoint& pos = wxDefaultPosition, |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = wxSP_ARROW_KEYS, | |
50 | int min = 0, int max = 100, int initial = 0, | |
51 | const wxString& name = _T("wxSpinCtrl")); | |
52 | ||
ce89fdd2 | 53 | void SetValue(const wxString& text); |
f8f9ec55 | 54 | void SetSelection(long from, long to); |
ce89fdd2 | 55 | |
738f9e5a RR |
56 | virtual int GetValue() const; |
57 | virtual void SetValue( int value ); | |
58 | virtual void SetRange( int minVal, int maxVal ); | |
59 | virtual int GetMin() const; | |
60 | virtual int GetMax() const; | |
61 | ||
9d522606 RD |
62 | static wxVisualAttributes |
63 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
64 | ||
ce89fdd2 | 65 | // implementation |
da048e3d RR |
66 | void OnChar( wxKeyEvent &event ); |
67 | ||
738f9e5a | 68 | bool IsOwnGtkWindow( GdkWindow *window ); |
07f5b19a RR |
69 | void GtkDisableEvents(); |
70 | void GtkEnableEvents(); | |
738f9e5a RR |
71 | |
72 | GtkAdjustment *m_adjust; | |
73 | float m_oldPos; | |
74 | ||
9d9b7755 VZ |
75 | protected: |
76 | virtual wxSize DoGetBestSize() const; | |
77 | ||
9d522606 RD |
78 | // Widgets that use the style->base colour for the BG colour should |
79 | // override this and return true. | |
80 | virtual bool UseGTKStyleBase() const { return true; } | |
81 | ||
738f9e5a RR |
82 | private: |
83 | DECLARE_DYNAMIC_CLASS(wxSpinCtrl) | |
da048e3d | 84 | DECLARE_EVENT_TABLE() |
738f9e5a RR |
85 | }; |
86 | ||
a075e27b RR |
87 | #endif |
88 | // wxUSE_SPINCTRL | |
89 | ||
738f9e5a RR |
90 | #endif |
91 | // __GTKSPINCTRLH__ |