]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/spinctrl.h
more wxVector<T> tests
[wxWidgets.git] / include / wx / os2 / spinctrl.h
CommitLineData
409c9842
DW
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
65571936 9// Licence: wxWindows licence
409c9842
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MSW_SPINCTRL_H_
13#define _WX_MSW_SPINCTRL_H_
14
15#include "wx/spinbutt.h" // the base class
3c299c3a 16#include "wx/dynarray.h"
b5dbe15d 17class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
7e1e6965 18WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
409c9842
DW
19
20// ----------------------------------------------------------------------------
3e7fb41b 21// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
409c9842
DW
22// text window whose contents is automatically updated when the spin
23// control is clicked.
24// ----------------------------------------------------------------------------
25
26class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
27{
28public:
29 wxSpinCtrl() { }
3c299c3a 30 wxSpinCtrl( wxWindow* pParent
7e1e6965 31 ,wxWindowID vId = wxID_ANY
3c299c3a
DW
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 )
409c9842 41 {
3c299c3a 42 Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
409c9842 43 }
3c299c3a
DW
44 virtual ~wxSpinCtrl();
45
46 bool Create(wxWindow* pParent
7e1e6965 47 ,wxWindowID vId = wxID_ANY
3c299c3a
DW
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
a5569657 60 // because the base class already has one returning int!)
3c299c3a
DW
61 //
62 void SetValue(const wxString& rsText);
a5569657 63
3c299c3a 64 //
a5569657
DW
65 // implementation only from now on
66 // -------------------------------
3c299c3a 67 //
7e1e6965 68 virtual bool Enable(bool bEnable = true);
a5569657 69
7e1e6965
WS
70 virtual int GetValue(void) const;
71
72 virtual bool SetFont(const wxFont &rFont);
73 virtual void SetFocus(void);
a5569657 74
3c299c3a 75 inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
409c9842 76
7e1e6965
WS
77 void SetSelection(long lFrom, long lTo);
78
79 virtual bool Show(bool bShow = true);
a5569657 80
3c299c3a
DW
81 //
82 // wxSpinButton doesn't accept focus, but we do
83 //
7e1e6965 84 inline virtual bool AcceptsFocus(void) const { return false; }
a5569657 85
3c299c3a
DW
86 //
87 // Return the spinctrl object whose buddy is the given window or NULL
88 // Doesn't really do much under OS/2
89 //
90 static wxSpinCtrl* GetSpinForTextCtrl(WXHWND hWndBuddy);
91
92 //
93 // Process a WM_COMMAND generated by the buddy text control
94 //
95 bool ProcessTextCommand( WXWORD wCmd
96 ,WXWORD wId
97 );
98
99protected:
100 virtual void DoGetPosition( int* nlX
101 ,int* nlY
102 ) const;
103 void DoMoveWindow( int nX
104 ,int nY
105 ,int nWidth
106 ,int nHeight
107 );
108 virtual wxSize DoGetBestSize(void) const;
109 virtual void DoGetSize( int* pnWidth
110 ,int* pnHeight
111 ) const;
112
113 //
114 // The handler for wxSpinButton events
115 //
116 void OnSpinChange(wxSpinEvent& rEvent);
117 void OnChar(wxKeyEvent& rEvent);
6e348b12 118 void OnSetFocus(wxFocusEvent& rEvent);
3c299c3a
DW
119
120 WXHWND m_hWndBuddy;
121 static wxArraySpins m_svAllSpins;
409c9842 122
a5569657 123private:
409c9842 124 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
a5569657 125 DECLARE_EVENT_TABLE()
3c299c3a 126}; // end of CLASS wxSpinCtrl
409c9842
DW
127
128#endif // _WX_MSW_SPINCTRL_H_