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