]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/spinbutt.h
wxWindow::Show() works again
[wxWidgets.git] / include / wx / msw / spinbutt.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: spinbutt.h
3// Purpose: wxSpinButton class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_SPINBUTT_H_
13#define _WX_SPINBUTT_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "spinbutt.h"
17#endif
18
19#include "wx/control.h"
20#include "wx/event.h"
21
22#if defined(__WIN95__)
23
24/*
25 The wxSpinButton is like a small scrollbar than is often placed next
26 to a text control.
27
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
32 */
33
aeafc354 34class WXDLLEXPORT wxSpinButton : public wxControl
2bda0e17 35{
aeafc354
VZ
36DECLARE_DYNAMIC_CLASS(wxSpinButton)
37
38public:
39 /*
40 * Public interface
41 */
42 wxSpinButton();
a23fd0e1 43
aeafc354
VZ
44 wxSpinButton(wxWindow *parent,
45 wxWindowID id = -1,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
49 const wxString& name = "wxSpinButton")
50 {
51 Create(parent, id, pos, size, style, name);
52 }
a23fd0e1 53
aeafc354 54 virtual ~wxSpinButton();
a23fd0e1 55
aeafc354
VZ
56 bool Create(wxWindow *parent,
57 wxWindowID id = -1,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
a23fd0e1 60 long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
aeafc354 61 const wxString& name = "wxSpinButton");
a23fd0e1
VZ
62
63
aeafc354
VZ
64 // Attributes
65 ////////////////////////////////////////////////////////////////////////////
a23fd0e1 66
aeafc354
VZ
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; }
a23fd0e1 72
aeafc354
VZ
73 // Operations
74 ////////////////////////////////////////////////////////////////////////////
a23fd0e1 75
aeafc354 76 void Command(wxCommandEvent& event) { ProcessCommand(event); };
a23fd0e1 77
aeafc354
VZ
78 // IMPLEMENTATION
79 virtual bool MSWCommand(WXUINT param, WXWORD id);
a23fd0e1
VZ
80 virtual bool MSWOnScroll(int orientation, WXWORD wParam,
81 WXWORD pos, WXHWND control);
82
2bda0e17 83protected:
aeafc354
VZ
84 int m_min;
85 int m_max;
2bda0e17
KB
86};
87
88class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
89{
aeafc354 90 DECLARE_DYNAMIC_CLASS(wxSpinEvent)
a23fd0e1 91
aeafc354
VZ
92public:
93 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
2bda0e17
KB
94};
95
96typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
97
98// Spin events
99
100#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
101#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
102
103#define EVT_SPIN(id, func) \
104 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
105 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
106 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
107 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
108 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
109 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
110 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
111
112#endif
bbcdf8bc 113 // _WX_WIN95__
2bda0e17 114#endif
bbcdf8bc 115 // _WX_SPINBUTT_H_