]> git.saurik.com Git - wxWidgets.git/blame - include/wx/spinbutt.h
Added wxDataViewBitmapCell
[wxWidgets.git] / include / wx / spinbutt.h
CommitLineData
31528cd3
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/spinbutt.h
3// Purpose: wxSpinButtonBase class
4// Author: Julian Smart, Vadim Zeitlin
5// Modified by:
6// Created: 23.07.99
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
31528cd3
VZ
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_SPINBUTT_H_BASE_
13#define _WX_SPINBUTT_H_BASE_
c801d85f 14
31528cd3
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19#include "wx/defs.h"
20
2fa7c206 21#if wxUSE_SPINBTN
31528cd3
VZ
22
23#include "wx/control.h"
24#include "wx/event.h"
25
1e6feb95
VZ
26#define wxSPIN_BUTTON_NAME _T("wxSpinButton")
27
31528cd3
VZ
28// ----------------------------------------------------------------------------
29// The wxSpinButton is like a small scrollbar than is often placed next
30// to a text control.
31//
32// Styles:
33// wxSP_HORIZONTAL: horizontal spin button
34// wxSP_VERTICAL: vertical spin button (the default)
35// wxSP_ARROW_KEYS: arrow keys increment/decrement value
36// wxSP_WRAP: value wraps at either end
37// ----------------------------------------------------------------------------
38
39class WXDLLEXPORT wxSpinButtonBase : public wxControl
40{
41public:
3103e8a9 42 // ctor initializes the range with the default (0..100) values
72795335 43 wxSpinButtonBase() { m_min = 0; m_max = 100; }
31528cd3
VZ
44
45 // accessors
46 virtual int GetValue() const = 0;
47 virtual int GetMin() const { return m_min; }
48 virtual int GetMax() const { return m_max; }
49
50 // operations
51 virtual void SetValue(int val) = 0;
fae7d158
SC
52 virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
53 virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
31528cd3
VZ
54 virtual void SetRange(int minVal, int maxVal)
55 {
56 m_min = minVal;
57 m_max = maxVal;
58 }
59
1e6feb95
VZ
60 // is this spin button vertically oriented?
61 bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
62
31528cd3 63protected:
31528cd3
VZ
64 // the range value
65 int m_min;
66 int m_max;
fc7a2a60
VZ
67
68 DECLARE_NO_COPY_CLASS(wxSpinButtonBase)
31528cd3
VZ
69};
70
71// ----------------------------------------------------------------------------
72// include the declaration of the real class
73// ----------------------------------------------------------------------------
74
1e6feb95
VZ
75#if defined(__WXUNIVERSAL__)
76 #include "wx/univ/spinbutt.h"
1ed64378 77#elif defined(__WXMSW__)
31528cd3 78 #include "wx/msw/spinbutt.h"
2049ba38 79#elif defined(__WXMOTIF__)
31528cd3 80 #include "wx/motif/spinbutt.h"
1be7a35c 81#elif defined(__WXGTK20__)
31528cd3 82 #include "wx/gtk/spinbutt.h"
1be7a35c
MR
83#elif defined(__WXGTK__)
84 #include "wx/gtk1/spinbutt.h"
34138703 85#elif defined(__WXMAC__)
31528cd3 86 #include "wx/mac/spinbutt.h"
768d9ec8
DE
87#elif defined(__WXCOCOA__)
88 #include "wx/cocoa/spinbutt.h"
1777b9bb
DW
89#elif defined(__WXPM__)
90 #include "wx/os2/spinbutt.h"
c801d85f
KB
91#endif
92
31528cd3
VZ
93// ----------------------------------------------------------------------------
94// the wxSpinButton event
95// ----------------------------------------------------------------------------
96
0655ad29 97class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent
31528cd3 98{
31528cd3 99public:
f07c5701
DE
100 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
101 : wxNotifyEvent(commandType, winid)
31528cd3
VZ
102 {
103 }
0655ad29
VZ
104
105 // get the current value of the control
106 int GetPosition() const { return m_commandInt; }
107 void SetPosition(int pos) { m_commandInt = pos; }
1e6feb95
VZ
108
109private:
fc7a2a60 110 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent)
31528cd3
VZ
111};
112
113typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
114
7fa03f04 115#define wxSpinEventHandler(func) \
8bc3ec1f 116 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSpinEventFunction, &func)
7fa03f04 117
31528cd3 118// macros for handling spin events
f07c5701 119#define EVT_SPIN_UP(winid, func) \
7fa03f04 120 wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxSpinEventHandler(func))
f07c5701 121#define EVT_SPIN_DOWN(winid, func) \
7fa03f04 122 wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxSpinEventHandler(func))
f07c5701 123#define EVT_SPIN(winid, func) \
7fa03f04 124 wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxSpinEventHandler(func))
31528cd3
VZ
125
126#endif // wxUSE_SPINBTN
127
c801d85f 128#endif
34138703 129 // _WX_SPINBUTT_H_BASE_