]>
Commit | Line | Data |
---|---|---|
82c9f85c VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/toplevel.cpp | |
3 | // Purpose: implements wxTopLevelWindow for MSW | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 24.09.01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) | |
6c9a19aa | 9 | // License: wxWindows licence |
82c9f85c VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
14f355c2 | 20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
82c9f85c VZ |
21 | #pragma implementation "toplevel.h" |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #ifndef WX_PRECOMP | |
3a922bb4 RL |
32 | #include "wx/app.h" |
33 | #include "wx/toplevel.h" | |
28b68852 | 34 | #include "wx/dialog.h" |
82c9f85c VZ |
35 | #include "wx/string.h" |
36 | #include "wx/log.h" | |
37 | #include "wx/intl.h" | |
14dd645e | 38 | #include "wx/frame.h" |
706d74ab | 39 | #include "wx/containr.h" // wxSetFocusToChild() |
82c9f85c VZ |
40 | #endif //WX_PRECOMP |
41 | ||
2b5f62a0 VZ |
42 | #include "wx/module.h" |
43 | ||
82c9f85c | 44 | #include "wx/msw/private.h" |
80a81a12 JS |
45 | #if defined(__WXWINCE__) |
46 | #include <ole2.h> | |
47 | #include <shellapi.h> | |
3874e500 JS |
48 | // Standard SDK doesn't have aygshell.dll: see include/wx/msw/wince/libraries.h |
49 | #if _WIN32_WCE < 400 || !defined(WCE_PLATFORM_STANDARDSDK) | |
2d36b3d8 JS |
50 | #include <aygshell.h> |
51 | #endif | |
52 | #include "wx/msw/wince/missing.h" | |
80a81a12 JS |
53 | #endif |
54 | ||
d61c1a6f | 55 | #include "wx/msw/missing.h" |
4676948b JS |
56 | #include "wx/msw/winundef.h" |
57 | ||
716645d3 | 58 | #include "wx/display.h" |
7e25f59e | 59 | |
e121a72a MB |
60 | #ifndef ICON_BIG |
61 | #define ICON_BIG 1 | |
62 | #endif | |
63 | ||
64 | #ifndef ICON_SMALL | |
65 | #define ICON_SMALL 0 | |
66 | #endif | |
67 | ||
82c9f85c VZ |
68 | // ---------------------------------------------------------------------------- |
69 | // stubs for missing functions under MicroWindows | |
70 | // ---------------------------------------------------------------------------- | |
71 | ||
72 | #ifdef __WXMICROWIN__ | |
73 | ||
c67d6888 | 74 | // static inline bool IsIconic(HWND WXUNUSED(hwnd)) { return FALSE; } |
82c9f85c VZ |
75 | static inline bool IsZoomed(HWND WXUNUSED(hwnd)) { return FALSE; } |
76 | ||
77 | #endif // __WXMICROWIN__ | |
78 | ||
12447831 VZ |
79 | // NB: wxDlgProc must be defined here and not in dialog.cpp because the latter |
80 | // is not included by wxUniv build which does need wxDlgProc | |
61179e28 VZ |
81 | LONG APIENTRY _EXPORT |
82 | wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); | |
83 | ||
82c9f85c VZ |
84 | // ---------------------------------------------------------------------------- |
85 | // globals | |
86 | // ---------------------------------------------------------------------------- | |
87 | ||
b225f659 | 88 | // the name of the default wxWindows class |
46fa338b RR |
89 | #ifdef __WXWINCE__ |
90 | extern wxChar *wxCanvasClassName; | |
91 | #else | |
b225f659 | 92 | extern const wxChar *wxCanvasClassName; |
46fa338b | 93 | #endif |
b225f659 | 94 | |
2b5f62a0 VZ |
95 | // ---------------------------------------------------------------------------- |
96 | // wxTLWHiddenParentModule: used to manage the hidden parent window (we need a | |
97 | // module to ensure that the window is always deleted) | |
98 | // ---------------------------------------------------------------------------- | |
99 | ||
100 | class wxTLWHiddenParentModule : public wxModule | |
101 | { | |
102 | public: | |
103 | // module init/finalize | |
104 | virtual bool OnInit(); | |
105 | virtual void OnExit(); | |
106 | ||
107 | // get the hidden window (creates on demand) | |
108 | static HWND GetHWND(); | |
109 | ||
110 | private: | |
111 | // the HWND of the hidden parent | |
112 | static HWND ms_hwnd; | |
113 | ||
114 | // the class used to create it | |
115 | static const wxChar *ms_className; | |
116 | ||
117 | DECLARE_DYNAMIC_CLASS(wxTLWHiddenParentModule) | |
118 | }; | |
119 | ||
120 | IMPLEMENT_DYNAMIC_CLASS(wxTLWHiddenParentModule, wxModule) | |
9dfef5ac | 121 | |
82c9f85c VZ |
122 | // ============================================================================ |
123 | // wxTopLevelWindowMSW implementation | |
124 | // ============================================================================ | |
125 | ||
085ad686 VZ |
126 | BEGIN_EVENT_TABLE(wxTopLevelWindowMSW, wxTopLevelWindowBase) |
127 | EVT_ACTIVATE(wxTopLevelWindowMSW::OnActivate) | |
128 | END_EVENT_TABLE() | |
129 | ||
82c9f85c VZ |
130 | // ---------------------------------------------------------------------------- |
131 | // wxTopLevelWindowMSW creation | |
132 | // ---------------------------------------------------------------------------- | |
133 | ||
134 | void wxTopLevelWindowMSW::Init() | |
135 | { | |
136 | m_iconized = | |
137 | m_maximizeOnShow = FALSE; | |
b225f659 | 138 | |
c641b1d2 VS |
139 | // Data to save/restore when calling ShowFullScreen |
140 | m_fsStyle = 0; | |
141 | m_fsOldWindowStyle = 0; | |
142 | m_fsIsMaximized = FALSE; | |
143 | m_fsIsShowing = FALSE; | |
085ad686 VZ |
144 | |
145 | m_winLastFocused = (wxWindow *)NULL; | |
b225f659 VZ |
146 | } |
147 | ||
b2d5a7ee | 148 | WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const |
b225f659 | 149 | { |
b2d5a7ee VZ |
150 | // let the base class deal with the common styles but fix the ones which |
151 | // don't make sense for us (we also deal with the borders ourselves) | |
152 | WXDWORD msflags = wxWindow::MSWGetStyle | |
153 | ( | |
154 | (style & ~wxBORDER_MASK) | wxBORDER_NONE, exflags | |
31e7e89f | 155 | ) & ~WS_CHILD & ~WS_VISIBLE; |
b225f659 | 156 | |
c1855476 RR |
157 | #if defined(__WXWINCE__) && _WIN32_WCE < 400 |
158 | msflags |= WS_VISIBLE; | |
159 | #endif | |
160 | ||
b225f659 | 161 | // first select the kind of window being created |
dfb06c62 VZ |
162 | // |
163 | // note that if we don't set WS_POPUP, Windows assumes WS_OVERLAPPED and | |
164 | // creates a window with both caption and border, hence we also test it | |
165 | // below in some other cases | |
0e082993 | 166 | if ( style & wxFRAME_TOOL_WINDOW ) |
39d2f9a7 | 167 | { |
f76858d8 | 168 | msflags |= WS_POPUP; |
39d2f9a7 | 169 | } |
f76858d8 | 170 | //else: WS_OVERLAPPED is 0 anyhow, so it is on by default |
0e082993 VZ |
171 | |
172 | // border and caption styles | |
173 | if ( style & wxRESIZE_BORDER ) | |
174 | msflags |= WS_THICKFRAME; | |
f8d56830 JS |
175 | else if ( exflags && ((style & wxBORDER_DOUBLE) || (style & wxBORDER_RAISED)) ) |
176 | *exflags |= WS_EX_DLGMODALFRAME; | |
0e082993 VZ |
177 | else if ( !(style & wxBORDER_NONE) ) |
178 | msflags |= WS_BORDER; | |
dfb06c62 VZ |
179 | else |
180 | msflags |= WS_POPUP; | |
0e082993 | 181 | |
f76858d8 VZ |
182 | // normally we consider that all windows without caption must be popups, |
183 | // but CE is an exception: there windows normally do not have the caption | |
184 | // but shouldn't be made popups as popups can't have menus and don't look | |
185 | // like normal windows anyhow | |
0e082993 VZ |
186 | if ( style & wxCAPTION ) |
187 | msflags |= WS_CAPTION; | |
f76858d8 | 188 | #ifndef __WXWINCE__ |
dfb06c62 | 189 | else |
b225f659 | 190 | msflags |= WS_POPUP; |
f76858d8 | 191 | #endif // !__WXWINCE__ |
e5aa8b81 | 192 | |
b225f659 VZ |
193 | // next translate the individual flags |
194 | if ( style & wxMINIMIZE_BOX ) | |
195 | msflags |= WS_MINIMIZEBOX; | |
196 | if ( style & wxMAXIMIZE_BOX ) | |
197 | msflags |= WS_MAXIMIZEBOX; | |
b225f659 VZ |
198 | if ( style & wxSYSTEM_MENU ) |
199 | msflags |= WS_SYSMENU; | |
2a47cb1b | 200 | |
f76858d8 VZ |
201 | // NB: under CE these 2 styles are not supported currently, we should |
202 | // call Minimize()/Maximize() "manually" if we want to support them | |
b225f659 VZ |
203 | if ( style & wxMINIMIZE ) |
204 | msflags |= WS_MINIMIZE; | |
205 | if ( style & wxMAXIMIZE ) | |
206 | msflags |= WS_MAXIMIZE; | |
0e082993 | 207 | |
b225f659 | 208 | // Keep this here because it saves recoding this function in wxTinyFrame |
b225f659 VZ |
209 | if ( style & (wxTINY_CAPTION_VERT | wxTINY_CAPTION_HORIZ) ) |
210 | msflags |= WS_CAPTION; | |
e5aa8b81 | 211 | |
b225f659 VZ |
212 | if ( exflags ) |
213 | { | |
f76858d8 VZ |
214 | // there is no taskbar under CE, so omit all this |
215 | #ifndef __WXWINCE__ | |
35bf863b VZ |
216 | if ( !(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) ) |
217 | { | |
9dfef5ac VZ |
218 | if ( style & wxFRAME_TOOL_WINDOW ) |
219 | { | |
220 | // create the palette-like window | |
35bf863b | 221 | *exflags |= WS_EX_TOOLWINDOW; |
404a4d93 VZ |
222 | |
223 | // tool windows shouldn't appear on the taskbar (as documented) | |
224 | style |= wxFRAME_NO_TASKBAR; | |
9dfef5ac VZ |
225 | } |
226 | ||
227 | // We have to solve 2 different problems here: | |
228 | // | |
229 | // 1. frames with wxFRAME_NO_TASKBAR flag shouldn't appear in the | |
230 | // taskbar even if they don't have a parent | |
231 | // | |
232 | // 2. frames without this style should appear in the taskbar even | |
233 | // if they're owned (Windows only puts non owned windows into | |
234 | // the taskbar normally) | |
235 | // | |
236 | // The second one is solved here by using WS_EX_APPWINDOW flag, the | |
237 | // first one is dealt with in our MSWGetParent() method | |
238 | // implementation | |
239 | if ( !(style & wxFRAME_NO_TASKBAR) && GetParent() ) | |
240 | { | |
241 | // need to force the frame to appear in the taskbar | |
35bf863b | 242 | *exflags |= WS_EX_APPWINDOW; |
9dfef5ac VZ |
243 | } |
244 | //else: nothing to do [here] | |
35bf863b | 245 | } |
f76858d8 | 246 | #endif // !__WXWINCE__ |
b225f659 VZ |
247 | |
248 | if ( style & wxSTAY_ON_TOP ) | |
249 | *exflags |= WS_EX_TOPMOST; | |
250 | ||
b2d5a7ee | 251 | if ( GetExtraStyle() & wxFRAME_EX_CONTEXTHELP ) |
68d02db3 | 252 | *exflags |= WS_EX_CONTEXTHELP; |
b225f659 VZ |
253 | } |
254 | ||
255 | return msflags; | |
256 | } | |
257 | ||
9dfef5ac VZ |
258 | WXHWND wxTopLevelWindowMSW::MSWGetParent() const |
259 | { | |
260 | // for the frames without wxFRAME_FLOAT_ON_PARENT style we should use NULL | |
261 | // parent HWND or it would be always on top of its parent which is not what | |
262 | // we usually want (in fact, we only want it for frames with the | |
263 | // wxFRAME_FLOAT_ON_PARENT flag) | |
2b5f62a0 | 264 | HWND hwndParent = NULL; |
9dfef5ac VZ |
265 | if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) ) |
266 | { | |
2b5f62a0 | 267 | const wxWindow *parent = GetParent(); |
9dfef5ac | 268 | |
2b5f62a0 VZ |
269 | if ( !parent ) |
270 | { | |
271 | // this flag doesn't make sense then and will be ignored | |
272 | wxFAIL_MSG( _T("wxFRAME_FLOAT_ON_PARENT but no parent?") ); | |
273 | } | |
274 | else | |
275 | { | |
276 | hwndParent = GetHwndOf(parent); | |
277 | } | |
9dfef5ac | 278 | } |
2b5f62a0 | 279 | //else: don't float on parent, must not be owned |
9dfef5ac VZ |
280 | |
281 | // now deal with the 2nd taskbar-related problem (see comments above in | |
282 | // MSWGetStyle()) | |
2b5f62a0 | 283 | if ( HasFlag(wxFRAME_NO_TASKBAR) && !hwndParent ) |
9dfef5ac | 284 | { |
2b5f62a0 VZ |
285 | // use hidden parent |
286 | hwndParent = wxTLWHiddenParentModule::GetHWND(); | |
9dfef5ac VZ |
287 | } |
288 | ||
2b5f62a0 | 289 | return (WXHWND)hwndParent; |
9dfef5ac VZ |
290 | } |
291 | ||
6e8515a3 | 292 | bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, |
b225f659 VZ |
293 | const wxString& title, |
294 | const wxPoint& pos, | |
295 | const wxSize& size) | |
296 | { | |
297 | #ifdef __WXMICROWIN__ | |
298 | // no dialogs support under MicroWin yet | |
299 | return CreateFrame(title, pos, size); | |
300 | #else // !__WXMICROWIN__ | |
301 | wxWindow *parent = GetParent(); | |
302 | ||
303 | // for the dialogs without wxDIALOG_NO_PARENT style, use the top level | |
304 | // app window as parent - this avoids creating modal dialogs without | |
305 | // parent | |
306 | if ( !parent && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) | |
307 | { | |
308 | parent = wxTheApp->GetTopWindow(); | |
e058b98d | 309 | |
39cc7a0b | 310 | if ( parent ) |
e058b98d | 311 | { |
39cc7a0b VZ |
312 | // don't use transient windows as parents, this is dangerous as it |
313 | // can lead to a crash if the parent is destroyed before the child | |
314 | // | |
315 | // also don't use the window which is currently hidden as then the | |
316 | // dialog would be hidden as well | |
317 | if ( (parent->GetExtraStyle() & wxWS_EX_TRANSIENT) || | |
318 | !parent->IsShown() ) | |
319 | { | |
320 | parent = NULL; | |
321 | } | |
e058b98d | 322 | } |
b225f659 VZ |
323 | } |
324 | ||
434005ca VZ |
325 | m_hWnd = (WXHWND)::CreateDialogIndirect |
326 | ( | |
327 | wxGetInstance(), | |
328 | (DLGTEMPLATE*)dlgTemplate, | |
329 | parent ? GetHwndOf(parent) : NULL, | |
330 | (DLGPROC)wxDlgProc | |
331 | ); | |
b225f659 VZ |
332 | |
333 | if ( !m_hWnd ) | |
334 | { | |
7e99eddf | 335 | wxFAIL_MSG(wxT("Failed to create dialog. Incorrect DLGTEMPLATE?")); |
b225f659 | 336 | |
7e99eddf | 337 | wxLogSysError(wxT("Can't create dialog using memory template")); |
b225f659 VZ |
338 | |
339 | return FALSE; | |
340 | } | |
341 | ||
b2d5a7ee | 342 | WXDWORD exflags; |
b225f659 VZ |
343 | (void)MSWGetCreateWindowFlags(&exflags); |
344 | ||
345 | if ( exflags ) | |
346 | { | |
347 | ::SetWindowLong(GetHwnd(), GWL_EXSTYLE, exflags); | |
cef338d3 VZ |
348 | ::SetWindowPos(GetHwnd(), |
349 | exflags & WS_EX_TOPMOST ? HWND_TOPMOST : 0, | |
350 | 0, 0, 0, 0, | |
b225f659 VZ |
351 | SWP_NOSIZE | |
352 | SWP_NOMOVE | | |
cef338d3 | 353 | (exflags & WS_EX_TOPMOST ? 0 : SWP_NOZORDER) | |
b225f659 VZ |
354 | SWP_NOACTIVATE); |
355 | } | |
356 | ||
357 | #if defined(__WIN95__) | |
358 | // For some reason, the system menu is activated when we use the | |
359 | // WS_EX_CONTEXTHELP style, so let's set a reasonable icon | |
360 | if ( exflags & WS_EX_CONTEXTHELP ) | |
361 | { | |
362 | wxFrame *winTop = wxDynamicCast(wxTheApp->GetTopWindow(), wxFrame); | |
363 | if ( winTop ) | |
364 | { | |
365 | wxIcon icon = winTop->GetIcon(); | |
366 | if ( icon.Ok() ) | |
367 | { | |
368 | ::SendMessage(GetHwnd(), WM_SETICON, | |
369 | (WPARAM)TRUE, | |
370 | (LPARAM)GetHiconOf(icon)); | |
371 | } | |
372 | } | |
373 | } | |
374 | #endif // __WIN95__ | |
375 | ||
376 | // move the dialog to its initial position without forcing repainting | |
377 | int x, y, w, h; | |
72a11184 | 378 | (void)MSWGetCreateWindowCoords(pos, size, x, y, w, h); |
4c53c743 | 379 | |
26268100 RD |
380 | if ( x == (int)CW_USEDEFAULT ) |
381 | { | |
382 | // centre it on the screen - what else can we do? | |
383 | wxSize sizeDpy = wxGetDisplaySize(); | |
384 | ||
385 | x = (sizeDpy.x - w) / 2; | |
386 | y = (sizeDpy.y - h) / 2; | |
387 | } | |
388 | ||
28c191aa | 389 | #ifndef __WXWINCE__ |
4c53c743 VZ |
390 | if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) ) |
391 | { | |
392 | wxLogLastError(wxT("MoveWindow")); | |
b225f659 | 393 | } |
28c191aa | 394 | #endif |
b225f659 VZ |
395 | |
396 | if ( !title.empty() ) | |
397 | { | |
398 | ::SetWindowText(GetHwnd(), title); | |
399 | } | |
400 | ||
401 | SubclassWin(m_hWnd); | |
402 | ||
403 | return TRUE; | |
404 | #endif // __WXMICROWIN__/!__WXMICROWIN__ | |
405 | } | |
406 | ||
407 | bool wxTopLevelWindowMSW::CreateFrame(const wxString& title, | |
408 | const wxPoint& pos, | |
409 | const wxSize& size) | |
410 | { | |
b2d5a7ee VZ |
411 | WXDWORD exflags; |
412 | WXDWORD flags = MSWGetCreateWindowFlags(&exflags); | |
b225f659 | 413 | |
11756f61 VZ |
414 | #if (defined(_WIN32_WCE) && _WIN32_WCE < 400) || \ |
415 | defined(WIN32_PLATFORM_PSPC) || \ | |
416 | defined(WIN32_PLATFORM_WFSP) | |
960b193e | 417 | // Always expand to fit the screen in PocketPC or SmartPhone |
a48e51ce VZ |
418 | wxSize sz(wxDefaultSize); |
419 | #else // other (including normal desktop) Windows | |
420 | wxSize sz(size); | |
960b193e JS |
421 | #endif |
422 | ||
423 | return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags); | |
82c9f85c VZ |
424 | } |
425 | ||
426 | bool wxTopLevelWindowMSW::Create(wxWindow *parent, | |
427 | wxWindowID id, | |
428 | const wxString& title, | |
429 | const wxPoint& pos, | |
430 | const wxSize& size, | |
431 | long style, | |
432 | const wxString& name) | |
433 | { | |
999836aa | 434 | bool ret wxDUMMY_INITIALIZE(false); |
2a47cb1b | 435 | |
82c9f85c VZ |
436 | // init our fields |
437 | Init(); | |
2a47cb1b VZ |
438 | |
439 | wxSize sizeReal = size; | |
440 | if ( !sizeReal.IsFullySpecified() ) | |
441 | { | |
442 | sizeReal.SetDefaults(GetDefaultSize()); | |
443 | } | |
82c9f85c VZ |
444 | |
445 | m_windowStyle = style; | |
446 | ||
447 | SetName(name); | |
448 | ||
449 | m_windowId = id == -1 ? NewControlId() : id; | |
450 | ||
451 | wxTopLevelWindows.Append(this); | |
452 | ||
453 | if ( parent ) | |
454 | parent->AddChild(this); | |
455 | ||
b225f659 VZ |
456 | if ( GetExtraStyle() & wxTOPLEVEL_EX_DIALOG ) |
457 | { | |
b225f659 VZ |
458 | // we have different dialog templates to allows creation of dialogs |
459 | // with & without captions under MSWindows, resizeable or not (but a | |
460 | // resizeable dialog always has caption - otherwise it would look too | |
461 | // strange) | |
434005ca VZ |
462 | |
463 | // we need 3 additional WORDs for dialog menu, class and title (as we | |
464 | // don't use DS_SETFONT we don't need the fourth WORD for the font) | |
465 | static const int dlgsize = sizeof(DLGTEMPLATE) + (sizeof(WORD) * 3); | |
466 | DLGTEMPLATE *dlgTemplate = (DLGTEMPLATE *)malloc(dlgsize); | |
467 | memset(dlgTemplate, 0, dlgsize); | |
468 | ||
469 | // these values are arbitrary, they won't be used normally anyhow | |
6e8515a3 JS |
470 | dlgTemplate->x = 34; |
471 | dlgTemplate->y = 22; | |
472 | dlgTemplate->cx = 144; | |
473 | dlgTemplate->cy = 75; | |
474 | ||
434005ca VZ |
475 | // reuse the code in MSWGetStyle() but correct the results slightly for |
476 | // the dialog | |
477 | dlgTemplate->style = MSWGetStyle(style, NULL); | |
478 | ||
479 | // all dialogs are popups | |
480 | dlgTemplate->style |= WS_POPUP; | |
481 | ||
482 | // force 3D-look if necessary, it looks impossibly ugly otherwise | |
483 | if ( style & (wxRESIZE_BORDER | wxCAPTION) ) | |
484 | dlgTemplate->style |= DS_MODALFRAME; | |
b225f659 | 485 | |
2a47cb1b | 486 | ret = CreateDialog(dlgTemplate, title, pos, sizeReal); |
6e8515a3 | 487 | free(dlgTemplate); |
b225f659 VZ |
488 | } |
489 | else // !dialog | |
490 | { | |
2a47cb1b | 491 | ret = CreateFrame(title, pos, sizeReal); |
9ca4dd06 VS |
492 | } |
493 | ||
494 | if ( ret && !(GetWindowStyleFlag() & wxCLOSE_BOX) ) | |
495 | { | |
496 | EnableCloseButton(false); | |
b225f659 | 497 | } |
9ca4dd06 | 498 | |
bb655ead VZ |
499 | // for some reason we need to manually send ourselves this message as |
500 | // otherwise the mnemonics are always shown -- even if they're configured | |
501 | // to be hidden until "Alt" is pressed in the control panel | |
502 | // | |
503 | // this could indicate a bug somewhere else but for now this is the only | |
504 | // fix we have | |
505 | if ( ret ) | |
506 | { | |
507 | SendMessage | |
508 | ( | |
509 | GetHwnd(), | |
510 | WM_UPDATEUISTATE, | |
511 | MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS | UISF_HIDEACCEL), | |
512 | 0 | |
513 | ); | |
514 | } | |
515 | ||
9ca4dd06 | 516 | return ret; |
82c9f85c VZ |
517 | } |
518 | ||
519 | wxTopLevelWindowMSW::~wxTopLevelWindowMSW() | |
520 | { | |
d6fb86a8 VZ |
521 | // after destroying an owned window, Windows activates the next top level |
522 | // window in Z order but it may be different from our owner (to reproduce | |
523 | // this simply Alt-TAB to another application and back before closing the | |
524 | // owned frame) whereas we always want to yield activation to our parent | |
525 | if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) ) | |
526 | { | |
527 | wxWindow *parent = GetParent(); | |
528 | if ( parent ) | |
529 | { | |
530 | ::BringWindowToTop(GetHwndOf(parent)); | |
531 | } | |
532 | } | |
82c9f85c VZ |
533 | } |
534 | ||
82c9f85c VZ |
535 | // ---------------------------------------------------------------------------- |
536 | // wxTopLevelWindowMSW showing | |
537 | // ---------------------------------------------------------------------------- | |
538 | ||
539 | void wxTopLevelWindowMSW::DoShowWindow(int nShowCmd) | |
540 | { | |
541 | ::ShowWindow(GetHwnd(), nShowCmd); | |
542 | ||
543 | m_iconized = nShowCmd == SW_MINIMIZE; | |
544 | } | |
545 | ||
546 | bool wxTopLevelWindowMSW::Show(bool show) | |
547 | { | |
548 | // don't use wxWindow version as we want to call DoShowWindow() ourselves | |
549 | if ( !wxWindowBase::Show(show) ) | |
550 | return FALSE; | |
551 | ||
552 | int nShowCmd; | |
553 | if ( show ) | |
554 | { | |
555 | if ( m_maximizeOnShow ) | |
556 | { | |
557 | // show and maximize | |
558 | nShowCmd = SW_MAXIMIZE; | |
559 | ||
560 | m_maximizeOnShow = FALSE; | |
561 | } | |
562 | else // just show | |
563 | { | |
84cff965 JS |
564 | if ( GetWindowStyle() & wxFRAME_TOOL_WINDOW ) |
565 | nShowCmd = SW_SHOWNA; | |
566 | else | |
567 | nShowCmd = SW_SHOW; | |
82c9f85c VZ |
568 | } |
569 | } | |
570 | else // hide | |
571 | { | |
572 | nShowCmd = SW_HIDE; | |
573 | } | |
574 | ||
575 | DoShowWindow(nShowCmd); | |
576 | ||
577 | if ( show ) | |
578 | { | |
579 | ::BringWindowToTop(GetHwnd()); | |
580 | ||
581 | wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId); | |
582 | event.SetEventObject( this ); | |
583 | GetEventHandler()->ProcessEvent(event); | |
584 | } | |
585 | else // hide | |
586 | { | |
587 | // Try to highlight the correct window (the parent) | |
588 | if ( GetParent() ) | |
589 | { | |
590 | HWND hWndParent = GetHwndOf(GetParent()); | |
591 | if (hWndParent) | |
592 | ::BringWindowToTop(hWndParent); | |
593 | } | |
594 | } | |
595 | ||
596 | return TRUE; | |
597 | } | |
598 | ||
599 | // ---------------------------------------------------------------------------- | |
600 | // wxTopLevelWindowMSW maximize/minimize | |
601 | // ---------------------------------------------------------------------------- | |
602 | ||
603 | void wxTopLevelWindowMSW::Maximize(bool maximize) | |
604 | { | |
605 | if ( IsShown() ) | |
606 | { | |
607 | // just maximize it directly | |
608 | DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE); | |
609 | } | |
610 | else // hidden | |
611 | { | |
612 | // we can't maximize the hidden frame because it shows it as well, so | |
613 | // just remember that we should do it later in this case | |
a0be434e | 614 | m_maximizeOnShow = maximize; |
82c9f85c VZ |
615 | } |
616 | } | |
617 | ||
618 | bool wxTopLevelWindowMSW::IsMaximized() const | |
619 | { | |
4676948b JS |
620 | #ifdef __WXWINCE__ |
621 | return FALSE; | |
622 | #else | |
82c9f85c | 623 | return ::IsZoomed(GetHwnd()) != 0; |
4676948b | 624 | #endif |
82c9f85c VZ |
625 | } |
626 | ||
627 | void wxTopLevelWindowMSW::Iconize(bool iconize) | |
628 | { | |
629 | DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE); | |
630 | } | |
631 | ||
632 | bool wxTopLevelWindowMSW::IsIconized() const | |
633 | { | |
4676948b JS |
634 | #ifdef __WXWINCE__ |
635 | return FALSE; | |
636 | #else | |
82c9f85c VZ |
637 | // also update the current state |
638 | ((wxTopLevelWindowMSW *)this)->m_iconized = ::IsIconic(GetHwnd()) != 0; | |
639 | ||
640 | return m_iconized; | |
4676948b | 641 | #endif |
82c9f85c VZ |
642 | } |
643 | ||
644 | void wxTopLevelWindowMSW::Restore() | |
645 | { | |
646 | DoShowWindow(SW_RESTORE); | |
647 | } | |
648 | ||
c641b1d2 VS |
649 | // ---------------------------------------------------------------------------- |
650 | // wxTopLevelWindowMSW fullscreen | |
651 | // ---------------------------------------------------------------------------- | |
652 | ||
653 | bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) | |
654 | { | |
716645d3 | 655 | if ( show == IsFullScreen() ) |
c641b1d2 | 656 | { |
716645d3 VZ |
657 | // nothing to do |
658 | return TRUE; | |
659 | } | |
660 | ||
661 | m_fsIsShowing = show; | |
c641b1d2 | 662 | |
716645d3 VZ |
663 | if ( show ) |
664 | { | |
c641b1d2 VS |
665 | m_fsStyle = style; |
666 | ||
667 | // zap the frame borders | |
668 | ||
669 | // save the 'normal' window style | |
716645d3 | 670 | m_fsOldWindowStyle = GetWindowLong(GetHwnd(), GWL_STYLE); |
c641b1d2 VS |
671 | |
672 | // save the old position, width & height, maximize state | |
673 | m_fsOldSize = GetRect(); | |
674 | m_fsIsMaximized = IsMaximized(); | |
675 | ||
676 | // decide which window style flags to turn off | |
677 | LONG newStyle = m_fsOldWindowStyle; | |
678 | LONG offFlags = 0; | |
679 | ||
680 | if (style & wxFULLSCREEN_NOBORDER) | |
4676948b JS |
681 | { |
682 | offFlags |= WS_BORDER; | |
683 | #ifndef __WXWINCE__ | |
684 | offFlags |= WS_THICKFRAME; | |
685 | #endif | |
686 | } | |
c641b1d2 | 687 | if (style & wxFULLSCREEN_NOCAPTION) |
716645d3 | 688 | offFlags |= WS_CAPTION | WS_SYSMENU; |
c641b1d2 | 689 | |
716645d3 | 690 | newStyle &= ~offFlags; |
c641b1d2 VS |
691 | |
692 | // change our window style to be compatible with full-screen mode | |
716645d3 | 693 | ::SetWindowLong(GetHwnd(), GWL_STYLE, newStyle); |
c641b1d2 | 694 | |
716645d3 VZ |
695 | wxRect rect; |
696 | #if wxUSE_DISPLAY | |
697 | // resize to the size of the display containing us | |
698 | int dpy = wxDisplay::GetFromWindow(this); | |
699 | if ( dpy != wxNOT_FOUND ) | |
700 | { | |
701 | rect = wxDisplay(dpy).GetGeometry(); | |
702 | } | |
703 | else // fall back to the main desktop | |
704 | #else // wxUSE_DISPLAY | |
705 | { | |
706 | // resize to the size of the desktop | |
707 | wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect); | |
80a81a12 JS |
708 | #ifdef __WXWINCE__ |
709 | // FIXME: size of the bottom menu (toolbar) | |
710 | // should be taken in account | |
711 | rect.height += rect.y; | |
712 | rect.y = 0; | |
4676948b | 713 | #endif |
716645d3 VZ |
714 | } |
715 | #endif // wxUSE_DISPLAY | |
c641b1d2 | 716 | |
716645d3 | 717 | SetSize(rect); |
c641b1d2 VS |
718 | |
719 | // now flush the window style cache and actually go full-screen | |
716645d3 | 720 | long flags = SWP_FRAMECHANGED; |
c641b1d2 | 721 | |
716645d3 VZ |
722 | // showing the frame full screen should also show it if it's still |
723 | // hidden | |
724 | if ( !IsShown() ) | |
725 | { | |
726 | // don't call wxWindow version to avoid flicker from calling | |
727 | // ::ShowWindow() -- we're going to show the window at the correct | |
728 | // location directly below -- but do call the wxWindowBase version | |
729 | // to sync the internal m_isShown flag | |
730 | wxWindowBase::Show(); | |
c641b1d2 | 731 | |
716645d3 VZ |
732 | flags |= SWP_SHOWWINDOW; |
733 | } | |
c641b1d2 | 734 | |
716645d3 VZ |
735 | SetWindowPos(GetHwnd(), HWND_TOP, |
736 | rect.x, rect.y, rect.width, rect.height, | |
737 | flags); | |
c641b1d2 | 738 | |
c0f98472 | 739 | #if defined(__WXWINCE__) && _WIN32_WCE < 400 |
80a81a12 JS |
740 | ::SHFullScreen(GetHwnd(), SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); |
741 | #endif | |
742 | ||
716645d3 VZ |
743 | // finally send an event allowing the window to relayout itself &c |
744 | wxSizeEvent event(rect.GetSize(), GetId()); | |
745 | GetEventHandler()->ProcessEvent(event); | |
746 | } | |
747 | else // stop showing full screen | |
748 | { | |
c0f98472 | 749 | #if defined(__WXWINCE__) && _WIN32_WCE < 400 |
80a81a12 JS |
750 | ::SHFullScreen(GetHwnd(), SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON); |
751 | #endif | |
c641b1d2 | 752 | Maximize(m_fsIsMaximized); |
716645d3 VZ |
753 | SetWindowLong(GetHwnd(),GWL_STYLE, m_fsOldWindowStyle); |
754 | SetWindowPos(GetHwnd(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y, | |
c641b1d2 | 755 | m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED); |
c641b1d2 | 756 | } |
716645d3 VZ |
757 | |
758 | return TRUE; | |
c641b1d2 VS |
759 | } |
760 | ||
82c9f85c VZ |
761 | // ---------------------------------------------------------------------------- |
762 | // wxTopLevelWindowMSW misc | |
763 | // ---------------------------------------------------------------------------- | |
764 | ||
765 | void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon) | |
766 | { | |
f618020a MB |
767 | SetIcons( wxIconBundle( icon ) ); |
768 | } | |
769 | ||
770 | void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons) | |
771 | { | |
772 | wxTopLevelWindowBase::SetIcons(icons); | |
82c9f85c VZ |
773 | |
774 | #if defined(__WIN95__) && !defined(__WXMICROWIN__) | |
f618020a MB |
775 | const wxIcon& sml = icons.GetIcon( wxSize( 16, 16 ) ); |
776 | if( sml.Ok() && sml.GetWidth() == 16 && sml.GetHeight() == 16 ) | |
777 | { | |
778 | ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL, | |
779 | (LPARAM)GetHiconOf(sml) ); | |
780 | } | |
781 | ||
782 | const wxIcon& big = icons.GetIcon( wxSize( 32, 32 ) ); | |
783 | if( big.Ok() && big.GetWidth() == 32 && big.GetHeight() == 32 ) | |
82c9f85c | 784 | { |
f618020a MB |
785 | ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG, |
786 | (LPARAM)GetHiconOf(big) ); | |
82c9f85c VZ |
787 | } |
788 | #endif // __WIN95__ | |
789 | } | |
a91cf80c VZ |
790 | |
791 | bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) | |
792 | { | |
4676948b | 793 | #if !defined(__WXMICROWIN__) |
a91cf80c | 794 | // get system (a.k.a. window) menu |
4676948b | 795 | HMENU hmenu = GetSystemMenu(GetHwnd(), FALSE /* get it */); |
a91cf80c VZ |
796 | if ( !hmenu ) |
797 | { | |
660b1906 VZ |
798 | // no system menu at all -- ok if we want to remove the close button |
799 | // anyhow, but bad if we want to show it | |
800 | return !enable; | |
a91cf80c VZ |
801 | } |
802 | ||
803 | // enabling/disabling the close item from it also automatically | |
804 | // disables/enables the close title bar button | |
aaf765a5 VZ |
805 | if ( ::EnableMenuItem(hmenu, SC_CLOSE, |
806 | MF_BYCOMMAND | | |
807 | (enable ? MF_ENABLED : MF_GRAYED)) == -1 ) | |
a91cf80c VZ |
808 | { |
809 | wxLogLastError(_T("EnableMenuItem(SC_CLOSE)")); | |
810 | ||
811 | return FALSE; | |
812 | } | |
960b193e | 813 | #ifndef __WXWINCE__ |
a91cf80c VZ |
814 | // update appearance immediately |
815 | if ( !::DrawMenuBar(GetHwnd()) ) | |
816 | { | |
817 | wxLogLastError(_T("DrawMenuBar")); | |
818 | } | |
960b193e | 819 | #endif |
a91cf80c VZ |
820 | #endif // !__WXMICROWIN__ |
821 | ||
822 | return TRUE; | |
823 | } | |
824 | ||
2a47cb1b VZ |
825 | #ifndef __WXWINCE__ |
826 | ||
1542ea39 RD |
827 | bool wxTopLevelWindowMSW::SetShape(const wxRegion& region) |
828 | { | |
6a7e6411 RD |
829 | wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, |
830 | _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); | |
831 | ||
1542ea39 RD |
832 | // The empty region signifies that the shape should be removed from the |
833 | // window. | |
834 | if ( region.IsEmpty() ) | |
835 | { | |
836 | if (::SetWindowRgn(GetHwnd(), NULL, TRUE) == 0) | |
837 | { | |
838 | wxLogLastError(_T("SetWindowRgn")); | |
839 | return FALSE; | |
840 | } | |
841 | return TRUE; | |
842 | } | |
843 | ||
844 | // Windows takes ownership of the region, so | |
845 | // we'll have to make a copy of the region to give to it. | |
846 | DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL); | |
847 | RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; | |
848 | ::GetRegionData(GetHrgnOf(region), noBytes, rgnData); | |
849 | HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData); | |
850 | delete[] (char*) rgnData; | |
851 | ||
852 | // SetWindowRgn expects the region to be in coordinants | |
853 | // relative to the window, not the client area. Figure | |
854 | // out the offset, if any. | |
855 | RECT rect; | |
856 | DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); | |
857 | DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE); | |
858 | ::GetClientRect(GetHwnd(), &rect); | |
859 | ::AdjustWindowRectEx(&rect, dwStyle, FALSE, dwExStyle); | |
860 | ::OffsetRgn(hrgn, -rect.left, -rect.top); | |
861 | ||
862 | // Now call the shape API with the new region. | |
863 | if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0) | |
864 | { | |
865 | wxLogLastError(_T("SetWindowRgn")); | |
866 | return FALSE; | |
867 | } | |
868 | return TRUE; | |
869 | } | |
870 | ||
2a47cb1b VZ |
871 | #endif // !__WXWINCE__ |
872 | ||
085ad686 VZ |
873 | // ---------------------------------------------------------------------------- |
874 | // wxTopLevelWindow event handling | |
875 | // ---------------------------------------------------------------------------- | |
876 | ||
877 | // Default activation behaviour - set the focus for the first child | |
878 | // subwindow found. | |
879 | void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) | |
880 | { | |
881 | if ( event.GetActive() ) | |
882 | { | |
2736a5de VZ |
883 | // restore focus to the child which was last focused unless we already |
884 | // have it | |
885 | wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), (int) m_hWnd); | |
085ad686 | 886 | |
2736a5de VZ |
887 | wxWindow *winFocus = FindFocus(); |
888 | if ( !winFocus || wxGetTopLevelParent(winFocus) != this ) | |
085ad686 | 889 | { |
2736a5de VZ |
890 | wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent() |
891 | : NULL; | |
892 | if ( !parent ) | |
893 | { | |
894 | parent = this; | |
895 | } | |
085ad686 | 896 | |
2736a5de VZ |
897 | wxSetFocusToChild(parent, &m_winLastFocused); |
898 | } | |
085ad686 VZ |
899 | } |
900 | else // deactivating | |
901 | { | |
902 | // remember the last focused child if it is our child | |
903 | m_winLastFocused = FindFocus(); | |
904 | ||
13834828 VZ |
905 | if ( m_winLastFocused ) |
906 | { | |
907 | // let it know that it doesn't have focus any more | |
77e00fe9 | 908 | m_winLastFocused->HandleKillFocus((WXHWND)NULL); |
13834828 | 909 | |
2736a5de VZ |
910 | // and don't remember it if it's a child from some other frame |
911 | if ( wxGetTopLevelParent(m_winLastFocused) != this ) | |
085ad686 | 912 | { |
2736a5de | 913 | m_winLastFocused = NULL; |
085ad686 | 914 | } |
085ad686 VZ |
915 | } |
916 | ||
917 | wxLogTrace(_T("focus"), | |
918 | _T("wxTLW %08x deactivated, last focused: %08x."), | |
9b601c24 GRG |
919 | (int) m_hWnd, |
920 | (int) (m_winLastFocused ? GetHwndOf(m_winLastFocused) | |
921 | : NULL)); | |
085ad686 VZ |
922 | |
923 | event.Skip(); | |
924 | } | |
925 | } | |
926 | ||
12447831 VZ |
927 | // the DialogProc for all wxWindows dialogs |
928 | LONG APIENTRY _EXPORT | |
0fc58b86 | 929 | wxDlgProc(HWND hDlg, |
2eb10e2a VZ |
930 | UINT message, |
931 | WPARAM WXUNUSED(wParam), | |
932 | LPARAM WXUNUSED(lParam)) | |
12447831 | 933 | { |
a48e51ce | 934 | if ( message == WM_INITDIALOG ) |
12447831 | 935 | { |
a48e51ce VZ |
936 | // under CE, add a "Ok" button in the dialog title bar and make it full |
937 | // screen | |
938 | // | |
939 | // VZ: we should probably allow for overriding this, e.g. by including | |
940 | // MAXIMIZED flag in the dialog style by default and doing this | |
941 | // only if it is present... | |
942 | ||
943 | // Standard SDK doesn't have aygshell.dll: see | |
944 | // include/wx/msw/wince/libraries.h | |
3874e500 | 945 | #if defined(__WXWINCE__) && !defined(WCE_PLATFORM_STANDARDSDK) |
a48e51ce VZ |
946 | SHINITDLGINFO shidi; |
947 | shidi.dwMask = SHIDIM_FLAGS; | |
948 | shidi.dwFlags = SHIDIF_DONEBUTTON | | |
949 | SHIDIF_SIZEDLGFULLSCREEN; | |
950 | shidi.hDlg = hDlg; | |
951 | SHInitDialog( &shidi ); | |
952 | #else // no SHInitDialog() | |
953 | wxUnusedVar(hDlg); | |
0fc58b86 | 954 | #endif |
12447831 | 955 | } |
a48e51ce VZ |
956 | |
957 | // for almost all messages, returning FALSE means that we didn't process | |
958 | // the message | |
959 | // | |
960 | // for WM_INITDIALOG, returning TRUE tells system to set focus to | |
961 | // the first control in the dialog box, but as we set the focus | |
962 | // ourselves, we return FALSE for it as well | |
963 | return FALSE; | |
12447831 VZ |
964 | } |
965 | ||
2b5f62a0 VZ |
966 | // ============================================================================ |
967 | // wxTLWHiddenParentModule implementation | |
968 | // ============================================================================ | |
969 | ||
970 | HWND wxTLWHiddenParentModule::ms_hwnd = NULL; | |
971 | ||
972 | const wxChar *wxTLWHiddenParentModule::ms_className = NULL; | |
973 | ||
974 | bool wxTLWHiddenParentModule::OnInit() | |
975 | { | |
976 | ms_hwnd = NULL; | |
977 | ms_className = NULL; | |
978 | ||
979 | return TRUE; | |
980 | } | |
981 | ||
982 | void wxTLWHiddenParentModule::OnExit() | |
983 | { | |
984 | if ( ms_hwnd ) | |
985 | { | |
986 | if ( !::DestroyWindow(ms_hwnd) ) | |
987 | { | |
988 | wxLogLastError(_T("DestroyWindow(hidden TLW parent)")); | |
989 | } | |
990 | ||
991 | ms_hwnd = NULL; | |
992 | } | |
993 | ||
994 | if ( ms_className ) | |
995 | { | |
996 | if ( !::UnregisterClass(ms_className, wxGetInstance()) ) | |
997 | { | |
998 | wxLogLastError(_T("UnregisterClass(\"wxTLWHiddenParent\")")); | |
999 | } | |
1000 | ||
1001 | ms_className = NULL; | |
1002 | } | |
1003 | } | |
1004 | ||
1005 | /* static */ | |
1006 | HWND wxTLWHiddenParentModule::GetHWND() | |
1007 | { | |
1008 | if ( !ms_hwnd ) | |
1009 | { | |
1010 | if ( !ms_className ) | |
1011 | { | |
1012 | static const wxChar *HIDDEN_PARENT_CLASS = _T("wxTLWHiddenParent"); | |
1013 | ||
1014 | WNDCLASS wndclass; | |
1015 | wxZeroMemory(wndclass); | |
1016 | ||
1017 | wndclass.lpfnWndProc = DefWindowProc; | |
1018 | wndclass.hInstance = wxGetInstance(); | |
1019 | wndclass.lpszClassName = HIDDEN_PARENT_CLASS; | |
1020 | ||
1021 | if ( !::RegisterClass(&wndclass) ) | |
1022 | { | |
1023 | wxLogLastError(_T("RegisterClass(\"wxTLWHiddenParent\")")); | |
1024 | } | |
1025 | else | |
1026 | { | |
1027 | ms_className = HIDDEN_PARENT_CLASS; | |
1028 | } | |
1029 | } | |
1030 | ||
fda7962d | 1031 | ms_hwnd = ::CreateWindow(ms_className, wxEmptyString, 0, 0, 0, 0, 0, NULL, |
2b5f62a0 VZ |
1032 | (HMENU)NULL, wxGetInstance(), NULL); |
1033 | if ( !ms_hwnd ) | |
1034 | { | |
1035 | wxLogLastError(_T("CreateWindow(hidden TLW parent)")); | |
1036 | } | |
1037 | } | |
1038 | ||
1039 | return ms_hwnd; | |
1040 | } | |
1041 | ||
1542ea39 | 1042 |