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