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