]>
Commit | Line | Data |
---|---|---|
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 | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef __GTKSPINCTRLH__ | |
12 | #define __GTKSPINCTRLH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | ||
20 | #if wxUSE_SPINCTRL | |
21 | ||
22 | #include "wx/control.h" | |
23 | ||
24 | //----------------------------------------------------------------------------- | |
25 | // wxSpinCtrl | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
28 | class wxSpinCtrl : public wxControl | |
29 | { | |
30 | public: | |
31 | wxSpinCtrl() {} | |
32 | wxSpinCtrl(wxWindow *parent, | |
33 | wxWindowID id = -1, | |
34 | const wxString& value = wxEmptyString, | |
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 | { | |
41 | Create(parent, id, value, pos, size, style, min, max, initial, name); | |
42 | } | |
43 | ||
44 | bool Create(wxWindow *parent, | |
45 | wxWindowID id = -1, | |
46 | const wxString& value = wxEmptyString, | |
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 | ||
53 | void SetValue(const wxString& text); | |
54 | ||
55 | virtual int GetValue() const; | |
56 | virtual void SetValue( int value ); | |
57 | virtual void SetRange( int minVal, int maxVal ); | |
58 | virtual int GetMin() const; | |
59 | virtual int GetMax() const; | |
60 | ||
61 | // implementation | |
62 | // -------------- | |
63 | ||
64 | void OnChar( wxKeyEvent &event ); | |
65 | ||
66 | bool IsOwnGtkWindow( GdkWindow *window ); | |
67 | void ApplyWidgetStyle(); | |
68 | void GtkDisableEvents(); | |
69 | void GtkEnableEvents(); | |
70 | ||
71 | GtkAdjustment *m_adjust; | |
72 | float m_oldPos; | |
73 | ||
74 | protected: | |
75 | virtual wxSize DoGetBestSize() const; | |
76 | ||
77 | private: | |
78 | DECLARE_DYNAMIC_CLASS(wxSpinCtrl) | |
79 | DECLARE_EVENT_TABLE() | |
80 | }; | |
81 | ||
82 | #endif | |
83 | // wxUSE_SPINCTRL | |
84 | ||
85 | #endif | |
86 | // __GTKSPINCTRLH__ |