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