]>
Commit | Line | Data |
---|---|---|
32b8ec41 | 1 | ///////////////////////////////////////////////////////////////////////////// |
a4bbc9f7 VS |
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 | |
32b8ec41 VZ |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
a4bbc9f7 VS |
11 | // =========================================================================== |
12 | // declarations | |
13 | // =========================================================================== | |
14 | ||
15 | // --------------------------------------------------------------------------- | |
16 | // headers | |
17 | // --------------------------------------------------------------------------- | |
32b8ec41 VZ |
18 | |
19 | #ifdef __GNUG__ | |
20 | #pragma implementation "window.h" | |
21 | #endif | |
22 | ||
a4bbc9f7 VS |
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 | ||
2b260bc3 | 66 | // the window that has keyboard focus: |
7bdc1879 VS |
67 | static wxWindowMGL *g_focusedWindow = NULL; |
68 | // the window that is currently under mouse cursor: | |
69 | static wxWindowMGL *g_windowUnderMouse = NULL; | |
a4bbc9f7 VS |
70 | |
71 | // --------------------------------------------------------------------------- | |
72 | // constants | |
73 | // --------------------------------------------------------------------------- | |
74 | ||
75 | // Custom identifiers used to distinguish between various event handlers | |
76 | // and capture handlers passed to MGL_wm | |
77 | enum | |
78 | { | |
79 | wxMGL_CAPTURE_MOUSE = 1, | |
80 | wxMGL_CAPTURE_KEYB = 2 | |
81 | }; | |
82 | ||
83 | ||
84 | // --------------------------------------------------------------------------- | |
85 | // private functions | |
86 | // --------------------------------------------------------------------------- | |
87 | ||
a4bbc9f7 VS |
88 | // wxCreateMGL_WM creates MGL display DC and associates it with winmng_t |
89 | // structure. Dimensions and depth of the DC are fetched from wxSystemOptions | |
90 | // object. | |
91 | // This function is *not* called from wxApp's initialization but rather at | |
92 | // the time when WM is needed, i.e. when first wxWindow is created. This | |
93 | // has two important effects: | |
94 | // a) it is possible to write windowless wxMGL apps | |
95 | // b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions | |
96 | // with desired settings | |
97 | ||
fd495ab3 | 98 | // FIXME_MGL -- move to app.cpp?? |
ef344ff8 VS |
99 | static void wxDesktopPainter(window_t *wnd, MGLDC *dc) |
100 | { | |
101 | // FIXME_MGL - for now... | |
102 | MGL_setColorRGB(0x63, 0x63, 0x96); | |
103 | MGL_fillRectCoord(0, 0, wnd->width, wnd->height); | |
104 | } | |
105 | ||
106 | ||
a4bbc9f7 VS |
107 | bool wxCreateMGL_WM() |
108 | { | |
109 | int mode; | |
110 | int width = 640, height = 480, depth = 16; | |
111 | int refresh = MGL_DEFAULT_REFRESH; | |
112 | ||
113 | #if wxUSE_SYSTEM_OPTIONS | |
ef344ff8 | 114 | // FIXME_MGL -- so what is The Proper Way? |
a4bbc9f7 VS |
115 | if ( wxSystemOptions::HasOption(wxT("mgl.screen-width") ) |
116 | width = wxSystemOptions::GetOptionInt(wxT("mgl.screen-width")); | |
117 | if ( wxSystemOptions::HasOption(wxT("mgl.screen-height") ) | |
118 | height = wxSystemOptions::GetOptionInt(wxT("mgl.screen-height")); | |
119 | if ( wxSystemOptions::HasOption(wxT("mgl.screen-depth") ) | |
120 | depth = wxSystemOptions::GetOptionInt(wxT("mgl.screen-depth")); | |
121 | if ( wxSystemOptions::HasOption(wxT("mgl.screen-refresh") ) | |
122 | refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh")); | |
123 | #endif | |
124 | ||
125 | mode = MGL_findMode(width, height, depth); | |
126 | if ( mode == -1 ) | |
127 | { | |
128 | wxLogWarning(_("Mode %ix%i-%i not available, falling back to default mode."), width, height, depth); | |
129 | mode = 0; // always available | |
130 | } | |
131 | g_displayDC = new MGLDisplayDC(mode, 1, refresh); | |
132 | if ( !g_displayDC->isValid() ) | |
133 | { | |
134 | delete g_displayDC; | |
135 | g_displayDC = NULL; | |
136 | return FALSE; | |
137 | } | |
138 | ||
139 | g_winMng = MGL_wmCreate(g_displayDC->getDC()); | |
140 | if (!g_winMng) | |
141 | return FALSE; | |
ef344ff8 VS |
142 | |
143 | MGL_wmSetWindowPainter(MGL_wmGetRootWindow(g_winMng), wxDesktopPainter); | |
a4bbc9f7 VS |
144 | |
145 | return TRUE; | |
146 | } | |
147 | ||
148 | void wxDestroyMGL_WM() | |
149 | { | |
7bdc1879 | 150 | if ( g_winMng ) |
a4bbc9f7 VS |
151 | { |
152 | MGL_wmDestroy(g_winMng); | |
153 | g_winMng = NULL; | |
154 | } | |
7bdc1879 VS |
155 | if ( g_displayDC ) |
156 | { | |
157 | delete g_displayDC; | |
158 | g_displayDC = NULL; | |
159 | } | |
a4bbc9f7 VS |
160 | } |
161 | ||
7bdc1879 VS |
162 | // --------------------------------------------------------------------------- |
163 | // MGL_WM hooks: | |
164 | // --------------------------------------------------------------------------- | |
165 | ||
166 | static void wxWindowPainter(window_t *wnd, MGLDC *dc) | |
167 | { | |
168 | wxWindowMGL *w = (wxWindow*) wnd->userData; | |
544c782d | 169 | if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) ) |
7bdc1879 VS |
170 | { |
171 | MGLDevCtx ctx(dc); | |
172 | w->HandlePaint(&ctx); | |
173 | } | |
ef344ff8 VS |
174 | // FIXME_MGL -- root window should be a regular window so that |
175 | // enter/leave and activate/deactivate events work correctly | |
176 | } | |
177 | ||
178 | static ibool wxWindowMouseHandler(window_t *wnd, event_t *e) | |
179 | { | |
180 | wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); | |
985520bc | 181 | wxPoint where; |
ef344ff8 | 182 | |
985520bc VS |
183 | MGL_wmCoordGlobalToLocal(win->GetHandle(), |
184 | e->where_x, e->where_y, &where.x, &where.y); | |
185 | ||
a200c35e VS |
186 | if ( !win->IsEnabled() ) return FALSE; |
187 | ||
ef344ff8 VS |
188 | wxEventType type = wxEVT_NULL; |
189 | wxMouseEvent event; | |
190 | event.SetEventObject(win); | |
191 | event.SetTimestamp(e->when); | |
192 | event.m_x = where.x; | |
193 | event.m_y = where.y; | |
194 | event.m_shiftDown = e->modifiers & EVT_SHIFTKEY; | |
195 | event.m_controlDown = e->modifiers & EVT_CTRLSTATE; | |
196 | event.m_altDown = e->modifiers & EVT_LEFTALT; | |
197 | event.m_metaDown = e->modifiers & EVT_RIGHTALT; | |
198 | event.m_leftDown = e->modifiers & EVT_LEFTBUT; | |
199 | event.m_middleDown = e->modifiers & EVT_MIDDLEBUT; | |
200 | event.m_rightDown = e->modifiers & EVT_RIGHTBUT; | |
201 | ||
202 | switch (e->what) | |
203 | { | |
204 | case EVT_MOUSEDOWN: | |
205 | if ( e->message & EVT_LEFTBMASK ) | |
206 | type = (e->message & EVT_DBLCLICK) ? | |
207 | wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN; | |
208 | else if ( e->message & EVT_MIDDLEBMASK ) | |
209 | type = (e->message & EVT_DBLCLICK) ? | |
210 | wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN; | |
211 | else if ( e->message & EVT_RIGHTBMASK ) | |
212 | type = (e->message & EVT_DBLCLICK) ? | |
213 | wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN; | |
214 | break; | |
215 | ||
216 | case EVT_MOUSEUP: | |
217 | if ( e->message & EVT_LEFTBMASK ) | |
218 | type = wxEVT_LEFT_UP; | |
219 | else if ( e->message & EVT_MIDDLEBMASK ) | |
220 | type = wxEVT_MIDDLE_UP; | |
221 | else if ( e->message & EVT_RIGHTBMASK ) | |
222 | type = wxEVT_RIGHT_UP; | |
223 | break; | |
224 | ||
225 | case EVT_MOUSEMOVE: | |
226 | if ( win != g_windowUnderMouse ) | |
227 | { | |
228 | if ( g_windowUnderMouse ) | |
229 | { | |
230 | wxMouseEvent event2(event); | |
985520bc VS |
231 | MGL_wmCoordGlobalToLocal(g_windowUnderMouse->GetHandle(), |
232 | e->where_x, e->where_y, | |
233 | &event2.m_x, &event2.m_y); | |
234 | ||
ef344ff8 VS |
235 | event2.SetEventObject(g_windowUnderMouse); |
236 | event2.SetEventType(wxEVT_LEAVE_WINDOW); | |
237 | g_windowUnderMouse->GetEventHandler()->ProcessEvent(event2); | |
238 | } | |
239 | ||
240 | wxMouseEvent event3(event); | |
241 | event3.SetEventType(wxEVT_ENTER_WINDOW); | |
242 | win->GetEventHandler()->ProcessEvent(event3); | |
243 | ||
244 | g_windowUnderMouse = win; | |
245 | } | |
246 | ||
247 | type = wxEVT_MOTION; | |
248 | break; | |
249 | ||
250 | default: | |
251 | break; | |
252 | } | |
253 | ||
254 | if ( type == wxEVT_NULL ) | |
255 | { | |
256 | return FALSE; | |
257 | } | |
258 | else | |
259 | { | |
260 | event.SetEventType(type); | |
261 | return win->GetEventHandler()->ProcessEvent(event); | |
262 | } | |
263 | } | |
264 | ||
2b260bc3 | 265 | static long wxScanToKeyCode(event_t *event) |
ef344ff8 | 266 | { |
2b260bc3 VS |
267 | #define KEY(mgl,wx) case mgl: key = wx; break; |
268 | ||
269 | long key = 0; | |
270 | switch ( EVT_scanCode(event->message) ) | |
271 | { | |
272 | KEY (KB_padEnter, WXK_NUMPAD_ENTER) | |
273 | KEY (KB_padMinus, WXK_NUMPAD_SUBTRACT) | |
274 | KEY (KB_padPlus, WXK_NUMPAD_ADD) | |
275 | KEY (KB_padTimes, WXK_NUMPAD_MULTIPLY) | |
276 | KEY (KB_padDivide, WXK_NUMPAD_DIVIDE) | |
277 | KEY (KB_padLeft, WXK_NUMPAD_LEFT) | |
278 | KEY (KB_padRight, WXK_NUMPAD_RIGHT) | |
279 | KEY (KB_padUp, WXK_NUMPAD_UP) | |
280 | KEY (KB_padDown, WXK_NUMPAD_DOWN) | |
281 | KEY (KB_padInsert, WXK_NUMPAD_INSERT) | |
282 | KEY (KB_padDelete, WXK_NUMPAD_DELETE) | |
283 | KEY (KB_padHome, WXK_NUMPAD_HOME) | |
284 | KEY (KB_padEnd, WXK_NUMPAD_END) | |
285 | KEY (KB_padPageUp, WXK_NUMPAD_PAGEUP) | |
286 | //KEY (KB_padPageUp, WXK_NUMPAD_PRIOR) | |
287 | KEY (KB_padPageDown, WXK_NUMPAD_PAGEDOWN) | |
288 | //KEY (KB_padPageDown, WXK_NUMPAD_NEXT) | |
289 | KEY (KB_padCenter, WXK_NUMPAD_SEPARATOR) // ? | |
290 | KEY (KB_F1, WXK_F1) | |
291 | KEY (KB_F2, WXK_F2) | |
292 | KEY (KB_F3, WXK_F3) | |
293 | KEY (KB_F4, WXK_F4) | |
294 | KEY (KB_F5, WXK_F5) | |
295 | KEY (KB_F6, WXK_F6) | |
296 | KEY (KB_F7, WXK_F7) | |
297 | KEY (KB_F8, WXK_F8) | |
298 | KEY (KB_F9, WXK_F9) | |
299 | KEY (KB_F10, WXK_F10) | |
300 | KEY (KB_F11, WXK_F11) | |
301 | KEY (KB_F12, WXK_F12) | |
302 | KEY (KB_left, WXK_LEFT) | |
303 | KEY (KB_right, WXK_RIGHT) | |
304 | KEY (KB_up, WXK_UP) | |
305 | KEY (KB_down, WXK_DOWN) | |
306 | KEY (KB_insert, WXK_INSERT) | |
307 | KEY (KB_delete, WXK_DELETE) | |
308 | KEY (KB_home, WXK_HOME) | |
309 | KEY (KB_end, WXK_END) | |
310 | KEY (KB_pageUp, WXK_PAGEUP) | |
311 | KEY (KB_pageDown, WXK_PAGEDOWN) | |
312 | KEY (KB_capsLock, WXK_CAPITAL) | |
313 | KEY (KB_numLock, WXK_NUMLOCK) | |
314 | KEY (KB_scrollLock, WXK_SCROLL) | |
315 | KEY (KB_leftShift, WXK_SHIFT) | |
316 | KEY (KB_rightShift, WXK_SHIFT) | |
317 | KEY (KB_leftCtrl, WXK_CONTROL) | |
318 | KEY (KB_rightCtrl, WXK_CONTROL) | |
319 | KEY (KB_leftAlt, WXK_ALT) | |
320 | KEY (KB_rightAlt, WXK_ALT) | |
321 | KEY (KB_leftWindows, WXK_START) | |
322 | KEY (KB_rightWindows, WXK_START) | |
323 | KEY (KB_menu, WXK_MENU) | |
324 | KEY (KB_sysReq, WXK_SNAPSHOT) | |
325 | KEY (KB_esc, WXK_ESCAPE) | |
326 | KEY (KB_1, '1') | |
327 | KEY (KB_2, '2') | |
328 | KEY (KB_3, '3') | |
329 | KEY (KB_4, '4') | |
330 | KEY (KB_5, '5') | |
331 | KEY (KB_6, '6') | |
332 | KEY (KB_7, '7') | |
333 | KEY (KB_8, '8') | |
334 | KEY (KB_9, '9') | |
335 | KEY (KB_0, '0') | |
336 | KEY (KB_minus, WXK_SUBTRACT) | |
337 | KEY (KB_equals, WXK_ADD) | |
338 | KEY (KB_backSlash, '\\') | |
339 | KEY (KB_backspace, WXK_BACK) | |
340 | KEY (KB_tab, WXK_TAB) | |
341 | KEY (KB_Q, 'Q') | |
342 | KEY (KB_W, 'W') | |
343 | KEY (KB_E, 'E') | |
344 | KEY (KB_R, 'R') | |
345 | KEY (KB_T, 'T') | |
346 | KEY (KB_Y, 'Y') | |
347 | KEY (KB_U, 'U') | |
348 | KEY (KB_I, 'I') | |
349 | KEY (KB_O, 'O') | |
350 | KEY (KB_P, 'P') | |
351 | KEY (KB_leftSquareBrace,'[') | |
352 | KEY (KB_rightSquareBrace,']') | |
353 | KEY (KB_enter, WXK_RETURN) | |
354 | KEY (KB_A, 'A') | |
355 | KEY (KB_S, 'S') | |
356 | KEY (KB_D, 'D') | |
357 | KEY (KB_F, 'F') | |
358 | KEY (KB_G, 'G') | |
359 | KEY (KB_H, 'H') | |
360 | KEY (KB_J, 'J') | |
361 | KEY (KB_K, 'K') | |
362 | KEY (KB_L, 'L') | |
363 | KEY (KB_semicolon, ';') | |
364 | KEY (KB_apostrophe, '\'') | |
365 | KEY (KB_Z, 'Z') | |
366 | KEY (KB_X, 'X') | |
367 | KEY (KB_C, 'C') | |
368 | KEY (KB_V, 'V') | |
369 | KEY (KB_B, 'B') | |
370 | KEY (KB_N, 'N') | |
371 | KEY (KB_M, 'M') | |
372 | KEY (KB_comma, ',') | |
373 | KEY (KB_period, '.') | |
374 | KEY (KB_divide, WXK_DIVIDE) | |
375 | KEY (KB_space, WXK_SPACE) | |
376 | KEY (KB_tilde, '~') | |
377 | ||
378 | default: | |
379 | key = EVT_asciiCode(event->message); | |
380 | break; | |
381 | } | |
382 | ||
544c782d VS |
383 | #undef KEY |
384 | ||
2b260bc3 | 385 | return key; |
ef344ff8 VS |
386 | } |
387 | ||
2b260bc3 | 388 | static long wxAsciiToKeyCode(event_t *event) |
ef344ff8 | 389 | { |
2b260bc3 VS |
390 | return (long)EVT_asciiCode(event->message); |
391 | } | |
392 | ||
393 | static ibool wxWindowKeybHandler(window_t *wnd, event_t *e) | |
394 | { | |
2b260bc3 | 395 | wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); |
a200c35e VS |
396 | |
397 | if ( !win->IsEnabled() ) return FALSE; | |
398 | ||
985520bc VS |
399 | wxPoint where; |
400 | MGL_wmCoordGlobalToLocal(win->GetHandle(), | |
401 | e->where_x, e->where_y, &where.x, &where.y); | |
2b260bc3 VS |
402 | |
403 | wxKeyEvent event; | |
404 | event.SetEventObject(win); | |
405 | event.SetTimestamp(e->when); | |
406 | event.m_keyCode = wxScanToKeyCode(e); | |
407 | event.m_scanCode = 0; // not used by wx at all | |
408 | event.m_x = where.x; | |
409 | event.m_y = where.y; | |
2b260bc3 VS |
410 | event.m_shiftDown = e->modifiers & EVT_SHIFTKEY; |
411 | event.m_controlDown = e->modifiers & EVT_CTRLSTATE; | |
412 | event.m_altDown = e->modifiers & EVT_LEFTALT; | |
413 | event.m_metaDown = e->modifiers & EVT_RIGHTALT; | |
414 | ||
415 | if ( e->what == EVT_KEYUP ) | |
416 | { | |
417 | event.SetEventType(wxEVT_KEY_UP); | |
418 | return win->GetEventHandler()->ProcessEvent(event); | |
419 | } | |
420 | else | |
421 | { | |
422 | bool ret; | |
423 | wxKeyEvent event2; | |
424 | ||
425 | event.SetEventType(wxEVT_KEY_DOWN); | |
426 | event2 = event; | |
427 | ||
428 | ret = win->GetEventHandler()->ProcessEvent(event); | |
429 | ||
430 | #if wxUSE_ACCEL | |
431 | if ( !ret ) | |
432 | { | |
433 | for (wxWindowMGL *w = win; w; w = w->GetParent()) | |
434 | { | |
435 | int command = w->GetAcceleratorTable()->GetCommand(event); | |
436 | if ( command != -1 ) | |
437 | { | |
438 | wxCommandEvent eventc(wxEVT_COMMAND_MENU_SELECTED, command); | |
439 | ret = w->GetEventHandler()->ProcessEvent(eventc); | |
440 | break; | |
441 | } | |
442 | if ( w->IsTopLevel() ) | |
443 | break; | |
444 | } | |
445 | } | |
446 | #endif // wxUSE_ACCEL | |
447 | ||
448 | /* wxMSW doesn't send char events with Alt pressed */ | |
449 | /* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x | |
450 | will only be sent if it is not in an accelerator table. */ | |
451 | event2.m_keyCode = wxAsciiToKeyCode(e); | |
452 | if ( !ret && event2.m_keyCode != 0 ) | |
453 | { | |
454 | event2.SetEventType(wxEVT_CHAR); | |
455 | ret = win->GetEventHandler()->ProcessEvent(event2); | |
456 | } | |
457 | ||
458 | return ret; | |
459 | } | |
7bdc1879 | 460 | } |
a4bbc9f7 VS |
461 | |
462 | // --------------------------------------------------------------------------- | |
463 | // event tables | |
464 | // --------------------------------------------------------------------------- | |
465 | ||
ef344ff8 | 466 | // in wxUniv this class is abstract because it doesn't have DoPopupMenu() |
a4bbc9f7 VS |
467 | IMPLEMENT_ABSTRACT_CLASS(wxWindowMGL, wxWindowBase) |
468 | ||
469 | BEGIN_EVENT_TABLE(wxWindowMGL, wxWindowBase) | |
a4bbc9f7 VS |
470 | END_EVENT_TABLE() |
471 | ||
472 | // =========================================================================== | |
473 | // implementation | |
474 | // =========================================================================== | |
475 | ||
476 | // ---------------------------------------------------------------------------- | |
477 | // constructors and such | |
478 | // ---------------------------------------------------------------------------- | |
479 | ||
480 | void wxWindowMGL::Init() | |
481 | { | |
482 | // generic: | |
483 | InitBase(); | |
484 | ||
485 | // mgl specific: | |
a4bbc9f7 VS |
486 | m_wnd = NULL; |
487 | m_isShown = TRUE; | |
488 | m_isBeingDeleted = FALSE; | |
489 | m_isEnabled = TRUE; | |
490 | m_frozen = FALSE; | |
491 | m_paintMGLDC = NULL; | |
2b260bc3 | 492 | m_eraseBackground = -1; |
a4bbc9f7 VS |
493 | } |
494 | ||
495 | // Destructor | |
496 | wxWindowMGL::~wxWindowMGL() | |
497 | { | |
498 | m_isBeingDeleted = TRUE; | |
499 | ||
500 | if ( g_focusedWindow == this ) | |
7bdc1879 | 501 | KillFocus(); |
ef344ff8 VS |
502 | if ( g_windowUnderMouse == this ) |
503 | g_windowUnderMouse = NULL; | |
a4bbc9f7 VS |
504 | |
505 | // VS: destroy children first and _then_ detach *this from its parent. | |
506 | // If we'd do it the other way around, children wouldn't be able | |
507 | // find their parent frame (see above). | |
508 | DestroyChildren(); | |
509 | ||
510 | if ( m_parent ) | |
511 | m_parent->RemoveChild(this); | |
512 | ||
513 | if ( m_wnd ) | |
514 | MGL_wmDestroyWindow(m_wnd); | |
515 | } | |
516 | ||
517 | // real construction (Init() must have been called before!) | |
518 | bool wxWindowMGL::Create(wxWindow *parent, | |
519 | wxWindowID id, | |
520 | const wxPoint& pos, | |
521 | const wxSize& size, | |
522 | long style, | |
523 | const wxString& name) | |
524 | { | |
a4bbc9f7 VS |
525 | if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) |
526 | return FALSE; | |
527 | ||
544c782d | 528 | if ( parent ) |
7bdc1879 | 529 | parent->AddChild(this); |
a4bbc9f7 | 530 | |
ef344ff8 VS |
531 | int x, y, w, h; |
532 | x = pos.x, y = pos.y; | |
533 | if ( x == -1 ) | |
534 | x = 0; // FIXME_MGL, something better, see GTK+ | |
535 | if ( y == -1 ) | |
536 | y = 0; // FIXME_MGL, something better, see GTK+ | |
537 | w = WidthDefault(size.x); | |
538 | h = HeightDefault(size.y); | |
72fa862b VS |
539 | |
540 | long mgl_style = 0; | |
544c782d | 541 | |
72fa862b | 542 | if ( !(style & wxNO_FULL_REPAINT_ON_RESIZE) ) |
544c782d | 543 | { |
72fa862b | 544 | mgl_style |= MGL_WM_FULL_REPAINT_ON_RESIZE; |
544c782d | 545 | } |
72fa862b | 546 | if ( style & wxSTAY_ON_TOP ) |
544c782d | 547 | { |
72fa862b | 548 | mgl_style |= MGL_WM_ALWAYS_ON_TOP; |
544c782d VS |
549 | } |
550 | if ( style & wxPOPUP_WINDOW ) | |
551 | { | |
552 | mgl_style |= MGL_WM_ALWAYS_ON_TOP; | |
553 | // it is created hidden as other top level windows | |
554 | m_isShown = FALSE; | |
555 | } | |
ef344ff8 | 556 | |
a4bbc9f7 VS |
557 | m_wnd = MGL_wmCreateWindow(g_winMng, |
558 | parent ? parent->GetHandle() : NULL, | |
ef344ff8 VS |
559 | x, y, w, h); |
560 | ||
72fa862b | 561 | MGL_wmSetWindowFlags(m_wnd, mgl_style); |
a4bbc9f7 VS |
562 | MGL_wmSetWindowUserData(m_wnd, (void*) this); |
563 | MGL_wmSetWindowPainter(m_wnd, wxWindowPainter); | |
ef344ff8 VS |
564 | MGL_wmShowWindow(m_wnd, m_isShown); |
565 | MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor()); | |
566 | ||
567 | MGL_wmPushWindowEventHandler(m_wnd, wxWindowMouseHandler, EVT_MOUSEEVT, 0); | |
568 | MGL_wmPushWindowEventHandler(m_wnd, wxWindowKeybHandler, EVT_KEYEVT, 0); | |
985520bc | 569 | |
a4bbc9f7 VS |
570 | return TRUE; |
571 | } | |
572 | ||
573 | // --------------------------------------------------------------------------- | |
574 | // basic operations | |
575 | // --------------------------------------------------------------------------- | |
576 | ||
577 | void wxWindowMGL::SetFocus() | |
578 | { | |
579 | if (g_focusedWindow) | |
580 | g_focusedWindow->KillFocus(); | |
581 | ||
582 | g_focusedWindow = this; | |
583 | ||
2b260bc3 | 584 | MGL_wmCaptureEvents(GetHandle(), EVT_KEYEVT, wxMGL_CAPTURE_KEYB); |
a4bbc9f7 | 585 | |
a4bbc9f7 VS |
586 | #if wxUSE_CARET |
587 | // caret needs to be informed about focus change | |
588 | wxCaret *caret = GetCaret(); | |
589 | if (caret) | |
590 | caret->OnSetFocus(); | |
591 | #endif // wxUSE_CARET | |
32b8ec41 | 592 | |
ef344ff8 | 593 | if ( IsTopLevel() ) |
a4bbc9f7 | 594 | { |
544c782d | 595 | // FIXME_MGL - this is wrong, see wxGTK! |
a4bbc9f7 VS |
596 | wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId()); |
597 | event.SetEventObject(this); | |
598 | GetEventHandler()->ProcessEvent(event); | |
599 | } | |
600 | ||
601 | wxFocusEvent event(wxEVT_SET_FOCUS, GetId()); | |
602 | event.SetEventObject(this); | |
603 | GetEventHandler()->ProcessEvent(event); | |
604 | } | |
32b8ec41 | 605 | |
a4bbc9f7 | 606 | void wxWindowMGL::KillFocus() |
32b8ec41 | 607 | { |
a4bbc9f7 VS |
608 | if ( g_focusedWindow != this ) return; |
609 | g_focusedWindow = NULL; | |
610 | ||
7bdc1879 VS |
611 | if ( m_isBeingDeleted ) return; |
612 | ||
a4bbc9f7 VS |
613 | MGL_wmUncaptureEvents(GetHandle(), wxMGL_CAPTURE_KEYB); |
614 | ||
615 | #if wxUSE_CARET | |
616 | // caret needs to be informed about focus change | |
617 | wxCaret *caret = GetCaret(); | |
7bdc1879 | 618 | if ( caret ) |
a4bbc9f7 VS |
619 | caret->OnKillFocus(); |
620 | #endif // wxUSE_CARET | |
621 | ||
7bdc1879 | 622 | if ( IsTopLevel() ) |
a4bbc9f7 | 623 | { |
544c782d | 624 | // FIXME_MGL - this is wrong, see wxGTK! |
a4bbc9f7 VS |
625 | wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); |
626 | event.SetEventObject(this); | |
627 | GetEventHandler()->ProcessEvent(event); | |
628 | } | |
629 | ||
630 | wxFocusEvent event(wxEVT_KILL_FOCUS, GetId()); | |
631 | event.SetEventObject(this); | |
632 | GetEventHandler()->ProcessEvent(event); | |
32b8ec41 VZ |
633 | } |
634 | ||
a4bbc9f7 VS |
635 | // ---------------------------------------------------------------------------- |
636 | // this wxWindowBase function is implemented here (in platform-specific file) | |
637 | // because it is static and so couldn't be made virtual | |
638 | // ---------------------------------------------------------------------------- | |
32b8ec41 VZ |
639 | wxWindow *wxWindowBase::FindFocus() |
640 | { | |
a4bbc9f7 VS |
641 | return (wxWindow*)g_focusedWindow; |
642 | } | |
643 | ||
644 | bool wxWindowMGL::Show(bool show) | |
645 | { | |
646 | if ( !wxWindowBase::Show(show) ) | |
647 | return FALSE; | |
648 | ||
649 | MGL_wmShowWindow(m_wnd, show); | |
650 | return TRUE; | |
651 | } | |
652 | ||
653 | // Raise the window to the top of the Z order | |
654 | void wxWindowMGL::Raise() | |
655 | { | |
656 | MGL_wmRaiseWindow(m_wnd); | |
657 | } | |
658 | ||
659 | // Lower the window to the bottom of the Z order | |
660 | void wxWindowMGL::Lower() | |
661 | { | |
662 | MGL_wmLowerWindow(m_wnd); | |
663 | } | |
664 | ||
665 | void wxWindowMGL::CaptureMouse() | |
666 | { | |
667 | MGL_wmCaptureEvents(m_wnd, EVT_MOUSEEVT, wxMGL_CAPTURE_MOUSE); | |
668 | } | |
669 | ||
670 | void wxWindowMGL::ReleaseMouse() | |
671 | { | |
672 | MGL_wmUncaptureEvents(m_wnd, wxMGL_CAPTURE_MOUSE); | |
673 | } | |
674 | ||
675 | /* static */ wxWindow *wxWindowBase::GetCapture() | |
676 | { | |
677 | for (captureentry_t *c = g_winMng->capturedEvents; c; c = c->next) | |
678 | { | |
679 | if ( c->id == wxMGL_CAPTURE_MOUSE ) | |
680 | return (wxWindow*)c->wnd->userData; | |
681 | } | |
682 | return NULL; | |
683 | } | |
684 | ||
685 | bool wxWindowMGL::SetCursor(const wxCursor& cursor) | |
686 | { | |
687 | if ( !wxWindowBase::SetCursor(cursor) ) | |
688 | { | |
689 | // no change | |
690 | return FALSE; | |
691 | } | |
692 | ||
693 | if ( m_cursor.Ok() ) | |
694 | MGL_wmSetWindowCursor(m_wnd, *m_cursor.GetMGLCursor()); | |
ef344ff8 VS |
695 | else |
696 | MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor()); | |
a4bbc9f7 VS |
697 | |
698 | return TRUE; | |
699 | } | |
700 | ||
701 | void wxWindowMGL::WarpPointer(int x, int y) | |
702 | { | |
703 | ClientToScreen(&x, &y); | |
704 | EVT_setMousePos(x, y); | |
705 | } | |
706 | ||
707 | #if WXWIN_COMPATIBILITY | |
708 | // If nothing defined for this, try the parent. | |
709 | // E.g. we may be a button loaded from a resource, with no callback function | |
710 | // defined. | |
711 | void wxWindowMGL::OnCommand(wxWindow& win, wxCommandEvent& event) | |
712 | { | |
713 | if ( GetEventHandler()->ProcessEvent(event) ) | |
714 | return; | |
715 | if ( m_parent ) | |
716 | m_parent->GetEventHandler()->OnCommand(win, event); | |
717 | } | |
718 | #endif // WXWIN_COMPATIBILITY_2 | |
719 | ||
720 | #if WXWIN_COMPATIBILITY | |
721 | wxObject* wxWindowMGL::GetChild(int number) const | |
722 | { | |
723 | // Return a pointer to the Nth object in the Panel | |
724 | wxNode *node = GetChildren().First(); | |
725 | int n = number; | |
726 | while (node && n--) | |
727 | node = node->Next(); | |
728 | if ( node ) | |
729 | { | |
730 | wxObject *obj = (wxObject *)node->Data(); | |
731 | return(obj); | |
732 | } | |
733 | else | |
734 | return NULL; | |
735 | } | |
736 | #endif // WXWIN_COMPATIBILITY | |
737 | ||
738 | // Set this window to be the child of 'parent'. | |
739 | bool wxWindowMGL::Reparent(wxWindowBase *parent) | |
740 | { | |
741 | if ( !wxWindowBase::Reparent(parent) ) | |
742 | return FALSE; | |
743 | ||
744 | MGL_wmReparentWindow(m_wnd, parent->GetHandle()); | |
745 | ||
746 | return TRUE; | |
747 | } | |
748 | ||
749 | ||
750 | // --------------------------------------------------------------------------- | |
751 | // drag and drop | |
752 | // --------------------------------------------------------------------------- | |
753 | ||
754 | #if wxUSE_DRAG_AND_DROP | |
755 | ||
756 | void wxWindowMGL::SetDropTarget(wxDropTarget *pDropTarget) | |
757 | { | |
758 | if ( m_dropTarget != 0 ) { | |
759 | m_dropTarget->Revoke(m_hWnd); | |
760 | delete m_dropTarget; | |
761 | } | |
762 | ||
763 | m_dropTarget = pDropTarget; | |
764 | if ( m_dropTarget != 0 ) | |
765 | m_dropTarget->Register(m_hWnd); | |
766 | } | |
767 | // FIXME_MGL | |
768 | #endif // wxUSE_DRAG_AND_DROP | |
769 | ||
770 | // old style file-manager drag&drop support: we retain the old-style | |
771 | // DragAcceptFiles in parallel with SetDropTarget. | |
772 | void wxWindowMGL::DragAcceptFiles(bool accept) | |
773 | { | |
774 | #if 0 // FIXME_MGL | |
775 | HWND hWnd = GetHwnd(); | |
776 | if ( hWnd ) | |
777 | ::DragAcceptFiles(hWnd, (BOOL)accept); | |
778 | #endif | |
779 | } | |
780 | ||
781 | // --------------------------------------------------------------------------- | |
782 | // moving and resizing | |
783 | // --------------------------------------------------------------------------- | |
784 | ||
785 | // Get total size | |
786 | void wxWindowMGL::DoGetSize(int *x, int *y) const | |
787 | { | |
788 | if (x) *x = m_wnd->width; | |
789 | if (y) *y = m_wnd->height; | |
790 | } | |
791 | ||
792 | void wxWindowMGL::DoGetPosition(int *x, int *y) const | |
793 | { | |
794 | if (x) *x = m_wnd->x; | |
795 | if (y) *y = m_wnd->y; | |
796 | } | |
797 | ||
798 | void wxWindowMGL::DoScreenToClient(int *x, int *y) const | |
799 | { | |
800 | int ax, ay; | |
985520bc | 801 | MGL_wmCoordGlobalToLocal(m_wnd, 0, 0, &ax, &ay); |
a4bbc9f7 | 802 | if (x) |
985520bc | 803 | (*x) += ax; |
a4bbc9f7 | 804 | if (y) |
985520bc | 805 | (*y) += ay; |
a4bbc9f7 VS |
806 | } |
807 | ||
808 | void wxWindowMGL::DoClientToScreen(int *x, int *y) const | |
809 | { | |
810 | int ax, ay; | |
985520bc | 811 | MGL_wmCoordLocalToGlobal(m_wnd, 0, 0, &ax, &ay); |
a4bbc9f7 | 812 | if (x) |
985520bc | 813 | (*x) += ax; |
a4bbc9f7 | 814 | if (y) |
985520bc | 815 | (*y) += ay; |
a4bbc9f7 VS |
816 | } |
817 | ||
818 | // Get size *available for subwindows* i.e. excluding menu bar etc. | |
819 | void wxWindowMGL::DoGetClientSize(int *x, int *y) const | |
820 | { | |
821 | DoGetSize(x, y); | |
822 | } | |
823 | ||
824 | void wxWindowMGL::DoMoveWindow(int x, int y, int width, int height) | |
825 | { | |
826 | MGL_wmSetWindowPosition(GetHandle(), x, y, width, height); | |
827 | } | |
828 | ||
829 | // set the size of the window: if the dimensions are positive, just use them, | |
830 | // but if any of them is equal to -1, it means that we must find the value for | |
831 | // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in | |
832 | // which case -1 is a valid value for x and y) | |
833 | // | |
834 | // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate | |
835 | // the width/height to best suit our contents, otherwise we reuse the current | |
836 | // width/height | |
837 | void wxWindowMGL::DoSetSize(int x, int y, int width, int height, int sizeFlags) | |
838 | { | |
839 | // get the current size and position... | |
840 | int currentX, currentY; | |
841 | GetPosition(¤tX, ¤tY); | |
842 | int currentW,currentH; | |
843 | GetSize(¤tW, ¤tH); | |
844 | ||
845 | // ... and don't do anything (avoiding flicker) if it's already ok | |
846 | if ( x == currentX && y == currentY && | |
847 | width == currentW && height == currentH ) | |
848 | { | |
849 | return; | |
850 | } | |
851 | ||
852 | if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) | |
853 | x = currentX; | |
854 | if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) | |
855 | y = currentY; | |
856 | ||
a4bbc9f7 | 857 | AdjustForParentClientOrigin(x, y, sizeFlags); |
a4bbc9f7 VS |
858 | |
859 | wxSize size(-1, -1); | |
860 | if ( width == -1 ) | |
861 | { | |
862 | if ( sizeFlags & wxSIZE_AUTO_WIDTH ) | |
863 | { | |
864 | size = DoGetBestSize(); | |
865 | width = size.x; | |
866 | } | |
867 | else | |
868 | { | |
869 | // just take the current one | |
870 | width = currentW; | |
871 | } | |
872 | } | |
873 | ||
874 | if ( height == -1 ) | |
875 | { | |
876 | if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) | |
877 | { | |
878 | if ( size.x == -1 ) | |
879 | { | |
880 | size = DoGetBestSize(); | |
881 | } | |
882 | //else: already called DoGetBestSize() above | |
883 | ||
884 | height = size.y; | |
885 | } | |
886 | else | |
887 | { | |
888 | // just take the current one | |
889 | height = currentH; | |
890 | } | |
891 | } | |
892 | ||
893 | DoMoveWindow(x, y, width, height); | |
894 | ||
895 | wxSizeEvent event(wxSize(width, height), GetId()); | |
896 | event.SetEventObject(this); | |
897 | GetEventHandler()->ProcessEvent(event); | |
898 | } | |
899 | ||
900 | void wxWindowMGL::DoSetClientSize(int width, int height) | |
901 | { | |
902 | SetSize(width, height); | |
903 | } | |
904 | ||
905 | // --------------------------------------------------------------------------- | |
906 | // text metrics | |
907 | // --------------------------------------------------------------------------- | |
908 | ||
909 | int wxWindowMGL::GetCharHeight() const | |
910 | { | |
911 | wxScreenDC dc; | |
912 | dc.SetFont(m_font); | |
913 | return dc.GetCharHeight(); | |
914 | } | |
915 | ||
916 | int wxWindowMGL::GetCharWidth() const | |
917 | { | |
918 | wxScreenDC dc; | |
919 | dc.SetFont(m_font); | |
920 | return dc.GetCharWidth(); | |
921 | } | |
922 | ||
923 | void wxWindowMGL::GetTextExtent(const wxString& string, | |
924 | int *x, int *y, | |
925 | int *descent, int *externalLeading, | |
926 | const wxFont *theFont) const | |
927 | { | |
928 | wxScreenDC dc; | |
929 | if (!theFont) | |
930 | theFont = &m_font; | |
931 | dc.GetTextExtent(string, x, y, descent, externalLeading, (wxFont*)theFont); | |
932 | } | |
933 | ||
934 | #if wxUSE_CARET && WXWIN_COMPATIBILITY | |
935 | // --------------------------------------------------------------------------- | |
936 | // Caret manipulation | |
937 | // --------------------------------------------------------------------------- | |
938 | ||
939 | void wxWindowMGL::CreateCaret(int w, int h) | |
940 | { | |
941 | SetCaret(new wxCaret(this, w, h)); | |
942 | } | |
943 | ||
944 | void wxWindowMGL::CreateCaret(const wxBitmap *WXUNUSED(bitmap)) | |
945 | { | |
946 | wxFAIL_MSG("not implemented"); | |
947 | } | |
948 | ||
949 | void wxWindowMGL::ShowCaret(bool show) | |
950 | { | |
951 | wxCHECK_RET( m_caret, "no caret to show" ); | |
952 | ||
953 | m_caret->Show(show); | |
954 | } | |
955 | ||
956 | void wxWindowMGL::DestroyCaret() | |
957 | { | |
958 | SetCaret(NULL); | |
959 | } | |
960 | ||
961 | void wxWindowMGL::SetCaretPos(int x, int y) | |
962 | { | |
963 | wxCHECK_RET( m_caret, "no caret to move" ); | |
964 | ||
965 | m_caret->Move(x, y); | |
966 | } | |
967 | ||
968 | void wxWindowMGL::GetCaretPos(int *x, int *y) const | |
969 | { | |
970 | wxCHECK_RET( m_caret, "no caret to get position of" ); | |
971 | ||
972 | m_caret->GetPosition(x, y); | |
973 | } | |
974 | #endif // wxUSE_CARET | |
975 | ||
976 | ||
a4bbc9f7 VS |
977 | // --------------------------------------------------------------------------- |
978 | // painting | |
979 | // --------------------------------------------------------------------------- | |
980 | ||
981 | void wxWindowMGL::Clear() | |
982 | { | |
983 | wxClientDC dc((wxWindow *)this); | |
984 | wxBrush brush(GetBackgroundColour(), wxSOLID); | |
985 | dc.SetBackground(brush); | |
986 | dc.Clear(); | |
987 | } | |
988 | ||
2b260bc3 | 989 | void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect) |
a4bbc9f7 | 990 | { |
2b260bc3 VS |
991 | if ( m_eraseBackground == -1 ) |
992 | m_eraseBackground = eraseBack; | |
993 | else | |
994 | m_eraseBackground |= eraseBack; | |
995 | ||
a4bbc9f7 VS |
996 | if ( rect ) |
997 | { | |
998 | rect_t r; | |
999 | r.left = rect->GetLeft(), r.right = rect->GetRight(); | |
1000 | r.top = rect->GetTop(), r.bottom = rect->GetBottom(); | |
1001 | MGL_wmInvalidateWindowRect(GetHandle(), &r); | |
1002 | } | |
1003 | else | |
1004 | MGL_wmInvalidateWindow(GetHandle()); | |
1005 | } | |
1006 | ||
1007 | void wxWindowMGL::Update() | |
1008 | { | |
a4bbc9f7 VS |
1009 | if ( !m_frozen ) |
1010 | MGL_wmUpdateDC(g_winMng); | |
1011 | } | |
1012 | ||
1013 | void wxWindowMGL::Freeze() | |
1014 | { | |
1015 | m_frozen = TRUE; | |
1016 | m_refreshAfterThaw = FALSE; | |
1017 | } | |
1018 | ||
1019 | void wxWindowMGL::Thaw() | |
1020 | { | |
1021 | m_frozen = FALSE; | |
1022 | if ( m_refreshAfterThaw ) | |
1023 | Refresh(); | |
1024 | } | |
1025 | ||
a4bbc9f7 VS |
1026 | void wxWindowMGL::HandlePaint(MGLDevCtx *dc) |
1027 | { | |
1028 | if ( m_frozen ) | |
1029 | { | |
1030 | // Don't paint anything if the window is frozen. | |
fd495ab3 | 1031 | m_refreshAfterThaw = TRUE; |
a4bbc9f7 VS |
1032 | return; |
1033 | } | |
ef344ff8 | 1034 | |
fd495ab3 VS |
1035 | MGLRegion clip; |
1036 | dc->getClipRegion(clip); | |
1037 | m_updateRegion = wxRegion(clip); | |
a4bbc9f7 VS |
1038 | m_paintMGLDC = dc; |
1039 | ||
2b260bc3 | 1040 | if ( m_eraseBackground != 0 ) |
7bdc1879 | 1041 | { |
2b260bc3 VS |
1042 | wxWindowDC dc((wxWindow*)this); |
1043 | wxEraseEvent eventEr(m_windowId, &dc); | |
1044 | eventEr.SetEventObject(this); | |
1045 | GetEventHandler()->ProcessEvent(eventEr); | |
7bdc1879 | 1046 | } |
2b260bc3 | 1047 | m_eraseBackground = -1; |
a4bbc9f7 VS |
1048 | |
1049 | wxNcPaintEvent eventNc(GetId()); | |
1050 | eventNc.SetEventObject(this); | |
1051 | GetEventHandler()->ProcessEvent(eventNc); | |
1052 | ||
1053 | wxPaintEvent eventPt(GetId()); | |
1054 | eventPt.SetEventObject(this); | |
1055 | GetEventHandler()->ProcessEvent(eventPt); | |
a4bbc9f7 | 1056 | |
7bdc1879 | 1057 | m_paintMGLDC = NULL; |
fd495ab3 | 1058 | m_updateRegion.Clear(); |
a4bbc9f7 VS |
1059 | } |
1060 | ||
1061 | ||
1062 | // Find the wxWindow at the current mouse position, returning the mouse | |
1063 | // position. | |
1064 | wxWindow* wxFindWindowAtPointer(wxPoint& pt) | |
1065 | { | |
1066 | return wxFindWindowAtPoint(pt = wxGetMousePosition()); | |
1067 | } | |
1068 | ||
1069 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) | |
1070 | { | |
1071 | window_t *wnd = MGL_wmGetWindowAtPosition(g_winMng, pt.x, pt.y); | |
1072 | return (wxWindow*)wnd->userData; | |
32b8ec41 | 1073 | } |