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"
17 #pragma implementation "spinbutbase.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
28 #include "wx/control.h"
31 // ----------------------------------------------------------------------------
32 // The wxSpinButton is like a small scrollbar than is often placed next
36 // wxSP_HORIZONTAL: horizontal spin button
37 // wxSP_VERTICAL: vertical spin button (the default)
38 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
39 // wxSP_WRAP: value wraps at either end
40 // ----------------------------------------------------------------------------
42 class WXDLLEXPORT wxSpinButtonBase
: public wxControl
45 wxSpinButtonBase() { InitBase(); }
48 virtual int GetValue() const = 0;
49 virtual int GetMin() const { return m_min
; }
50 virtual int GetMax() const { return m_max
; }
53 virtual void SetValue(int val
) = 0;
54 virtual void SetRange(int minVal
, int maxVal
)
61 // init the base part of the control
73 // ----------------------------------------------------------------------------
74 // include the declaration of the real class
75 // ----------------------------------------------------------------------------
77 #if defined(__WXMSW__)
78 #include "wx/msw/spinbutt.h"
79 #elif defined(__WXMOTIF__)
80 #include "wx/motif/spinbutt.h"
81 #elif defined(__WXGTK__)
82 #include "wx/gtk/spinbutt.h"
83 #elif defined(__WXQT__)
84 #include "wx/qt/spinbutt.h"
85 #elif defined(__WXMAC__)
86 #include "wx/mac/spinbutt.h"
87 #elif defined(__WXPM__)
88 #include "wx/os2/spinbutt.h"
89 #elif defined(__WXSTUBS__)
90 #include "wx/stubs/spinbutt.h"
93 // ----------------------------------------------------------------------------
94 // the wxSpinButton event
95 // ----------------------------------------------------------------------------
97 class WXDLLEXPORT wxSpinEvent
: public wxNotifyEvent
99 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
102 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0)
103 : wxNotifyEvent(commandType
, id
)
107 // get the current value of the control
108 int GetPosition() const { return m_commandInt
; }
109 void SetPosition(int pos
) { m_commandInt
= pos
; }
112 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
114 // macros for handling spin events
116 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
118 #ifndef EVT_SPIN_DOWN
119 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
122 #define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
125 #endif // wxUSE_SPINBTN
128 // _WX_SPINBUTT_H_BASE_