]>
Commit | Line | Data |
---|---|---|
f6bcfd97 | 1 | //////////////////////////////////////////////////////////////////////////// |
b782f2e0 VZ |
2 | // Name: msw/spinctrl.h |
3 | // Purpose: wxSpinCtrl class declaration for Win32 | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 22.07.99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_MSW_SPINCTRL_H_ | |
13 | #define _WX_MSW_SPINCTRL_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "spinctrl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/spinbutt.h" // the base class | |
20 | ||
21 | // ---------------------------------------------------------------------------- | |
22 | // Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call | |
23 | // it) text window whose contents is automatically updated when the spin | |
24 | // control is clicked. | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class WXDLLEXPORT wxSpinCtrl : public wxSpinButton | |
28 | { | |
29 | public: | |
30 | wxSpinCtrl() { } | |
31 | ||
32 | wxSpinCtrl(wxWindow *parent, | |
33 | wxWindowID id = -1, | |
678cd6de | 34 | const wxString& value = wxEmptyString, |
b782f2e0 VZ |
35 | const wxPoint& pos = wxDefaultPosition, |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxSP_ARROW_KEYS, | |
38 | int min = 0, int max = 100, int initial = 0, | |
39 | const wxString& name = _T("wxSpinCtrl")) | |
40 | { | |
678cd6de | 41 | Create(parent, id, value, pos, size, style, min, max, initial, name); |
b782f2e0 VZ |
42 | } |
43 | ||
44 | bool Create(wxWindow *parent, | |
45 | wxWindowID id = -1, | |
678cd6de | 46 | const wxString& value = wxEmptyString, |
b782f2e0 VZ |
47 | const wxPoint& pos = wxDefaultPosition, |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = wxSP_ARROW_KEYS, | |
50 | int min = 0, int max = 100, int initial = 0, | |
51 | const wxString& name = _T("wxSpinCtrl")); | |
52 | ||
678cd6de VZ |
53 | // a wxTextCtrl-like method (but we can't have GetValue returning wxString |
54 | // because the base class already has one returning int!) | |
55 | void SetValue(const wxString& text); | |
56 | ||
882a8f40 VZ |
57 | // implementation only from now on |
58 | // ------------------------------- | |
59 | ||
f6bcfd97 BP |
60 | virtual ~wxSpinCtrl(); |
61 | ||
678cd6de | 62 | virtual void SetValue(int val) { wxSpinButton::SetValue(val); } |
b44d69ba | 63 | virtual int GetValue() const; |
baccb514 | 64 | virtual bool SetFont(const wxFont &font); |
b44d69ba | 65 | virtual void SetFocus(); |
baccb514 | 66 | |
882a8f40 VZ |
67 | virtual bool Enable(bool enable = TRUE); |
68 | virtual bool Show(bool show = TRUE); | |
69 | ||
f6bcfd97 BP |
70 | // wxSpinButton doesn't accept focus, but we do |
71 | virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } | |
72 | ||
73 | WXFARPROC GetBuddyWndProc() const { return m_oldBuddyWndProc; } | |
8614c467 | 74 | |
b782f2e0 | 75 | protected: |
f6bcfd97 | 76 | virtual void DoGetPosition(int *x, int *y) const; |
baccb514 | 77 | virtual void DoMoveWindow(int x, int y, int width, int height); |
f68586e5 | 78 | virtual wxSize DoGetBestSize() const; |
f6bcfd97 | 79 | virtual void DoGetSize(int *width, int *height) const; |
b782f2e0 | 80 | |
9750fc42 VZ |
81 | // the handler for wxSpinButton events |
82 | void OnSpinChange(wxSpinEvent& event); | |
83 | ||
f6bcfd97 BP |
84 | // the data for the "buddy" text ctrl |
85 | WXHWND m_hwndBuddy; | |
86 | WXFARPROC m_oldBuddyWndProc; | |
b782f2e0 | 87 | |
9750fc42 | 88 | private: |
b782f2e0 | 89 | DECLARE_DYNAMIC_CLASS(wxSpinCtrl) |
9750fc42 | 90 | DECLARE_EVENT_TABLE() |
b782f2e0 VZ |
91 | }; |
92 | ||
93 | #endif // _WX_MSW_SPINCTRL_H_ | |
94 | ||
95 |