]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/spinbutt.h
wxClipboard now serves the primary selection as well
[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
34class WXDLLEXPORT wxSpinButton: public wxControl
35{
36 DECLARE_DYNAMIC_CLASS(wxSpinButton)
37 public:
38 /*
39 * Public interface
40 */
41
42 wxSpinButton(void);
43
debe6624
JS
44 inline wxSpinButton(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
45 long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
2bda0e17
KB
46 {
47 Create(parent, id, pos, size, style, name);
48 }
49 ~wxSpinButton(void);
50
debe6624
JS
51 bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
52 long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton");
2bda0e17
KB
53
54
55 // Attributes
56 ////////////////////////////////////////////////////////////////////////////
57
58 int GetValue(void) const ;
debe6624
JS
59 void SetValue(int val) ;
60 void SetRange(int minVal, int maxVal) ;
2bda0e17
KB
61 inline int GetMin(void) const { return m_min; }
62 inline int GetMax(void) const { return m_max; }
63
64 // Operations
65 ////////////////////////////////////////////////////////////////////////////
66
67 void Command(wxCommandEvent& event) { ProcessCommand(event); };
68
69 // IMPLEMENTATION
fd3f686c
VZ
70 virtual bool MSWCommand(WXUINT param, WXWORD id);
71 virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
72 virtual void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
73 virtual void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
2bda0e17
KB
74
75protected:
76 int m_min;
77 int m_max;
78};
79
80class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
81{
82 DECLARE_DYNAMIC_CLASS(wxSpinEvent)
83
84 public:
64693098 85 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
2bda0e17
KB
86};
87
88typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
89
90// Spin events
91
92#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
93#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
94
95#define EVT_SPIN(id, func) \
96 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
97 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
98 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
99 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
100 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
101 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
102 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
103
104#endif
bbcdf8bc 105 // _WX_WIN95__
2bda0e17 106#endif
bbcdf8bc 107 // _WX_SPINBUTT_H_