1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/spinctrl.cpp
3 // Purpose: wxSpinCtrl class implementation for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
33 #if defined(__WIN95__)
35 #include "wx/spinctrl.h"
36 #include "wx/palmos/private.h"
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 BEGIN_EVENT_TABLE(wxSpinCtrl
, wxSpinButton
)
43 EVT_CHAR(wxSpinCtrl::OnChar
)
45 EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus
)
47 EVT_SPIN(-1, wxSpinCtrl::OnSpinChange
)
50 #define GetBuddyHwnd() (HWND)(m_hwndBuddy)
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
56 // the margin between the up-down control and its buddy (can be arbitrary,
57 // choose what you like - or may be decide during run-time depending on the
59 static const int MARGIN_BETWEEN
= 1;
61 // ============================================================================
63 // ============================================================================
65 wxArraySpins
wxSpinCtrl::ms_allSpins
;
68 wxSpinCtrl
*wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy
)
73 // process a WM_COMMAND generated by the buddy text control
74 bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd
, WXWORD
WXUNUSED(id
))
79 void wxSpinCtrl::OnChar(wxKeyEvent
& event
)
83 void wxSpinCtrl::OnSetFocus(wxFocusEvent
& event
)
87 // ----------------------------------------------------------------------------
89 // ----------------------------------------------------------------------------
91 bool wxSpinCtrl::Create(wxWindow
*parent
,
93 const wxString
& value
,
97 int min
, int max
, int initial
,
103 wxSpinCtrl::~wxSpinCtrl()
107 // ----------------------------------------------------------------------------
108 // wxTextCtrl-like methods
109 // ----------------------------------------------------------------------------
111 void wxSpinCtrl::SetValue(const wxString
& text
)
115 int wxSpinCtrl::GetValue() const
120 void wxSpinCtrl::SetSelection(long from
, long to
)
124 // ----------------------------------------------------------------------------
125 // forward some methods to subcontrols
126 // ----------------------------------------------------------------------------
128 bool wxSpinCtrl::SetFont(const wxFont
& font
)
133 bool wxSpinCtrl::Show(bool show
)
138 bool wxSpinCtrl::Enable(bool enable
)
143 void wxSpinCtrl::SetFocus()
147 // ----------------------------------------------------------------------------
149 // ----------------------------------------------------------------------------
151 void wxSpinCtrl::OnSpinChange(wxSpinEvent
& eventSpin
)
155 // ----------------------------------------------------------------------------
157 // ----------------------------------------------------------------------------
159 wxSize
wxSpinCtrl::DoGetBestSize() const
164 void wxSpinCtrl::DoMoveWindow(int x
, int y
, int width
, int height
)
168 // get total size of the control
169 void wxSpinCtrl::DoGetSize(int *x
, int *y
) const
173 void wxSpinCtrl::DoGetPosition(int *x
, int *y
) const