]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/window.cpp
corrected CodeWarrior project target names and generated application names
[wxWidgets.git] / src / mgl / window.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/window.cpp
3 // Purpose: wxWindow
4 // Author: Vaclav Slavik
5 // (based on GTK & MSW implementations)
6 // RCS-ID: $Id$
7 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows license
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ===========================================================================
12 // declarations
13 // ===========================================================================
14
15 // ---------------------------------------------------------------------------
16 // headers
17 // ---------------------------------------------------------------------------
18
19 #ifdef __GNUG__
20 #pragma implementation "window.h"
21 #endif
22
23 // For compilers that support precompilation, includes "wx.h".
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #ifndef WX_PRECOMP
31 #include "wx/window.h"
32 #include "wx/accel.h"
33 #include "wx/setup.h"
34 #include "wx/dc.h"
35 #include "wx/dcclient.h"
36 #include "wx/utils.h"
37 #include "wx/app.h"
38 #include "wx/panel.h"
39 #include "wx/caret.h"
40 #endif
41
42 #if wxUSE_DRAG_AND_DROP
43 #include "wx/dnd.h"
44 #endif
45
46 #include "wx/log.h"
47 #include "wx/sysopt.h"
48 #include "wx/mgl/private.h"
49 #include "wx/intl.h"
50 #include "wx/dcscreen.h"
51
52 #include <mgraph.hpp>
53
54 #if wxUSE_TOOLTIPS
55 #include "wx/tooltip.h"
56 #endif
57
58 // ---------------------------------------------------------------------------
59 // global variables
60 // ---------------------------------------------------------------------------
61
62 // MGL window manager and associated DC.
63 winmng_t *g_winMng = NULL;
64 MGLDevCtx *g_displayDC = NULL;
65
66 extern wxList WXDLLEXPORT wxPendingDelete;
67 // FIXME_MGL -- ???
68
69 // the window that has keyboard+joystick focus:
70 static wxWindowMGL *g_focusedWindow = NULL;
71 // the window that is currently under mouse cursor:
72 static wxWindowMGL *g_windowUnderMouse = NULL;
73
74 // ---------------------------------------------------------------------------
75 // constants
76 // ---------------------------------------------------------------------------
77
78 // Custom identifiers used to distinguish between various event handlers
79 // and capture handlers passed to MGL_wm
80 enum
81 {
82 wxMGL_CAPTURE_MOUSE = 1,
83 wxMGL_CAPTURE_KEYB = 2
84 };
85
86
87 // ---------------------------------------------------------------------------
88 // private functions
89 // ---------------------------------------------------------------------------
90
91 // wxCreateMGL_WM creates MGL display DC and associates it with winmng_t
92 // structure. Dimensions and depth of the DC are fetched from wxSystemOptions
93 // object.
94 // This function is *not* called from wxApp's initialization but rather at
95 // the time when WM is needed, i.e. when first wxWindow is created. This
96 // has two important effects:
97 // a) it is possible to write windowless wxMGL apps
98 // b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions
99 // with desired settings
100
101 // FIXME_MGL -- move to app.cpp??
102 bool wxCreateMGL_WM()
103 {
104 int mode;
105 int width = 640, height = 480, depth = 16;
106 int refresh = MGL_DEFAULT_REFRESH;
107
108 #if wxUSE_SYSTEM_OPTIONS
109 if ( wxSystemOptions::HasOption(wxT("mgl.screen-width") )
110 width = wxSystemOptions::GetOptionInt(wxT("mgl.screen-width"));
111 if ( wxSystemOptions::HasOption(wxT("mgl.screen-height") )
112 height = wxSystemOptions::GetOptionInt(wxT("mgl.screen-height"));
113 if ( wxSystemOptions::HasOption(wxT("mgl.screen-depth") )
114 depth = wxSystemOptions::GetOptionInt(wxT("mgl.screen-depth"));
115 if ( wxSystemOptions::HasOption(wxT("mgl.screen-refresh") )
116 refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh"));
117 #endif
118
119 mode = MGL_findMode(width, height, depth);
120 if ( mode == -1 )
121 {
122 wxLogWarning(_("Mode %ix%i-%i not available, falling back to default mode."), width, height, depth);
123 mode = 0; // always available
124 }
125 g_displayDC = new MGLDisplayDC(mode, 1, refresh);
126 if ( !g_displayDC->isValid() )
127 {
128 delete g_displayDC;
129 g_displayDC = NULL;
130 return FALSE;
131 }
132
133 g_winMng = MGL_wmCreate(g_displayDC->getDC());
134 if (!g_winMng)
135 return FALSE;
136
137 return TRUE;
138 }
139
140 void wxDestroyMGL_WM()
141 {
142 if ( g_winMng )
143 {
144 MGL_wmDestroy(g_winMng);
145 g_winMng = NULL;
146 }
147 if ( g_displayDC )
148 {
149 delete g_displayDC;
150 g_displayDC = NULL;
151 }
152 }
153
154 // ---------------------------------------------------------------------------
155 // MGL_WM hooks:
156 // ---------------------------------------------------------------------------
157
158 static void wxWindowPainter(window_t *wnd, MGLDC *dc)
159 {
160 wxWindowMGL *w = (wxWindow*) wnd->userData;
161 if (w)
162 {
163 MGLDevCtx ctx(dc);
164 w->HandlePaint(&ctx);
165 }
166 }
167
168 // ---------------------------------------------------------------------------
169 // event tables
170 // ---------------------------------------------------------------------------
171
172 // in wxUniv/MSW this class is abstract because it doesn't have DoPopupMenu()
173 // method
174 IMPLEMENT_ABSTRACT_CLASS(wxWindowMGL, wxWindowBase)
175
176 BEGIN_EVENT_TABLE(wxWindowMGL, wxWindowBase)
177 END_EVENT_TABLE()
178
179 // ===========================================================================
180 // implementation
181 // ===========================================================================
182
183 // ----------------------------------------------------------------------------
184 // constructors and such
185 // ----------------------------------------------------------------------------
186
187 void wxWindowMGL::Init()
188 {
189 // generic:
190 InitBase();
191
192 // mgl specific:
193 if ( !g_winMng && !wxCreateMGL_WM() )
194 wxFatalError(_T("Can't initalize MGL, aborting!"));
195
196 m_wnd = NULL;
197 m_isShown = TRUE;
198 m_isBeingDeleted = FALSE;
199 m_isEnabled = TRUE;
200 m_frozen = FALSE;
201 m_paintMGLDC = NULL;
202 }
203
204 // Destructor
205 wxWindowMGL::~wxWindowMGL()
206 {
207 m_isBeingDeleted = TRUE;
208
209 if ( g_focusedWindow == this )
210 KillFocus();
211
212 #if 0 // -- fixme - do we need this?
213 // VS: make sure there's no wxFrame with last focus set to us:
214 for (wxWindow *win = GetParent(); win; win = win->GetParent())
215 {
216 wxFrame *frame = wxDynamicCast(win, wxFrame);
217 if ( frame )
218 {
219 if ( frame->GetLastFocus() == this )
220 frame->SetLastFocus((wxWindow*)NULL);
221 break;
222 }
223 }
224 #endif
225
226 // VS: destroy children first and _then_ detach *this from its parent.
227 // If we'd do it the other way around, children wouldn't be able
228 // find their parent frame (see above).
229 DestroyChildren();
230
231 if ( m_parent )
232 m_parent->RemoveChild(this);
233
234 if ( m_wnd )
235 MGL_wmDestroyWindow(m_wnd);
236 }
237
238 // real construction (Init() must have been called before!)
239 bool wxWindowMGL::Create(wxWindow *parent,
240 wxWindowID id,
241 const wxPoint& pos,
242 const wxSize& size,
243 long style,
244 const wxString& name)
245 {
246 // FIXME_MGL -- temporary!
247 //wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") );
248
249 if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
250 return FALSE;
251
252 if ( parent ) // FIXME_MGL temporary
253 parent->AddChild(this);
254 else
255 m_isShown=FALSE;// FIXME_MGL -- temporary, simulates wxTLW/wxFrame
256
257 if ( style & wxPOPUP_WINDOW )
258 {
259 // it is created hidden as other top level windows
260 m_isShown = FALSE;
261 }
262
263 m_wnd = MGL_wmCreateWindow(g_winMng,
264 parent ? parent->GetHandle() : NULL,
265 pos.x, pos.y, size.x, size.y);
266 MGL_wmShowWindow(m_wnd, m_isShown);
267 MGL_wmSetWindowUserData(m_wnd, (void*) this);
268 MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
269 return TRUE;
270 }
271
272 // ---------------------------------------------------------------------------
273 // basic operations
274 // ---------------------------------------------------------------------------
275
276 void wxWindowMGL::SetFocus()
277 {
278 if (g_focusedWindow)
279 g_focusedWindow->KillFocus();
280
281 g_focusedWindow = this;
282
283 MGL_wmCaptureEvents(GetHandle(), EVT_KEYEVT | EVT_JOYEVT, wxMGL_CAPTURE_KEYB);
284
285 #if wxUSE_CARET
286 // caret needs to be informed about focus change
287 wxCaret *caret = GetCaret();
288 if (caret)
289 caret->OnSetFocus();
290 #endif // wxUSE_CARET
291
292 if (IsTopLevel())
293 {
294 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId());
295 event.SetEventObject(this);
296 GetEventHandler()->ProcessEvent(event);
297 }
298
299 wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
300 event.SetEventObject(this);
301 GetEventHandler()->ProcessEvent(event);
302 }
303
304 void wxWindowMGL::KillFocus()
305 {
306 if ( g_focusedWindow != this ) return;
307 g_focusedWindow = NULL;
308
309 if ( m_isBeingDeleted ) return;
310
311 MGL_wmUncaptureEvents(GetHandle(), wxMGL_CAPTURE_KEYB);
312
313 #if wxUSE_CARET
314 // caret needs to be informed about focus change
315 wxCaret *caret = GetCaret();
316 if ( caret )
317 caret->OnKillFocus();
318 #endif // wxUSE_CARET
319
320 if ( IsTopLevel() )
321 {
322 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId());
323 event.SetEventObject(this);
324 GetEventHandler()->ProcessEvent(event);
325 }
326
327 wxFocusEvent event(wxEVT_KILL_FOCUS, GetId());
328 event.SetEventObject(this);
329 GetEventHandler()->ProcessEvent(event);
330 }
331
332 // ----------------------------------------------------------------------------
333 // this wxWindowBase function is implemented here (in platform-specific file)
334 // because it is static and so couldn't be made virtual
335 // ----------------------------------------------------------------------------
336 wxWindow *wxWindowBase::FindFocus()
337 {
338 return (wxWindow*)g_focusedWindow;
339 }
340
341 bool wxWindowMGL::Show(bool show)
342 {
343 if ( !wxWindowBase::Show(show) )
344 return FALSE;
345
346 MGL_wmShowWindow(m_wnd, show);
347 return TRUE;
348 }
349
350 // Raise the window to the top of the Z order
351 void wxWindowMGL::Raise()
352 {
353 MGL_wmRaiseWindow(m_wnd);
354 }
355
356 // Lower the window to the bottom of the Z order
357 void wxWindowMGL::Lower()
358 {
359 MGL_wmLowerWindow(m_wnd);
360 }
361
362 void wxWindowMGL::CaptureMouse()
363 {
364 MGL_wmCaptureEvents(m_wnd, EVT_MOUSEEVT, wxMGL_CAPTURE_MOUSE);
365 }
366
367 void wxWindowMGL::ReleaseMouse()
368 {
369 MGL_wmUncaptureEvents(m_wnd, wxMGL_CAPTURE_MOUSE);
370 }
371
372 /* static */ wxWindow *wxWindowBase::GetCapture()
373 {
374 for (captureentry_t *c = g_winMng->capturedEvents; c; c = c->next)
375 {
376 if ( c->id == wxMGL_CAPTURE_MOUSE )
377 return (wxWindow*)c->wnd->userData;
378 }
379 return NULL;
380 }
381
382 bool wxWindowMGL::SetCursor(const wxCursor& cursor)
383 {
384 if ( !wxWindowBase::SetCursor(cursor) )
385 {
386 // no change
387 return FALSE;
388 }
389
390 if ( m_cursor.Ok() )
391 MGL_wmSetWindowCursor(m_wnd, *m_cursor.GetMGLCursor());
392
393 return TRUE;
394 }
395
396 void wxWindowMGL::WarpPointer(int x, int y)
397 {
398 ClientToScreen(&x, &y);
399 EVT_setMousePos(x, y);
400 }
401
402 #if WXWIN_COMPATIBILITY
403 // If nothing defined for this, try the parent.
404 // E.g. we may be a button loaded from a resource, with no callback function
405 // defined.
406 void wxWindowMGL::OnCommand(wxWindow& win, wxCommandEvent& event)
407 {
408 if ( GetEventHandler()->ProcessEvent(event) )
409 return;
410 if ( m_parent )
411 m_parent->GetEventHandler()->OnCommand(win, event);
412 }
413 #endif // WXWIN_COMPATIBILITY_2
414
415 #if WXWIN_COMPATIBILITY
416 wxObject* wxWindowMGL::GetChild(int number) const
417 {
418 // Return a pointer to the Nth object in the Panel
419 wxNode *node = GetChildren().First();
420 int n = number;
421 while (node && n--)
422 node = node->Next();
423 if ( node )
424 {
425 wxObject *obj = (wxObject *)node->Data();
426 return(obj);
427 }
428 else
429 return NULL;
430 }
431 #endif // WXWIN_COMPATIBILITY
432
433 // Set this window to be the child of 'parent'.
434 bool wxWindowMGL::Reparent(wxWindowBase *parent)
435 {
436 if ( !wxWindowBase::Reparent(parent) )
437 return FALSE;
438
439 MGL_wmReparentWindow(m_wnd, parent->GetHandle());
440
441 return TRUE;
442 }
443
444
445 // ---------------------------------------------------------------------------
446 // drag and drop
447 // ---------------------------------------------------------------------------
448
449 #if wxUSE_DRAG_AND_DROP
450
451 void wxWindowMGL::SetDropTarget(wxDropTarget *pDropTarget)
452 {
453 if ( m_dropTarget != 0 ) {
454 m_dropTarget->Revoke(m_hWnd);
455 delete m_dropTarget;
456 }
457
458 m_dropTarget = pDropTarget;
459 if ( m_dropTarget != 0 )
460 m_dropTarget->Register(m_hWnd);
461 }
462 // FIXME_MGL
463 #endif // wxUSE_DRAG_AND_DROP
464
465 // old style file-manager drag&drop support: we retain the old-style
466 // DragAcceptFiles in parallel with SetDropTarget.
467 void wxWindowMGL::DragAcceptFiles(bool accept)
468 {
469 #if 0 // FIXME_MGL
470 HWND hWnd = GetHwnd();
471 if ( hWnd )
472 ::DragAcceptFiles(hWnd, (BOOL)accept);
473 #endif
474 }
475
476 // ---------------------------------------------------------------------------
477 // moving and resizing
478 // ---------------------------------------------------------------------------
479
480 // Get total size
481 void wxWindowMGL::DoGetSize(int *x, int *y) const
482 {
483 if (x) *x = m_wnd->width;
484 if (y) *y = m_wnd->height;
485 }
486
487 void wxWindowMGL::DoGetPosition(int *x, int *y) const
488 {
489 if (x) *x = m_wnd->x;
490 if (y) *y = m_wnd->y;
491 }
492
493 void wxWindowMGL::DoScreenToClient(int *x, int *y) const
494 {
495 int ax, ay;
496 wxPoint co = GetClientAreaOrigin();
497
498 MGL_wmCoordGlobalToLocal(m_wnd, m_wnd->x, m_wnd->y, &ax, &ay);
499 ax -= co.x;
500 ay -= co.y;
501 if (x)
502 *x = ax;
503 if (y)
504 *y = ay;
505 }
506
507 void wxWindowMGL::DoClientToScreen(int *x, int *y) const
508 {
509 int ax, ay;
510 wxPoint co = GetClientAreaOrigin();
511
512 MGL_wmCoordGlobalToLocal(m_wnd, m_wnd->x+co.x, m_wnd->y+co.y, &ax, &ay);
513 if (x)
514 *x = ax;
515 if (y)
516 *y = ay;
517 }
518
519 // Get size *available for subwindows* i.e. excluding menu bar etc.
520 void wxWindowMGL::DoGetClientSize(int *x, int *y) const
521 {
522 DoGetSize(x, y);
523 }
524
525 void wxWindowMGL::DoMoveWindow(int x, int y, int width, int height)
526 {
527 MGL_wmSetWindowPosition(GetHandle(), x, y, width, height);
528 }
529
530 // set the size of the window: if the dimensions are positive, just use them,
531 // but if any of them is equal to -1, it means that we must find the value for
532 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
533 // which case -1 is a valid value for x and y)
534 //
535 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
536 // the width/height to best suit our contents, otherwise we reuse the current
537 // width/height
538 void wxWindowMGL::DoSetSize(int x, int y, int width, int height, int sizeFlags)
539 {
540 // get the current size and position...
541 int currentX, currentY;
542 GetPosition(&currentX, &currentY);
543 int currentW,currentH;
544 GetSize(&currentW, &currentH);
545
546 // ... and don't do anything (avoiding flicker) if it's already ok
547 if ( x == currentX && y == currentY &&
548 width == currentW && height == currentH )
549 {
550 return;
551 }
552
553 if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
554 x = currentX;
555 if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
556 y = currentY;
557
558 #if 0 // FIXME_MGL -- what's this good for?
559 AdjustForParentClientOrigin(x, y, sizeFlags);
560 #endif
561
562 wxSize size(-1, -1);
563 if ( width == -1 )
564 {
565 if ( sizeFlags & wxSIZE_AUTO_WIDTH )
566 {
567 size = DoGetBestSize();
568 width = size.x;
569 }
570 else
571 {
572 // just take the current one
573 width = currentW;
574 }
575 }
576
577 if ( height == -1 )
578 {
579 if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
580 {
581 if ( size.x == -1 )
582 {
583 size = DoGetBestSize();
584 }
585 //else: already called DoGetBestSize() above
586
587 height = size.y;
588 }
589 else
590 {
591 // just take the current one
592 height = currentH;
593 }
594 }
595
596 DoMoveWindow(x, y, width, height);
597
598 wxSizeEvent event(wxSize(width, height), GetId());
599 event.SetEventObject(this);
600 GetEventHandler()->ProcessEvent(event);
601 }
602
603 void wxWindowMGL::DoSetClientSize(int width, int height)
604 {
605 SetSize(width, height);
606 }
607
608 // ---------------------------------------------------------------------------
609 // text metrics
610 // ---------------------------------------------------------------------------
611
612 int wxWindowMGL::GetCharHeight() const
613 {
614 wxScreenDC dc;
615 dc.SetFont(m_font);
616 return dc.GetCharHeight();
617 }
618
619 int wxWindowMGL::GetCharWidth() const
620 {
621 wxScreenDC dc;
622 dc.SetFont(m_font);
623 return dc.GetCharWidth();
624 }
625
626 void wxWindowMGL::GetTextExtent(const wxString& string,
627 int *x, int *y,
628 int *descent, int *externalLeading,
629 const wxFont *theFont) const
630 {
631 wxScreenDC dc;
632 if (!theFont)
633 theFont = &m_font;
634 dc.GetTextExtent(string, x, y, descent, externalLeading, (wxFont*)theFont);
635 }
636
637 #if wxUSE_CARET && WXWIN_COMPATIBILITY
638 // ---------------------------------------------------------------------------
639 // Caret manipulation
640 // ---------------------------------------------------------------------------
641
642 void wxWindowMGL::CreateCaret(int w, int h)
643 {
644 SetCaret(new wxCaret(this, w, h));
645 }
646
647 void wxWindowMGL::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
648 {
649 wxFAIL_MSG("not implemented");
650 }
651
652 void wxWindowMGL::ShowCaret(bool show)
653 {
654 wxCHECK_RET( m_caret, "no caret to show" );
655
656 m_caret->Show(show);
657 }
658
659 void wxWindowMGL::DestroyCaret()
660 {
661 SetCaret(NULL);
662 }
663
664 void wxWindowMGL::SetCaretPos(int x, int y)
665 {
666 wxCHECK_RET( m_caret, "no caret to move" );
667
668 m_caret->Move(x, y);
669 }
670
671 void wxWindowMGL::GetCaretPos(int *x, int *y) const
672 {
673 wxCHECK_RET( m_caret, "no caret to get position of" );
674
675 m_caret->GetPosition(x, y);
676 }
677 #endif // wxUSE_CARET
678
679
680 // ---------------------------------------------------------------------------
681 // painting
682 // ---------------------------------------------------------------------------
683
684 void wxWindowMGL::Clear()
685 {
686 wxClientDC dc((wxWindow *)this);
687 wxBrush brush(GetBackgroundColour(), wxSOLID);
688 dc.SetBackground(brush);
689 dc.Clear();
690 }
691
692 void wxWindowMGL::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
693 {
694 if ( rect )
695 {
696 rect_t r;
697 r.left = rect->GetLeft(), r.right = rect->GetRight();
698 r.top = rect->GetTop(), r.bottom = rect->GetBottom();
699 MGL_wmInvalidateWindowRect(GetHandle(), &r);
700 }
701 else
702 MGL_wmInvalidateWindow(GetHandle());
703 }
704
705 void wxWindowMGL::Update()
706 {
707 if ( !m_frozen )
708 MGL_wmUpdateDC(g_winMng);
709 }
710
711 void wxWindowMGL::Freeze()
712 {
713 m_frozen = TRUE;
714 m_refreshAfterThaw = FALSE;
715 }
716
717 void wxWindowMGL::Thaw()
718 {
719 m_frozen = FALSE;
720 if ( m_refreshAfterThaw )
721 Refresh();
722 }
723
724 void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
725 {
726 if ( m_frozen )
727 {
728 // Don't paint anything if the window is frozen.
729 m_refreshAfterThaw = TRUE;
730 return;
731 }
732
733 MGLRegion clip;
734 dc->getClipRegion(clip);
735 m_updateRegion = wxRegion(clip);
736 m_paintMGLDC = dc;
737
738 {
739 wxWindowDC dc((wxWindow*)this);
740 wxEraseEvent eventEr(m_windowId, &dc);
741 eventEr.SetEventObject(this);
742 GetEventHandler()->ProcessEvent(eventEr);
743 }
744
745 wxNcPaintEvent eventNc(GetId());
746 eventNc.SetEventObject(this);
747 GetEventHandler()->ProcessEvent(eventNc);
748
749 wxPaintEvent eventPt(GetId());
750 eventPt.SetEventObject(this);
751 GetEventHandler()->ProcessEvent(eventPt);
752
753 m_paintMGLDC = NULL;
754 m_updateRegion.Clear();
755 }
756
757
758 // Find the wxWindow at the current mouse position, returning the mouse
759 // position.
760 wxWindow* wxFindWindowAtPointer(wxPoint& pt)
761 {
762 return wxFindWindowAtPoint(pt = wxGetMousePosition());
763 }
764
765 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
766 {
767 window_t *wnd = MGL_wmGetWindowAtPosition(g_winMng, pt.x, pt.y);
768 return (wxWindow*)wnd->userData;
769 }