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