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