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 #ifndef __WXMOTIF__ // because there is no matching .cpp for Motif
17 #pragma interface "spinbutbase.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
29 #include "wx/control.h"
32 // ----------------------------------------------------------------------------
33 // The wxSpinButton is like a small scrollbar than is often placed next
37 // wxSP_HORIZONTAL: horizontal spin button
38 // wxSP_VERTICAL: vertical spin button (the default)
39 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
40 // wxSP_WRAP: value wraps at either end
41 // ----------------------------------------------------------------------------
43 class WXDLLEXPORT wxSpinButtonBase
: public wxControl
46 wxSpinButtonBase() { InitBase(); }
49 virtual int GetValue() const = 0;
50 virtual int GetMin() const { return m_min
; }
51 virtual int GetMax() const { return m_max
; }
54 virtual void SetValue(int val
) = 0;
55 virtual void SetRange(int minVal
, int maxVal
)
62 // init the base part of the control
74 // ----------------------------------------------------------------------------
75 // include the declaration of the real class
76 // ----------------------------------------------------------------------------
78 #if defined(__WXMSW__)
79 #include "wx/msw/spinbutt.h"
80 #elif defined(__WXMOTIF__)
81 #include "wx/motif/spinbutt.h"
82 #elif defined(__WXGTK__)
83 #include "wx/gtk/spinbutt.h"
84 #elif defined(__WXQT__)
85 #include "wx/qt/spinbutt.h"
86 #elif defined(__WXMAC__)
87 #include "wx/mac/spinbutt.h"
88 #elif defined(__WXPM__)
89 #include "wx/os2/spinbutt.h"
90 #elif defined(__WXSTUBS__)
91 #include "wx/stubs/spinbutt.h"
94 // ----------------------------------------------------------------------------
95 // the wxSpinButton event
96 // ----------------------------------------------------------------------------
98 class WXDLLEXPORT wxSpinEvent
: public wxNotifyEvent
100 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
103 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
104 : wxNotifyEvent(commandType
, id
)
108 // get the current value of the control
109 int GetPosition() const { return m_commandInt
; }
110 void SetPosition(int pos
) { m_commandInt
= pos
; }
113 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
115 // macros for handling spin events
117 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
119 #ifndef EVT_SPIN_DOWN
120 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
123 #define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
126 #endif // wxUSE_SPINBTN
129 // _WX_SPINBUTT_H_BASE_