]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/spinctrl.h
send event from Clear() for a simple text control, send only one event from SetValue...
[wxWidgets.git] / include / wx / os2 / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/spinctrl.h
3 // Purpose: wxSpinCtrl class declaration for Win32
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/15/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_SPINCTRL_H_
13 #define _WX_MSW_SPINCTRL_H_
14
15 #include "wx/spinbutt.h" // the base class
16 #include "wx/dynarray.h"
17 class WXDLLEXPORT wxSpinCtrl;
18 WX_DEFINE_EXPORTED_ARRAY(wxSpinCtrl *, wxArraySpins);
19
20 // ----------------------------------------------------------------------------
21 // Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
22 // text window whose contents is automatically updated when the spin
23 // control is clicked.
24 // ----------------------------------------------------------------------------
25
26 class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
27 {
28 public:
29 wxSpinCtrl() { }
30 wxSpinCtrl( wxWindow* pParent
31 ,wxWindowID vId = -1
32 ,const wxString& rsValue = wxEmptyString
33 ,const wxPoint& rPos = wxDefaultPosition
34 ,const wxSize& rSize = wxDefaultSize
35 ,long lStyle = wxSP_ARROW_KEYS
36 ,int nMin = 0
37 ,int nMax = 100
38 ,int nInitial = 0
39 ,const wxString& rsName = _T("wxSpinCtrl")
40 )
41 {
42 Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
43 }
44 virtual ~wxSpinCtrl();
45
46 bool Create(wxWindow* pParent
47 ,wxWindowID vId = -1
48 ,const wxString& rsValue = wxEmptyString
49 ,const wxPoint& rPos = wxDefaultPosition
50 ,const wxSize& rSize = wxDefaultSize
51 ,long lStyle = wxSP_ARROW_KEYS
52 ,int nMin = 0
53 ,int nMax = 100
54 ,int nInitial = 0
55 ,const wxString& rsName = _T("wxSpinCtrl")
56 );
57
58 //
59 // A wxTextCtrl-like method (but we can't have GetValue returning wxString
60 // because the base class already has one returning int!)
61 //
62 void SetValue(const wxString& rsText);
63
64 //
65 // implementation only from now on
66 // -------------------------------
67 //
68 virtual bool Enable(bool bEnable = TRUE);
69
70 virtual int GetValue(void) const;
71
72 virtual bool SetFont(const wxFont &rFont);
73 virtual void SetFocus(void);
74 inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
75
76 virtual bool Show(bool bShow = TRUE);
77
78 //
79 // wxSpinButton doesn't accept focus, but we do
80 //
81 inline virtual bool AcceptsFocus(void) const { return FALSE; }
82
83 //
84 // Return the spinctrl object whose buddy is the given window or NULL
85 // Doesn't really do much under OS/2
86 //
87 static wxSpinCtrl* GetSpinForTextCtrl(WXHWND hWndBuddy);
88
89 //
90 // Process a WM_COMMAND generated by the buddy text control
91 //
92 bool ProcessTextCommand( WXWORD wCmd
93 ,WXWORD wId
94 );
95
96 protected:
97 virtual void DoGetPosition( int* nlX
98 ,int* nlY
99 ) const;
100 void DoMoveWindow( int nX
101 ,int nY
102 ,int nWidth
103 ,int nHeight
104 );
105 virtual wxSize DoGetBestSize(void) const;
106 virtual void DoGetSize( int* pnWidth
107 ,int* pnHeight
108 ) const;
109
110 //
111 // The handler for wxSpinButton events
112 //
113 void OnSpinChange(wxSpinEvent& rEvent);
114 void OnChar(wxKeyEvent& rEvent);
115
116 WXHWND m_hWndBuddy;
117 static wxArraySpins m_svAllSpins;
118
119 private:
120 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
121 DECLARE_EVENT_TABLE()
122 }; // end of CLASS wxSpinCtrl
123
124 #endif // _WX_MSW_SPINCTRL_H_
125
126