]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/spinbutt.h
Added zillions of #if wxUSE_XXX
[wxWidgets.git] / include / wx / gtk1 / spinbutt.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinbutt.h
3 // Purpose: wxSpinButton 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 __GTKSPINPUTTH__
12 #define __GTKSPINBUTTH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19
20 #ifdef wxUSE_SPINBTN
21
22 #include "wx/object.h"
23 #include "wx/control.h"
24
25 //-----------------------------------------------------------------------------
26 // classes
27 //-----------------------------------------------------------------------------
28
29 class wxSpinButton;
30 class wxSpinEvent;
31
32 //-----------------------------------------------------------------------------
33 // wxSpinButton
34 //-----------------------------------------------------------------------------
35
36 class wxSpinButton : public wxControl
37 {
38 DECLARE_DYNAMIC_CLASS(wxSpinButton)
39
40 public:
41 wxSpinButton();
42 inline wxSpinButton( wxWindow *parent, wxWindowID id = -1,
43 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
44 long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
45 {
46 Create(parent, id, pos, size, style, name);
47 }
48 ~wxSpinButton();
49 bool Create( wxWindow *parent, wxWindowID id = -1,
50 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
51 long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
52
53 int GetValue() const;
54 void SetValue( int value );
55 void SetRange( int minVal, int maxVal );
56 int GetMin() const;
57 int GetMax() const;
58
59 // implementation
60
61 void OnSize( wxSizeEvent &event );
62
63 bool IsOwnGtkWindow( GdkWindow *window );
64 void ApplyWidgetStyle();
65
66 GtkAdjustment *m_adjust;
67 float m_oldPos;
68
69 DECLARE_EVENT_TABLE()
70 };
71
72 //-----------------------------------------------------------------------------
73 // wxSpinEvent
74 //-----------------------------------------------------------------------------
75
76 class wxSpinEvent : public wxScrollEvent
77 {
78 DECLARE_DYNAMIC_CLASS(wxSpinEvent)
79
80 public:
81 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
82 };
83
84 typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
85
86 // Spin events
87
88 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
89 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
90
91 #define EVT_SPIN(id, func) \
92 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
93 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
94 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
95 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
96 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
97 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
98 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
99
100 #endif
101
102 #endif
103 // __GTKSPINBUTTH__