]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
02761f6c | 2 | // Name: src/palmos/window.cpp |
ffecfa5a | 3 | // Purpose: wxWindow |
e2731512 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ba889513 | 5 | // Modified by: Wlodzimierz ABX Skiba - more than minimal functionality |
ffecfa5a | 6 | // Created: 10/13/04 |
e2731512 | 7 | // RCS-ID: $Id$ |
ba889513 | 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // =========================================================================== | |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
ffecfa5a JS |
20 | // For compilers that support precompilation, includes "wx.h". |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
e4db172a WS |
27 | #include "wx/window.h" |
28 | ||
ffecfa5a | 29 | #ifndef WX_PRECOMP |
ffecfa5a | 30 | #include "wx/accel.h" |
ffecfa5a JS |
31 | #include "wx/menu.h" |
32 | #include "wx/dc.h" | |
33 | #include "wx/dcclient.h" | |
34 | #include "wx/dcmemory.h" | |
35 | #include "wx/utils.h" | |
36 | #include "wx/app.h" | |
37 | #include "wx/layout.h" | |
38 | #include "wx/dialog.h" | |
39 | #include "wx/frame.h" | |
40 | #include "wx/listbox.h" | |
41 | #include "wx/button.h" | |
42 | #include "wx/msgdlg.h" | |
43 | #include "wx/settings.h" | |
44 | #include "wx/statbox.h" | |
88a7a4e1 | 45 | #include "wx/intl.h" |
e4db172a | 46 | #include "wx/log.h" |
fec9cc08 | 47 | #include "wx/textctrl.h" |
25466131 | 48 | #include "wx/menuitem.h" |
02761f6c | 49 | #include "wx/module.h" |
ffecfa5a JS |
50 | #endif |
51 | ||
52 | #if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) | |
53 | #include "wx/ownerdrw.h" | |
54 | #endif | |
55 | ||
ffecfa5a JS |
56 | #if wxUSE_DRAG_AND_DROP |
57 | #include "wx/dnd.h" | |
58 | #endif | |
59 | ||
60 | #if wxUSE_ACCESSIBILITY | |
61 | #include "wx/access.h" | |
62 | #endif | |
63 | ||
ffecfa5a JS |
64 | #if wxUSE_TOOLTIPS |
65 | #include "wx/tooltip.h" | |
66 | #endif | |
67 | ||
68 | #if wxUSE_CARET | |
69 | #include "wx/caret.h" | |
70 | #endif // wxUSE_CARET | |
71 | ||
72 | #if wxUSE_SPINCTRL | |
73 | #include "wx/spinctrl.h" | |
74 | #endif // wxUSE_SPINCTRL | |
75 | ||
ffecfa5a JS |
76 | #include "wx/notebook.h" |
77 | #include "wx/listctrl.h" | |
ffecfa5a | 78 | |
e2fc40b4 | 79 | #ifndef __WXUNIVERSAL__ |
20bc5ad8 WS |
80 | #include <Window.h> |
81 | ||
ffecfa5a JS |
82 | // --------------------------------------------------------------------------- |
83 | // global variables | |
84 | // --------------------------------------------------------------------------- | |
85 | ||
ffecfa5a JS |
86 | // --------------------------------------------------------------------------- |
87 | // private functions | |
88 | // --------------------------------------------------------------------------- | |
89 | ||
90 | // --------------------------------------------------------------------------- | |
91 | // event tables | |
92 | // --------------------------------------------------------------------------- | |
93 | ||
94 | // in wxUniv/Palm this class is abstract because it doesn't have DoPopupMenu() | |
95 | // method | |
96 | #ifdef __WXUNIVERSAL__ | |
97 | IMPLEMENT_ABSTRACT_CLASS(wxWindowPalm, wxWindowBase) | |
98 | #else // __WXPalm__ | |
99 | #if wxUSE_EXTENDED_RTTI | |
100 | ||
101 | // windows that are created from a parent window during its Create method, eg. spin controls in a calendar controls | |
102 | // must never been streamed out separately otherwise chaos occurs. Right now easiest is to test for negative ids, as | |
103 | // windows with negative ids never can be recreated anyway | |
104 | ||
105 | bool wxWindowStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & ) | |
106 | { | |
107 | return false; | |
108 | } | |
109 | ||
110 | IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow, wxWindowBase,"wx/window.h", wxWindowStreamingCallback) | |
111 | ||
112 | // make wxWindowList known before the property is used | |
113 | ||
114 | wxCOLLECTION_TYPE_INFO( wxWindow* , wxWindowList ) ; | |
115 | ||
116 | template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value) | |
117 | { | |
118 | wxListCollectionToVariantArray<wxWindowList::compatibility_iterator>( theList , value ) ; | |
119 | } | |
120 | ||
121 | WX_DEFINE_FLAGS( wxWindowStyle ) | |
122 | ||
123 | wxBEGIN_FLAGS( wxWindowStyle ) | |
124 | // new style border flags, we put them first to | |
125 | // use them for streaming out | |
126 | ||
127 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
128 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
129 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
130 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
131 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
132 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
4055ed82 | 133 | |
ffecfa5a JS |
134 | // old style border flags |
135 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
136 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
137 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
138 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
139 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
140 | wxFLAGS_MEMBER(wxBORDER) | |
141 | ||
142 | // standard window styles | |
143 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
144 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
145 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
146 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
147 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) | |
148 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
149 | wxFLAGS_MEMBER(wxVSCROLL) | |
150 | wxFLAGS_MEMBER(wxHSCROLL) | |
151 | ||
152 | wxEND_FLAGS( wxWindowStyle ) | |
153 | ||
154 | wxBEGIN_PROPERTIES_TABLE(wxWindow) | |
155 | wxEVENT_PROPERTY( Close , wxEVT_CLOSE_WINDOW , wxCloseEvent) | |
156 | wxEVENT_PROPERTY( Create , wxEVT_CREATE , wxWindowCreateEvent ) | |
157 | wxEVENT_PROPERTY( Destroy , wxEVT_DESTROY , wxWindowDestroyEvent ) | |
158 | // Always constructor Properties first | |
159 | ||
160 | wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
161 | wxPROPERTY( Id,wxWindowID, SetId, GetId, wxID_ANY, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) | |
162 | wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxDefaultPosition , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos | |
163 | wxPROPERTY( Size,wxSize, SetSize, GetSize, wxDefaultSize , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size | |
164 | wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
165 | ||
166 | // Then all relations of the object graph | |
167 | ||
168 | wxREADONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren , wxPROP_OBJECT_GRAPH /*flags*/ , wxT("Helpstring") , wxT("group")) | |
169 | ||
170 | // and finally all other properties | |
171 | ||
172 | wxPROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // extstyle | |
173 | wxPROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // bg | |
174 | wxPROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // fg | |
175 | wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
176 | wxPROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
177 | #if 0 | |
178 | // possible property candidates (not in xrc) or not valid in all subclasses | |
179 | wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) | |
180 | wxPROPERTY( Font , wxFont , SetFont , GetWindowFont , ) | |
181 | wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) | |
182 | // MaxHeight, Width , MinHeight , Width | |
183 | // TODO switch label to control and title to toplevels | |
184 | ||
185 | wxPROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , ) | |
186 | //wxPROPERTY( Cursor , wxCursor , SetCursor , GetCursor , ) | |
187 | // wxPROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , ) | |
188 | wxPROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , ) | |
189 | ||
190 | ||
191 | ||
192 | #endif | |
193 | wxEND_PROPERTIES_TABLE() | |
194 | ||
195 | wxBEGIN_HANDLERS_TABLE(wxWindow) | |
196 | wxEND_HANDLERS_TABLE() | |
197 | ||
198 | wxCONSTRUCTOR_DUMMY(wxWindow) | |
199 | ||
200 | #else | |
201 | IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) | |
202 | #endif | |
203 | #endif // __WXUNIVERSAL__/__WXPalm__ | |
204 | ||
205 | BEGIN_EVENT_TABLE(wxWindowPalm, wxWindowBase) | |
206 | EVT_ERASE_BACKGROUND(wxWindowPalm::OnEraseBackground) | |
ffecfa5a JS |
207 | EVT_INIT_DIALOG(wxWindowPalm::OnInitDialog) |
208 | END_EVENT_TABLE() | |
209 | ||
210 | // =========================================================================== | |
211 | // implementation | |
212 | // =========================================================================== | |
213 | ||
214 | // --------------------------------------------------------------------------- | |
215 | // wxWindow utility functions | |
216 | // --------------------------------------------------------------------------- | |
217 | ||
218 | // Find an item given the MS Windows id | |
219 | wxWindow *wxWindowPalm::FindItem(long id) const | |
220 | { | |
221 | return NULL; | |
222 | } | |
223 | ||
224 | // Find an item given the MS Windows handle | |
324eeecb | 225 | wxWindow *wxWindowPalm::FindItemByWinHandle(WXWINHANDLE handle, bool controlOnly) const |
ffecfa5a | 226 | { |
324eeecb | 227 | // TODO |
ffecfa5a JS |
228 | return NULL; |
229 | } | |
230 | ||
34deaa93 WS |
231 | bool wxGetKeyState(wxKeyCode key) |
232 | { | |
233 | wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key != | |
234 | WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons")); | |
235 | ||
236 | // TODO | |
237 | ||
238 | return false; | |
239 | } | |
240 | ||
ffecfa5a JS |
241 | // ---------------------------------------------------------------------------- |
242 | // constructors and such | |
243 | // ---------------------------------------------------------------------------- | |
244 | ||
245 | void wxWindowPalm::Init() | |
246 | { | |
e2fc40b4 | 247 | m_hWnd = 0; |
ffecfa5a JS |
248 | } |
249 | ||
250 | // Destructor | |
251 | wxWindowPalm::~wxWindowPalm() | |
252 | { | |
253 | } | |
254 | ||
255 | // real construction (Init() must have been called before!) | |
256 | bool wxWindowPalm::Create(wxWindow *parent, | |
324eeecb WS |
257 | wxWindowID id, |
258 | const wxPoint& pos, | |
259 | const wxSize& size, | |
260 | long style, | |
261 | const wxString& name) | |
ffecfa5a | 262 | { |
a152561c WS |
263 | wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") ); |
264 | ||
265 | if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) | |
266 | return false; | |
267 | ||
268 | parent->AddChild(this); | |
269 | ||
270 | InheritAttributes(); | |
271 | ||
272 | return true; | |
ffecfa5a JS |
273 | } |
274 | ||
20bc5ad8 | 275 | WXFORMPTR wxWindowPalm::GetFormPtr() |
ffecfa5a JS |
276 | { |
277 | return FrameForm; | |
278 | } | |
20bc5ad8 | 279 | void wxWindowPalm::SetFormPtr(WXFORMPTR FormPtr) |
ffecfa5a | 280 | { |
20bc5ad8 | 281 | FrameForm = FormPtr; |
ffecfa5a JS |
282 | } |
283 | ||
284 | // --------------------------------------------------------------------------- | |
285 | // basic operations | |
286 | // --------------------------------------------------------------------------- | |
287 | ||
288 | void wxWindowPalm::SetFocus() | |
289 | { | |
290 | } | |
291 | ||
292 | void wxWindowPalm::SetFocusFromKbd() | |
293 | { | |
294 | } | |
295 | ||
296 | // Get the window with the focus | |
297 | wxWindow *wxWindowBase::DoFindFocus() | |
298 | { | |
299 | return NULL; | |
300 | } | |
301 | ||
302 | bool wxWindowPalm::Enable(bool enable) | |
303 | { | |
304 | return false; | |
305 | } | |
306 | ||
307 | bool wxWindowPalm::Show(bool show) | |
308 | { | |
309 | return false; | |
310 | } | |
311 | ||
312 | // Raise the window to the top of the Z order | |
313 | void wxWindowPalm::Raise() | |
314 | { | |
315 | } | |
316 | ||
317 | // Lower the window to the bottom of the Z order | |
318 | void wxWindowPalm::Lower() | |
319 | { | |
320 | } | |
321 | ||
0ab48d64 | 322 | void wxWindowPalm::SetLabel( const wxString& WXUNUSED(label)) |
ffecfa5a JS |
323 | { |
324 | } | |
325 | ||
0ab48d64 | 326 | wxString wxWindowPalm::GetLabel() const |
ffecfa5a | 327 | { |
db101bd3 | 328 | return wxEmptyString; |
ffecfa5a JS |
329 | } |
330 | ||
331 | void wxWindowPalm::DoCaptureMouse() | |
332 | { | |
333 | } | |
334 | ||
335 | void wxWindowPalm::DoReleaseMouse() | |
336 | { | |
337 | } | |
338 | ||
339 | /* static */ wxWindow *wxWindowBase::GetCapture() | |
340 | { | |
341 | return NULL; | |
342 | } | |
343 | ||
344 | bool wxWindowPalm::SetFont(const wxFont& font) | |
345 | { | |
346 | return false; | |
347 | } | |
348 | bool wxWindowPalm::SetCursor(const wxCursor& cursor) | |
349 | { | |
350 | return false; | |
351 | } | |
352 | ||
353 | void wxWindowPalm::WarpPointer (int x, int y) | |
354 | { | |
355 | } | |
356 | ||
357 | // --------------------------------------------------------------------------- | |
358 | // scrolling stuff | |
359 | // --------------------------------------------------------------------------- | |
360 | ||
361 | // convert wxHORIZONTAL/wxVERTICAL to SB_HORZ/SB_VERT | |
362 | static inline int wxDirToWinStyle(int orient) | |
363 | { | |
364 | return 0; | |
365 | } | |
366 | ||
367 | int wxWindowPalm::GetScrollPos(int orient) const | |
368 | { | |
369 | return 0; | |
370 | } | |
371 | ||
372 | // This now returns the whole range, not just the number | |
373 | // of positions that we can scroll. | |
374 | int wxWindowPalm::GetScrollRange(int orient) const | |
375 | { | |
376 | return 0; | |
377 | } | |
378 | ||
379 | int wxWindowPalm::GetScrollThumb(int orient) const | |
380 | { | |
381 | return 0; | |
382 | } | |
383 | ||
384 | void wxWindowPalm::SetScrollPos(int orient, int pos, bool refresh) | |
385 | { | |
386 | } | |
387 | ||
388 | // New function that will replace some of the above. | |
389 | void wxWindowPalm::SetScrollbar(int orient, | |
390 | int pos, | |
391 | int pageSize, | |
392 | int range, | |
393 | bool refresh) | |
394 | { | |
395 | } | |
396 | ||
397 | void wxWindowPalm::ScrollWindow(int dx, int dy, const wxRect *prect) | |
398 | { | |
399 | } | |
400 | ||
401 | bool wxWindowPalm::ScrollLines(int lines) | |
402 | { | |
403 | return false; | |
404 | } | |
405 | ||
406 | bool wxWindowPalm::ScrollPages(int pages) | |
407 | { | |
408 | return false; | |
409 | } | |
410 | ||
ffecfa5a JS |
411 | // ---------------------------------------------------------------------------- |
412 | // Style handling | |
413 | // ---------------------------------------------------------------------------- | |
414 | ||
ffecfa5a JS |
415 | WXDWORD wxWindowPalm::PalmGetStyle(long flags, WXDWORD *exstyle) const |
416 | { | |
417 | return 0; | |
418 | } | |
419 | ||
420 | // Setup background and foreground colours correctly | |
421 | void wxWindowPalm::SetupColours() | |
422 | { | |
423 | } | |
424 | ||
ffecfa5a JS |
425 | void wxWindowPalm::OnInternalIdle() |
426 | { | |
427 | } | |
428 | ||
429 | // Set this window to be the child of 'parent'. | |
430 | bool wxWindowPalm::Reparent(wxWindowBase *parent) | |
431 | { | |
432 | return false; | |
433 | } | |
434 | ||
ffecfa5a JS |
435 | void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect) |
436 | { | |
e2fc40b4 | 437 | WinHandle handle = (WinHandle)GetHWND(); |
324eeecb WS |
438 | if(handle) |
439 | { | |
6afc1b46 | 440 | #ifdef __WXPALMOS6__ |
324eeecb WS |
441 | if(rect) |
442 | { | |
443 | RectangleType dirtyRect; | |
d2893292 WS |
444 | dirtyRect.topLeft.x = rect->GetX() - 1; |
445 | dirtyRect.topLeft.y = rect->GetY() - 1; | |
446 | dirtyRect.extent.x = rect->GetWidth() + 1; | |
447 | dirtyRect.extent.y = rect->GetHeight() + 1; | |
324eeecb WS |
448 | WinInvalidateRect(handle, &dirtyRect); |
449 | } | |
450 | else | |
451 | { | |
452 | WinInvalidateWindow(handle); | |
453 | } | |
6afc1b46 VZ |
454 | #else // __WXPALMOS5__ |
455 | WinSetActiveWindow (handle); | |
456 | #endif | |
457 | ||
324eeecb | 458 | } |
ffecfa5a JS |
459 | } |
460 | ||
461 | void wxWindowPalm::Update() | |
462 | { | |
463 | } | |
464 | ||
465 | // --------------------------------------------------------------------------- | |
466 | // drag and drop | |
467 | // --------------------------------------------------------------------------- | |
468 | ||
469 | ||
470 | #if wxUSE_DRAG_AND_DROP | |
471 | void wxWindowPalm::SetDropTarget(wxDropTarget *pDropTarget) | |
472 | { | |
473 | } | |
474 | #endif // wxUSE_DRAG_AND_DROP | |
475 | ||
476 | // old style file-manager drag&drop support: we retain the old-style | |
477 | // DragAcceptFiles in parallel with SetDropTarget. | |
478 | void wxWindowPalm::DragAcceptFiles(bool accept) | |
479 | { | |
480 | } | |
481 | ||
482 | // ---------------------------------------------------------------------------- | |
483 | // tooltips | |
484 | // ---------------------------------------------------------------------------- | |
485 | ||
486 | #if wxUSE_TOOLTIPS | |
487 | ||
488 | void wxWindowPalm::DoSetToolTip(wxToolTip *tooltip) | |
489 | { | |
490 | } | |
491 | ||
492 | #endif // wxUSE_TOOLTIPS | |
493 | ||
494 | // --------------------------------------------------------------------------- | |
495 | // moving and resizing | |
496 | // --------------------------------------------------------------------------- | |
497 | ||
498 | // Get total size | |
499 | void wxWindowPalm::DoGetSize(int *x, int *y) const | |
500 | { | |
501 | } | |
502 | ||
503 | // Get size *available for subwindows* i.e. excluding menu bar etc. | |
504 | void wxWindowPalm::DoGetClientSize(int *x, int *y) const | |
505 | { | |
506 | } | |
507 | ||
508 | void wxWindowPalm::DoGetPosition(int *x, int *y) const | |
509 | { | |
d2893292 WS |
510 | if(x) |
511 | *x = 0; | |
512 | if(y) | |
513 | *y = 0; | |
ffecfa5a JS |
514 | } |
515 | ||
516 | void wxWindowPalm::DoScreenToClient(int *x, int *y) const | |
517 | { | |
518 | } | |
519 | ||
520 | void wxWindowPalm::DoClientToScreen(int *x, int *y) const | |
521 | { | |
522 | } | |
523 | ||
524 | void wxWindowPalm::DoMoveWindow(int x, int y, int width, int height) | |
525 | { | |
526 | } | |
527 | ||
528 | // set the size of the window: if the dimensions are positive, just use them, | |
529 | // but if any of them is equal to -1, it means that we must find the value for | |
530 | // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in | |
531 | // which case -1 is a valid value for x and y) | |
532 | // | |
533 | // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate | |
534 | // the width/height to best suit our contents, otherwise we reuse the current | |
535 | // width/height | |
536 | void wxWindowPalm::DoSetSize(int x, int y, int width, int height, int sizeFlags) | |
537 | { | |
324eeecb WS |
538 | // get the current size and position... |
539 | int currentX, currentY; | |
540 | GetPosition(¤tX, ¤tY); | |
541 | int currentW,currentH; | |
542 | GetSize(¤tW, ¤tH); | |
543 | ||
544 | // ... and don't do anything (avoiding flicker) if it's already ok | |
545 | if ( x == currentX && y == currentY && | |
546 | width == currentW && height == currentH ) | |
547 | { | |
548 | return; | |
549 | } | |
550 | ||
551 | if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) | |
552 | x = currentX; | |
553 | if ( y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) | |
554 | y = currentY; | |
555 | ||
556 | AdjustForParentClientOrigin(x, y, sizeFlags); | |
557 | ||
558 | wxSize size = wxDefaultSize; | |
559 | if ( width == wxDefaultCoord ) | |
560 | { | |
561 | if ( sizeFlags & wxSIZE_AUTO_WIDTH ) | |
562 | { | |
563 | size = DoGetBestSize(); | |
564 | width = size.x; | |
565 | } | |
566 | else | |
567 | { | |
568 | // just take the current one | |
569 | width = currentW; | |
570 | } | |
571 | } | |
572 | ||
573 | if ( height == wxDefaultCoord ) | |
574 | { | |
575 | if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) | |
576 | { | |
577 | if ( size.x == wxDefaultCoord ) | |
578 | { | |
579 | size = DoGetBestSize(); | |
580 | } | |
581 | //else: already called DoGetBestSize() above | |
582 | ||
583 | height = size.y; | |
584 | } | |
585 | else | |
586 | { | |
587 | // just take the current one | |
588 | height = currentH; | |
589 | } | |
590 | } | |
591 | ||
592 | DoMoveWindow(x, y, width, height); | |
ffecfa5a JS |
593 | } |
594 | ||
595 | void wxWindowPalm::DoSetClientSize(int width, int height) | |
596 | { | |
597 | } | |
598 | ||
ffecfa5a JS |
599 | // --------------------------------------------------------------------------- |
600 | // text metrics | |
601 | // --------------------------------------------------------------------------- | |
602 | ||
603 | int wxWindowPalm::GetCharHeight() const | |
604 | { | |
605 | return 0; | |
606 | } | |
607 | ||
608 | int wxWindowPalm::GetCharWidth() const | |
609 | { | |
610 | return 0; | |
611 | } | |
612 | ||
613 | void wxWindowPalm::GetTextExtent(const wxString& string, | |
614 | int *x, int *y, | |
615 | int *descent, int *externalLeading, | |
616 | const wxFont *theFont) const | |
617 | { | |
618 | } | |
619 | ||
620 | // --------------------------------------------------------------------------- | |
621 | // popup menu | |
622 | // --------------------------------------------------------------------------- | |
623 | ||
624 | #if wxUSE_MENUS_NATIVE | |
625 | ||
626 | // yield for WM_COMMAND events only, i.e. process all WM_COMMANDs in the queue | |
627 | // immediately, without waiting for the next event loop iteration | |
628 | // | |
629 | // NB: this function should probably be made public later as it can almost | |
630 | // surely replace wxYield() elsewhere as well | |
631 | static void wxYieldForCommandsOnly() | |
632 | { | |
633 | } | |
634 | ||
635 | bool wxWindowPalm::DoPopupMenu(wxMenu *menu, int x, int y) | |
636 | { | |
637 | return false; | |
638 | } | |
639 | ||
640 | #endif // wxUSE_MENUS_NATIVE | |
641 | ||
ffecfa5a JS |
642 | // ---------------------------------------------------------------------------- |
643 | // wxWindow <-> HWND map | |
644 | // ---------------------------------------------------------------------------- | |
645 | ||
646 | wxWinHashTable *wxWinHandleHash = NULL; | |
647 | ||
324eeecb | 648 | wxWindow *wxFindWinFromWinHandle(WXWINHANDLE handle) |
ffecfa5a | 649 | { |
324eeecb | 650 | // TODO |
ffecfa5a JS |
651 | return NULL; |
652 | } | |
653 | ||
654 | void wxRemoveHandleAssociation(wxWindowPalm *win) | |
655 | { | |
656 | } | |
657 | ||
658 | // ---------------------------------------------------------------------------- | |
324eeecb | 659 | // various Palm specific class dependent functions |
ffecfa5a JS |
660 | // ---------------------------------------------------------------------------- |
661 | ||
ffecfa5a | 662 | bool wxWindowPalm::PalmGetCreateWindowCoords(const wxPoint& pos, |
324eeecb WS |
663 | const wxSize& size, |
664 | int& x, int& y, | |
665 | int& w, int& h) const | |
ffecfa5a JS |
666 | { |
667 | return false; | |
668 | } | |
669 | ||
ffecfa5a | 670 | bool wxWindowPalm::PalmCreate(const wxChar *wclass, |
324eeecb WS |
671 | const wxChar *title, |
672 | const wxPoint& pos, | |
673 | const wxSize& size, | |
674 | WXDWORD style, | |
675 | WXDWORD extendedStyle) | |
ffecfa5a JS |
676 | { |
677 | return false; | |
678 | } | |
679 | ||
680 | // =========================================================================== | |
681 | // Palm message handlers | |
682 | // =========================================================================== | |
683 | ||
ffecfa5a JS |
684 | // --------------------------------------------------------------------------- |
685 | // painting | |
686 | // --------------------------------------------------------------------------- | |
687 | ||
ffecfa5a JS |
688 | // Can be called from an application's OnPaint handler |
689 | void wxWindowPalm::OnPaint(wxPaintEvent& event) | |
690 | { | |
691 | } | |
692 | ||
ffecfa5a JS |
693 | void wxWindowPalm::OnEraseBackground(wxEraseEvent& event) |
694 | { | |
695 | } | |
696 | ||
697 | // --------------------------------------------------------------------------- | |
698 | // moving and resizing | |
699 | // --------------------------------------------------------------------------- | |
700 | ||
ffecfa5a JS |
701 | bool wxWindowPalm::HandleMove(int x, int y) |
702 | { | |
703 | return false; | |
704 | } | |
705 | ||
706 | bool wxWindowPalm::HandleMoving(wxRect& rect) | |
707 | { | |
708 | return false; | |
709 | } | |
710 | ||
ffecfa5a JS |
711 | // --------------------------------------------------------------------------- |
712 | // joystick | |
713 | // --------------------------------------------------------------------------- | |
714 | ||
715 | bool wxWindowPalm::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) | |
716 | { | |
717 | return false; | |
718 | } | |
719 | ||
720 | // --------------------------------------------------------------------------- | |
721 | // scrolling | |
722 | // --------------------------------------------------------------------------- | |
723 | ||
724 | bool wxWindowPalm::PalmOnScroll(int orientation, WXWORD wParam, | |
324eeecb | 725 | WXWORD pos, WXWINHANDLE control) |
4055ed82 | 726 | { |
324eeecb | 727 | // TODO |
ffecfa5a JS |
728 | return false; |
729 | } | |
730 | ||
731 | // =========================================================================== | |
732 | // global functions | |
733 | // =========================================================================== | |
734 | ||
324eeecb | 735 | void wxGetCharSize(WXWINHANDLE wnd, int *x, int *y, const wxFont *the_font) |
ffecfa5a | 736 | { |
324eeecb | 737 | // TODO |
ffecfa5a JS |
738 | } |
739 | ||
740 | #if wxUSE_HOTKEY | |
741 | ||
742 | bool wxWindowPalm::RegisterHotKey(int hotkeyId, int modifiers, int keycode) | |
743 | { | |
744 | return false; | |
745 | } | |
746 | ||
747 | bool wxWindowPalm::UnregisterHotKey(int hotkeyId) | |
748 | { | |
749 | return false; | |
750 | } | |
e2fc40b4 | 751 | #endif // # __WXUNIVERSAL__ |
ffecfa5a | 752 | #endif // wxUSE_HOTKEY |