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 #if !defined(__WXMOTIF__) && !defined(__WXMAC__) // because there is no matching .cpp
17 #pragma interface "spinbutt.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
29 #include "wx/control.h"
32 #define wxSPIN_BUTTON_NAME _T("wxSpinButton")
34 // ----------------------------------------------------------------------------
35 // The wxSpinButton is like a small scrollbar than is often placed next
39 // wxSP_HORIZONTAL: horizontal spin button
40 // wxSP_VERTICAL: vertical spin button (the default)
41 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
42 // wxSP_WRAP: value wraps at either end
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxSpinButtonBase
: public wxControl
48 wxSpinButtonBase() { InitBase(); }
51 virtual int GetValue() const = 0;
52 virtual int GetMin() const { return m_min
; }
53 virtual int GetMax() const { return m_max
; }
56 virtual void SetValue(int val
) = 0;
57 virtual void SetRange(int minVal
, int maxVal
)
63 // is this spin button vertically oriented?
64 bool IsVertical() const { return (m_windowStyle
& wxSP_VERTICAL
) != 0; }
67 // init the base part of the control
79 // ----------------------------------------------------------------------------
80 // include the declaration of the real class
81 // ----------------------------------------------------------------------------
83 #if defined(__WXUNIVERSAL__)
84 #include "wx/univ/spinbutt.h"
85 #elif defined(__WXMSW__)
86 #include "wx/msw/spinbutt.h"
87 #elif defined(__WXMOTIF__)
88 #include "wx/motif/spinbutt.h"
89 #elif defined(__WXGTK__)
90 #include "wx/gtk/spinbutt.h"
91 #elif defined(__WXQT__)
92 #include "wx/qt/spinbutt.h"
93 #elif defined(__WXMAC__)
94 #include "wx/mac/spinbutt.h"
95 #elif defined(__WXPM__)
96 #include "wx/os2/spinbutt.h"
97 #elif defined(__WXSTUBS__)
98 #include "wx/stubs/spinbutt.h"
101 // ----------------------------------------------------------------------------
102 // the wxSpinButton event
103 // ----------------------------------------------------------------------------
105 class WXDLLEXPORT wxSpinEvent
: public wxNotifyEvent
108 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
109 : wxNotifyEvent(commandType
, id
)
113 // get the current value of the control
114 int GetPosition() const { return m_commandInt
; }
115 void SetPosition(int pos
) { m_commandInt
= pos
; }
118 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
121 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
123 // macros for handling spin events
124 #define EVT_SPIN_UP(id, func) \
125 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
126 #define EVT_SPIN_DOWN(id, func) \
127 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
128 #define EVT_SPIN(id, func) \
129 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
131 #endif // wxUSE_SPINBTN
134 // _WX_SPINBUTT_H_BASE_