1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/spinctrl.h
3 // Purpose: wxSpinCtrl class declaration for Win32
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_SPINCTRL_H_
12 #define _WX_MSW_SPINCTRL_H_
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
);
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 // ----------------------------------------------------------------------------
25 class WXDLLIMPEXP_CORE wxSpinCtrl
: public wxSpinButton
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
38 ,const wxString
& rsName
= wxT("wxSpinCtrl")
41 Create(pParent
, vId
, rsValue
, rPos
, rSize
, lStyle
, nMin
, nMax
, nInitial
, rsName
);
43 virtual ~wxSpinCtrl();
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
54 ,const wxString
& rsName
= wxT("wxSpinCtrl")
58 // A wxTextCtrl-like method (but we can't have GetValue returning wxString
59 // because the base class already has one returning int!)
61 void SetValue(const wxString
& rsText
);
64 // implementation only from now on
65 // -------------------------------
67 virtual bool Enable(bool bEnable
= true);
69 virtual int GetValue(void) const;
71 virtual bool SetFont(const wxFont
&rFont
);
72 virtual void SetFocus(void);
74 inline virtual void SetValue(int nVal
) { wxSpinButton::SetValue(nVal
); }
76 void SetSelection(long lFrom
, long lTo
);
78 virtual bool Show(bool bShow
= true);
81 // wxSpinButton doesn't accept focus, but we do
83 inline virtual bool AcceptsFocus(void) const { return false; }
86 // Return the spinctrl object whose buddy is the given window or NULL
87 // Doesn't really do much under OS/2
89 static wxSpinCtrl
* GetSpinForTextCtrl(WXHWND hWndBuddy
);
92 // Process a WM_COMMAND generated by the buddy text control
94 bool ProcessTextCommand( WXWORD wCmd
99 virtual void DoGetPosition( int* nlX
102 void DoMoveWindow( int nX
107 virtual wxSize
DoGetBestSize(void) const;
108 virtual void DoGetSize( int* pnWidth
113 // The handler for wxSpinButton events
115 void OnSpinChange(wxSpinEvent
& rEvent
);
116 void OnChar(wxKeyEvent
& rEvent
);
117 void OnSetFocus(wxFocusEvent
& rEvent
);
120 static wxArraySpins m_svAllSpins
;
123 DECLARE_DYNAMIC_CLASS(wxSpinCtrl
)
124 DECLARE_EVENT_TABLE()
125 }; // end of CLASS wxSpinCtrl
127 #endif // _WX_MSW_SPINCTRL_H_