]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/spinctrl.h
no changes (0 -> NULL)
[wxWidgets.git] / include / wx / msw / spinctrl.h
CommitLineData
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
6fe19057 21#include "wx/dynarray.h"
d77254fc 22
6fe19057
VZ
23class WXDLLEXPORT wxSpinCtrl;
24WX_DEFINE_EXPORTED_ARRAY(wxSpinCtrl *, wxArraySpins);
25
b782f2e0
VZ
26// ----------------------------------------------------------------------------
27// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call
28// it) text window whose contents is automatically updated when the spin
29// control is clicked.
30// ----------------------------------------------------------------------------
31
32class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
33{
34public:
35 wxSpinCtrl() { }
36
37 wxSpinCtrl(wxWindow *parent,
38 wxWindowID id = -1,
678cd6de 39 const wxString& value = wxEmptyString,
b782f2e0
VZ
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxSP_ARROW_KEYS,
43 int min = 0, int max = 100, int initial = 0,
44 const wxString& name = _T("wxSpinCtrl"))
45 {
678cd6de 46 Create(parent, id, value, pos, size, style, min, max, initial, name);
b782f2e0
VZ
47 }
48
49 bool Create(wxWindow *parent,
50 wxWindowID id = -1,
678cd6de 51 const wxString& value = wxEmptyString,
b782f2e0
VZ
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxSP_ARROW_KEYS,
55 int min = 0, int max = 100, int initial = 0,
56 const wxString& name = _T("wxSpinCtrl"));
57
678cd6de
VZ
58 // a wxTextCtrl-like method (but we can't have GetValue returning wxString
59 // because the base class already has one returning int!)
60 void SetValue(const wxString& text);
61
882a8f40
VZ
62 // implementation only from now on
63 // -------------------------------
64
f6bcfd97
BP
65 virtual ~wxSpinCtrl();
66
678cd6de 67 virtual void SetValue(int val) { wxSpinButton::SetValue(val); }
b44d69ba 68 virtual int GetValue() const;
baccb514 69 virtual bool SetFont(const wxFont &font);
b44d69ba 70 virtual void SetFocus();
baccb514 71
882a8f40
VZ
72 virtual bool Enable(bool enable = TRUE);
73 virtual bool Show(bool show = TRUE);
74
f6bcfd97
BP
75 // wxSpinButton doesn't accept focus, but we do
76 virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); }
77
6fe19057
VZ
78 // for internal use only
79
80 // get the subclassed window proc of the buddy text
81 WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; }
82
83 // return the spinctrl object whose buddy is the given window or NULL
84 static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy);
85
86 // process a WM_COMMAND generated by the buddy text control
87 bool ProcessTextCommand(WXWORD cmd, WXWORD id);
8614c467 88
b782f2e0 89protected:
f6bcfd97 90 virtual void DoGetPosition(int *x, int *y) const;
baccb514 91 virtual void DoMoveWindow(int x, int y, int width, int height);
f68586e5 92 virtual wxSize DoGetBestSize() const;
f6bcfd97 93 virtual void DoGetSize(int *width, int *height) const;
b782f2e0 94
9750fc42
VZ
95 // the handler for wxSpinButton events
96 void OnSpinChange(wxSpinEvent& event);
97
e08d628d
JS
98 // Handle processing of special keys
99 void OnChar(wxKeyEvent& event);
100
f6bcfd97
BP
101 // the data for the "buddy" text ctrl
102 WXHWND m_hwndBuddy;
6fe19057
VZ
103 WXFARPROC m_wndProcBuddy;
104
105 // all existing wxSpinCtrls - this allows to find the one corresponding to
106 // the given buddy window in GetSpinForTextCtrl()
107 static wxArraySpins ms_allSpins;
b782f2e0 108
9750fc42 109private:
b782f2e0 110 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
9750fc42 111 DECLARE_EVENT_TABLE()
b782f2e0
VZ
112};
113
114#endif // _WX_MSW_SPINCTRL_H_
115
116