]> git.saurik.com Git - wxWidgets.git/blame - include/wx/spinbutt.h
removed mark #pragmas
[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
9// Licence: wxWindows licence
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:
42 wxSpinButtonBase() { InitBase(); }
43
44 // accessors
45 virtual int GetValue() const = 0;
46 virtual int GetMin() const { return m_min; }
47 virtual int GetMax() const { return m_max; }
48
49 // operations
50 virtual void SetValue(int val) = 0;
fae7d158
SC
51 virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
52 virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
31528cd3
VZ
53 virtual void SetRange(int minVal, int maxVal)
54 {
55 m_min = minVal;
56 m_max = maxVal;
57 }
58
1e6feb95
VZ
59 // is this spin button vertically oriented?
60 bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
61
31528cd3
VZ
62protected:
63 // init the base part of the control
64 void InitBase()
65 {
66 m_min = 0;
67 m_max = 100;
68 }
69
70 // the range value
71 int m_min;
72 int m_max;
fc7a2a60
VZ
73
74 DECLARE_NO_COPY_CLASS(wxSpinButtonBase)
31528cd3
VZ
75};
76
77// ----------------------------------------------------------------------------
78// include the declaration of the real class
79// ----------------------------------------------------------------------------
80
1e6feb95
VZ
81#if defined(__WXUNIVERSAL__)
82 #include "wx/univ/spinbutt.h"
0510b4bb 83#elif defined(__WXMSW__) && defined(__WIN95__)
31528cd3 84 #include "wx/msw/spinbutt.h"
2049ba38 85#elif defined(__WXMOTIF__)
31528cd3 86 #include "wx/motif/spinbutt.h"
2049ba38 87#elif defined(__WXGTK__)
31528cd3 88 #include "wx/gtk/spinbutt.h"
34138703 89#elif defined(__WXMAC__)
31528cd3 90 #include "wx/mac/spinbutt.h"
768d9ec8
DE
91#elif defined(__WXCOCOA__)
92 #include "wx/cocoa/spinbutt.h"
1777b9bb
DW
93#elif defined(__WXPM__)
94 #include "wx/os2/spinbutt.h"
c801d85f
KB
95#endif
96
31528cd3
VZ
97// ----------------------------------------------------------------------------
98// the wxSpinButton event
99// ----------------------------------------------------------------------------
100
0655ad29 101class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent
31528cd3 102{
31528cd3 103public:
f07c5701
DE
104 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
105 : wxNotifyEvent(commandType, winid)
31528cd3
VZ
106 {
107 }
0655ad29
VZ
108
109 // get the current value of the control
110 int GetPosition() const { return m_commandInt; }
111 void SetPosition(int pos) { m_commandInt = pos; }
1e6feb95
VZ
112
113private:
fc7a2a60 114 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinEvent)
31528cd3
VZ
115};
116
117typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
118
119// macros for handling spin events
f07c5701
DE
120#define EVT_SPIN_UP(winid, func) \
121 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEUP, winid, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
122#define EVT_SPIN_DOWN(winid, func) \
123 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEDOWN, winid, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
124#define EVT_SPIN(winid, func) \
125 DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, winid, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
31528cd3
VZ
126
127#endif // wxUSE_SPINBTN
128
c801d85f 129#endif
34138703 130 // _WX_SPINBUTT_H_BASE_