]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/spinctrl.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / os2 / spinctrl.h
CommitLineData
409c9842 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/os2/spinctrl.h
409c9842
DW
3// Purpose: wxSpinCtrl class declaration for Win32
4// Author: David Webster
5// Modified by:
6// Created: 10/15/99
409c9842 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
409c9842
DW
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_MSW_SPINCTRL_H_
12#define _WX_MSW_SPINCTRL_H_
13
14#include "wx/spinbutt.h" // the base class
3c299c3a 15#include "wx/dynarray.h"
b5dbe15d 16class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
7e1e6965 17WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
409c9842
DW
18
19// ----------------------------------------------------------------------------
3e7fb41b 20// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
409c9842
DW
21// text window whose contents is automatically updated when the spin
22// control is clicked.
23// ----------------------------------------------------------------------------
24
53a2db12 25class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton
409c9842
DW
26{
27public:
28 wxSpinCtrl() { }
3c299c3a 29 wxSpinCtrl( wxWindow* pParent
7e1e6965 30 ,wxWindowID vId = wxID_ANY
3c299c3a
DW
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
9a83f860 38 ,const wxString& rsName = wxT("wxSpinCtrl")
3c299c3a 39 )
409c9842 40 {
3c299c3a 41 Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
409c9842 42 }
3c299c3a
DW
43 virtual ~wxSpinCtrl();
44
45 bool Create(wxWindow* pParent
7e1e6965 46 ,wxWindowID vId = wxID_ANY
3c299c3a
DW
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
9a83f860 54 ,const wxString& rsName = wxT("wxSpinCtrl")
3c299c3a
DW
55 );
56
57 //
58 // A wxTextCtrl-like method (but we can't have GetValue returning wxString
a5569657 59 // because the base class already has one returning int!)
3c299c3a
DW
60 //
61 void SetValue(const wxString& rsText);
a5569657 62
3c299c3a 63 //
a5569657
DW
64 // implementation only from now on
65 // -------------------------------
3c299c3a 66 //
7e1e6965 67 virtual bool Enable(bool bEnable = true);
a5569657 68
7e1e6965
WS
69 virtual int GetValue(void) const;
70
71 virtual bool SetFont(const wxFont &rFont);
72 virtual void SetFocus(void);
a5569657 73
3c299c3a 74 inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
409c9842 75
7e1e6965
WS
76 void SetSelection(long lFrom, long lTo);
77
78 virtual bool Show(bool bShow = true);
a5569657 79
3c299c3a
DW
80 //
81 // wxSpinButton doesn't accept focus, but we do
82 //
7e1e6965 83 inline virtual bool AcceptsFocus(void) const { return false; }
a5569657 84
3c299c3a
DW
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
98protected:
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);
6e348b12 117 void OnSetFocus(wxFocusEvent& rEvent);
3c299c3a
DW
118
119 WXHWND m_hWndBuddy;
120 static wxArraySpins m_svAllSpins;
409c9842 121
a5569657 122private:
409c9842 123 DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
a5569657 124 DECLARE_EVENT_TABLE()
3c299c3a 125}; // end of CLASS wxSpinCtrl
409c9842
DW
126
127#endif // _WX_MSW_SPINCTRL_H_