]> git.saurik.com Git - wxWidgets.git/blame - include/wx/spinbutt.h
1. wxFontMapper starts to materialise
[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
d422d01e
RR
15#ifdef __GNUG__
16#pragma interface "spinbutbase.h"
17#pragma implementation "spinbutbase.h"
18#endif
19
31528cd3
VZ
20// ----------------------------------------------------------------------------
21// headers
22// ----------------------------------------------------------------------------
23
24#include "wx/defs.h"
25
26#ifdef wxUSE_SPINBTN
27
28#include "wx/control.h"
29#include "wx/event.h"
30
31// ----------------------------------------------------------------------------
32// The wxSpinButton is like a small scrollbar than is often placed next
33// to a text control.
34//
35// Styles:
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// ----------------------------------------------------------------------------
41
42class WXDLLEXPORT wxSpinButtonBase : public wxControl
43{
44public:
45 wxSpinButtonBase() { InitBase(); }
46
47 // accessors
48 virtual int GetValue() const = 0;
49 virtual int GetMin() const { return m_min; }
50 virtual int GetMax() const { return m_max; }
51
52 // operations
53 virtual void SetValue(int val) = 0;
54 virtual void SetRange(int minVal, int maxVal)
55 {
56 m_min = minVal;
57 m_max = maxVal;
58 }
59
60protected:
61 // init the base part of the control
62 void InitBase()
63 {
64 m_min = 0;
65 m_max = 100;
66 }
67
68 // the range value
69 int m_min;
70 int m_max;
71};
72
73// ----------------------------------------------------------------------------
74// include the declaration of the real class
75// ----------------------------------------------------------------------------
76
2049ba38 77#if defined(__WXMSW__)
31528cd3 78 #include "wx/msw/spinbutt.h"
2049ba38 79#elif defined(__WXMOTIF__)
31528cd3 80 #include "wx/motif/spinbutt.h"
2049ba38 81#elif defined(__WXGTK__)
31528cd3 82 #include "wx/gtk/spinbutt.h"
b4e76e0d 83#elif defined(__WXQT__)
31528cd3 84 #include "wx/qt/spinbutt.h"
34138703 85#elif defined(__WXMAC__)
31528cd3 86 #include "wx/mac/spinbutt.h"
1777b9bb
DW
87#elif defined(__WXPM__)
88 #include "wx/os2/spinbutt.h"
34138703 89#elif defined(__WXSTUBS__)
31528cd3 90 #include "wx/stubs/spinbutt.h"
c801d85f
KB
91#endif
92
31528cd3
VZ
93// ----------------------------------------------------------------------------
94// the wxSpinButton event
95// ----------------------------------------------------------------------------
96
0655ad29 97class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent
31528cd3
VZ
98{
99 DECLARE_DYNAMIC_CLASS(wxSpinEvent)
100
101public:
102 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
0655ad29 103 : wxNotifyEvent(commandType, id)
31528cd3
VZ
104 {
105 }
0655ad29
VZ
106
107 // get the current value of the control
108 int GetPosition() const { return m_commandInt; }
109 void SetPosition(int pos) { m_commandInt = pos; }
31528cd3
VZ
110};
111
112typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
113
114// macros for handling spin events
717b9bf2 115#ifndef EVT_SPIN_UP
0655ad29 116#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
717b9bf2
DW
117#endif
118#ifndef EVT_SPIN_DOWN
0655ad29 119#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
717b9bf2
DW
120#endif
121#ifndef EVT_SPIN
0655ad29 122#define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
717b9bf2 123#endif
31528cd3
VZ
124
125#endif // wxUSE_SPINBTN
126
c801d85f 127#endif
34138703 128 // _WX_SPINBUTT_H_BASE_