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