]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/spinbutt.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButton class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SPINBUTT_H_
13 #define _WX_SPINBUTT_H_
16 #pragma interface "spinbutt.h"
19 #include "wx/control.h"
22 #if defined(__WIN95__)
25 The wxSpinButton is like a small scrollbar than is often placed next
28 wxSP_HORIZONTAL: horizontal spin button
29 wxSP_VERTICAL: vertical spin button (the default)
30 wxSP_ARROW_KEYS: arrow keys increment/decrement value
31 wxSP_WRAP: value wraps at either end
34 class WXDLLEXPORT wxSpinButton
: public wxControl
36 DECLARE_DYNAMIC_CLASS(wxSpinButton
)
44 wxSpinButton(wxWindow
*parent
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
48 long style
= wxSP_VERTICAL
| wxSP_ARROW_KEYS
,
49 const wxString
& name
= "wxSpinButton")
51 Create(parent
, id
, pos
, size
, style
, name
);
54 virtual ~wxSpinButton();
56 bool Create(wxWindow
*parent
,
58 const wxPoint
& pos
= wxDefaultPosition
,
59 const wxSize
& size
= wxDefaultSize
,
60 long style
= wxSP_VERTICAL
| wxSP_ARROW_KEYS
,
61 const wxString
& name
= "wxSpinButton");
65 ////////////////////////////////////////////////////////////////////////////
67 int GetValue() const ;
68 void SetValue(int val
) ;
69 void SetRange(int minVal
, int maxVal
);
70 int GetMin() const { return m_min
; }
71 int GetMax() const { return m_max
; }
74 ////////////////////////////////////////////////////////////////////////////
77 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
78 virtual bool MSWOnScroll(int orientation
, WXWORD wParam
,
79 WXWORD pos
, WXHWND control
);
86 class WXDLLEXPORT wxSpinEvent
: public wxScrollEvent
88 DECLARE_DYNAMIC_CLASS(wxSpinEvent
)
91 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
94 typedef void (wxEvtHandler::*wxSpinEventFunction
)(wxSpinEvent
&);
98 #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
99 #define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
101 #define EVT_SPIN(id, func) \
102 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
103 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
104 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
105 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
106 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
107 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
108 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },