]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/spinctrl.cpp
Applied patch [ 1171467 ] Fix for DocManager not checking OnNewDocument's return...
[wxWidgets.git] / src / palmos / spinctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/spinctrl.cpp
3 // Purpose: wxSpinCtrl class implementation for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma implementation "spinctrlbase.h"
18 #pragma implementation "spinctrl.h"
19 #endif
20
21 // ----------------------------------------------------------------------------
22 // headers
23 // ----------------------------------------------------------------------------
24
25 // for compilers that support precompilation, includes "wx.h".
26 #include "wx/wxprec.h"
27
28 #ifdef __BORLANDC__
29 #pragma hdrstop
30 #endif
31
32 #ifndef WX_PRECOMP
33 #include "wx/wx.h"
34 #endif
35
36 #if wxUSE_SPINCTRL
37
38 #if defined(__WIN95__)
39
40 #include "wx/spinctrl.h"
41 #include "wx/palmos/private.h"
42
43 // ----------------------------------------------------------------------------
44 // macros
45 // ----------------------------------------------------------------------------
46
47 #if wxUSE_EXTENDED_RTTI
48 WX_DEFINE_FLAGS( wxSpinCtrlStyle )
49
50 wxBEGIN_FLAGS( wxSpinCtrlStyle )
51 // new style border flags, we put them first to
52 // use them for streaming out
53 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
54 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
55 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
56 wxFLAGS_MEMBER(wxBORDER_RAISED)
57 wxFLAGS_MEMBER(wxBORDER_STATIC)
58 wxFLAGS_MEMBER(wxBORDER_NONE)
59
60 // old style border flags
61 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
62 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
63 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
64 wxFLAGS_MEMBER(wxRAISED_BORDER)
65 wxFLAGS_MEMBER(wxSTATIC_BORDER)
66 wxFLAGS_MEMBER(wxBORDER)
67
68 // standard window styles
69 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
70 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
71 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
72 wxFLAGS_MEMBER(wxWANTS_CHARS)
73 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
74 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
75 wxFLAGS_MEMBER(wxVSCROLL)
76 wxFLAGS_MEMBER(wxHSCROLL)
77
78 wxFLAGS_MEMBER(wxSP_HORIZONTAL)
79 wxFLAGS_MEMBER(wxSP_VERTICAL)
80 wxFLAGS_MEMBER(wxSP_ARROW_KEYS)
81 wxFLAGS_MEMBER(wxSP_WRAP)
82
83 wxEND_FLAGS( wxSpinCtrlStyle )
84
85 IMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl,"wx/spinbut.h")
86
87 wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
88 wxEVENT_RANGE_PROPERTY( Spin , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxSpinEvent )
89 wxEVENT_PROPERTY( Updated , wxEVT_COMMAND_SPINCTRL_UPDATED , wxCommandEvent )
90 wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent )
91 wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent )
92
93 wxPROPERTY( ValueString , wxString , SetValue , GetValue , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) ;
94 wxPROPERTY( Value , int , SetValue, GetValue, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
95 wxPROPERTY( Min , int , SetMin, GetMin, 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
96 wxPROPERTY( Max , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
97 wxPROPERTY_FLAGS( WindowStyle , wxSpinCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
98 /*
99 TODO PROPERTIES
100 style wxSP_ARROW_KEYS
101 */
102 wxEND_PROPERTIES_TABLE()
103
104 wxBEGIN_HANDLERS_TABLE(wxSpinCtrl)
105 wxEND_HANDLERS_TABLE()
106
107 wxCONSTRUCTOR_6( wxSpinCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , ValueString , wxPoint , Position , wxSize , Size , long , WindowStyle )
108 #else
109 IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
110 #endif
111
112 BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
113 EVT_CHAR(wxSpinCtrl::OnChar)
114
115 EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus)
116
117 EVT_SPIN(-1, wxSpinCtrl::OnSpinChange)
118 END_EVENT_TABLE()
119
120 #define GetBuddyHwnd() (HWND)(m_hwndBuddy)
121
122 // ----------------------------------------------------------------------------
123 // constants
124 // ----------------------------------------------------------------------------
125
126 // the margin between the up-down control and its buddy (can be arbitrary,
127 // choose what you like - or may be decide during run-time depending on the
128 // font size?)
129 static const int MARGIN_BETWEEN = 1;
130
131 // ============================================================================
132 // implementation
133 // ============================================================================
134
135 wxArraySpins wxSpinCtrl::ms_allSpins;
136
137 /* static */
138 wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
139 {
140 return NULL;
141 }
142
143 // process a WM_COMMAND generated by the buddy text control
144 bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id))
145 {
146 return false;
147 }
148
149 void wxSpinCtrl::OnChar(wxKeyEvent& event)
150 {
151 }
152
153 void wxSpinCtrl::OnSetFocus(wxFocusEvent& event)
154 {
155 }
156
157 // ----------------------------------------------------------------------------
158 // construction
159 // ----------------------------------------------------------------------------
160
161 bool wxSpinCtrl::Create(wxWindow *parent,
162 wxWindowID id,
163 const wxString& value,
164 const wxPoint& pos,
165 const wxSize& size,
166 long style,
167 int min, int max, int initial,
168 const wxString& name)
169 {
170 return false;
171 }
172
173 wxSpinCtrl::~wxSpinCtrl()
174 {
175 }
176
177 // ----------------------------------------------------------------------------
178 // wxTextCtrl-like methods
179 // ----------------------------------------------------------------------------
180
181 void wxSpinCtrl::SetValue(const wxString& text)
182 {
183 }
184
185 int wxSpinCtrl::GetValue() const
186 {
187 return 0;
188 }
189
190 void wxSpinCtrl::SetSelection(long from, long to)
191 {
192 }
193
194 // ----------------------------------------------------------------------------
195 // forward some methods to subcontrols
196 // ----------------------------------------------------------------------------
197
198 bool wxSpinCtrl::SetFont(const wxFont& font)
199 {
200 return false;
201 }
202
203 bool wxSpinCtrl::Show(bool show)
204 {
205 return false;
206 }
207
208 bool wxSpinCtrl::Enable(bool enable)
209 {
210 return false;
211 }
212
213 void wxSpinCtrl::SetFocus()
214 {
215 }
216
217 // ----------------------------------------------------------------------------
218 // event processing
219 // ----------------------------------------------------------------------------
220
221 void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
222 {
223 }
224
225 // ----------------------------------------------------------------------------
226 // size calculations
227 // ----------------------------------------------------------------------------
228
229 wxSize wxSpinCtrl::DoGetBestSize() const
230 {
231 return wxSize(0,0);
232 }
233
234 void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
235 {
236 }
237
238 // get total size of the control
239 void wxSpinCtrl::DoGetSize(int *x, int *y) const
240 {
241 }
242
243 void wxSpinCtrl::DoGetPosition(int *x, int *y) const
244 {
245 }
246
247 #endif // __WIN95__
248
249 #endif
250 // wxUSE_SPINCTRL
251