1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButtonBase class
4 // Author: Julian Smart, Vadim Zeitlin
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SPINBUTT_H_BASE_
13 #define _WX_SPINBUTT_H_BASE_
16 #pragma interface "spinbutbase.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
27 #include "wx/control.h"
30 // ----------------------------------------------------------------------------
31 // The wxSpinButton is like a small scrollbar than is often placed next
35 // wxSP_HORIZONTAL: horizontal spin button
36 // wxSP_VERTICAL: vertical spin button (the default)
37 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
38 // wxSP_WRAP: value wraps at either end
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxSpinButtonBase
: public wxControl
44 wxSpinButtonBase() { InitBase(); }
47 virtual int GetValue() const = 0;
48 virtual int GetMin() const { return m_min
; }
49 virtual int GetMax() const { return m_max
; }
52 virtual void SetValue(int val
) = 0;
53 virtual void SetRange(int minVal
, int maxVal
)
60 // init the base part of the control
72 // ----------------------------------------------------------------------------
73 // include the declaration of the real class
74 // ----------------------------------------------------------------------------
76 #if defined(__WXMSW__)
77 #include "wx/msw/spinbutt.h"
78 #elif defined(__WXMOTIF__)
79 #include "wx/motif/spinbutt.h"
80 #elif defined(__WXGTK__)
81 #include "wx/gtk/spinbutt.h"
82 #elif defined(__WXQT__)
83 #include "wx/qt/spinbutt.h"
84 #elif defined(__WXMAC__)
85 #include "wx/mac/spinbutt.h"
86 #elif defined(__WXPM__)
87 #include "wx/os2/spinbutt.h"
88 #elif defined(__WXSTUBS__)
89 #include "wx/stubs/spinbutt.h"
92 // ----------------------------------------------------------------------------
93 // the wxSpinButton event
94 // ----------------------------------------------------------------------------
96 class WXDLLEXPORT wxSpinEvent
: public wxNotifyEvent
98 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
101 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
102 : wxNotifyEvent(commandType
, id
)
106 // get the current value of the control
107 int GetPosition() const { return m_commandInt
; }
108 void SetPosition(int pos
) { m_commandInt
= pos
; }
111 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
113 // macros for handling spin events
115 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
117 #ifndef EVT_SPIN_DOWN
118 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
121 #define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
124 #endif // wxUSE_SPINBTN
127 // _WX_SPINBUTT_H_BASE_