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_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
23 #include "wx/control.h"
26 // ----------------------------------------------------------------------------
27 // The wxSpinButton is like a small scrollbar than is often placed next
31 // wxSP_HORIZONTAL: horizontal spin button
32 // wxSP_VERTICAL: vertical spin button (the default)
33 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
34 // wxSP_WRAP: value wraps at either end
35 // ----------------------------------------------------------------------------
37 class WXDLLEXPORT wxSpinButtonBase
: public wxControl
40 wxSpinButtonBase() { InitBase(); }
43 virtual int GetValue() const = 0;
44 virtual int GetMin() const { return m_min
; }
45 virtual int GetMax() const { return m_max
; }
48 virtual void SetValue(int val
) = 0;
49 virtual void SetRange(int minVal
, int maxVal
)
56 // init the base part of the control
68 // ----------------------------------------------------------------------------
69 // include the declaration of the real class
70 // ----------------------------------------------------------------------------
72 #if defined(__WXMSW__)
73 #include "wx/msw/spinbutt.h"
74 #elif defined(__WXMOTIF__)
75 #include "wx/motif/spinbutt.h"
76 #elif defined(__WXGTK__)
77 #include "wx/gtk/spinbutt.h"
78 #elif defined(__WXQT__)
79 #include "wx/qt/spinbutt.h"
80 #elif defined(__WXMAC__)
81 #include "wx/mac/spinbutt.h"
82 #elif defined(__WXSTUBS__)
83 #include "wx/stubs/spinbutt.h"
86 // ----------------------------------------------------------------------------
87 // the wxSpinButton event
88 // ----------------------------------------------------------------------------
90 class WXDLLEXPORT wxSpinEvent
: public wxScrollEvent
92 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
95 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
96 : wxScrollEvent(commandType
, id
)
101 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
103 // macros for handling spin events
104 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
105 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
107 #define EVT_SPIN(id, func) \
108 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
109 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
110 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
111 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
112 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
113 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
114 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
116 #endif // wxUSE_SPINBTN
119 // _WX_SPINBUTT_H_BASE_