]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c0ea335 | 2 | // Name: msw/frame.cpp |
2bda0e17 KB |
3 | // Purpose: wxFrame |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart and Markus Holzem | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
7c0ea335 VZ |
12 | // ============================================================================ |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
2bda0e17 | 20 | #ifdef __GNUG__ |
7c0ea335 | 21 | #pragma implementation "frame.h" |
2bda0e17 KB |
22 | #endif |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
9f3362c4 | 28 | #pragma hdrstop |
2bda0e17 KB |
29 | #endif |
30 | ||
31 | #ifndef WX_PRECOMP | |
9f3362c4 VZ |
32 | #include "wx/setup.h" |
33 | #include "wx/frame.h" | |
34 | #include "wx/menu.h" | |
35 | #include "wx/app.h" | |
36 | #include "wx/utils.h" | |
37 | #include "wx/dialog.h" | |
38 | #include "wx/settings.h" | |
39 | #include "wx/dcclient.h" | |
d3cc7c65 | 40 | #include "wx/mdi.h" |
f6bcfd97 | 41 | #include "wx/panel.h" |
9f3362c4 | 42 | #endif // WX_PRECOMP |
2bda0e17 KB |
43 | |
44 | #include "wx/msw/private.h" | |
7c0ea335 VZ |
45 | |
46 | #if wxUSE_STATUSBAR | |
47 | #include "wx/statusbr.h" | |
ed791986 | 48 | #include "wx/generic/statusbr.h" |
7c0ea335 VZ |
49 | #endif // wxUSE_STATUSBAR |
50 | ||
51 | #if wxUSE_TOOLBAR | |
52 | #include "wx/toolbar.h" | |
53 | #endif // wxUSE_TOOLBAR | |
54 | ||
2bda0e17 | 55 | #include "wx/menuitem.h" |
6776a0b2 | 56 | #include "wx/log.h" |
2bda0e17 | 57 | |
7c0ea335 VZ |
58 | // ---------------------------------------------------------------------------- |
59 | // globals | |
60 | // ---------------------------------------------------------------------------- | |
2bda0e17 | 61 | |
a23fd0e1 | 62 | extern wxWindowList wxModelessWindows; |
cde9f08e | 63 | extern wxList WXDLLEXPORT wxPendingDelete; |
2ffa221c | 64 | extern const wxChar *wxFrameClassName; |
e1a6fc11 | 65 | extern wxMenu *wxCurrentPopupMenu; |
2bda0e17 | 66 | |
7c0ea335 VZ |
67 | // ---------------------------------------------------------------------------- |
68 | // event tables | |
69 | // ---------------------------------------------------------------------------- | |
70 | ||
7c0ea335 VZ |
71 | BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) |
72 | EVT_ACTIVATE(wxFrame::OnActivate) | |
73 | EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) | |
2bda0e17 KB |
74 | END_EVENT_TABLE() |
75 | ||
76 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) | |
2bda0e17 | 77 | |
7c0ea335 VZ |
78 | // ============================================================================ |
79 | // implementation | |
80 | // ============================================================================ | |
81 | ||
82 | // ---------------------------------------------------------------------------- | |
83 | // static class members | |
84 | // ---------------------------------------------------------------------------- | |
85 | ||
47d67540 | 86 | #if wxUSE_NATIVE_STATUSBAR |
9f3362c4 | 87 | bool wxFrame::m_useNativeStatusBar = TRUE; |
2bda0e17 | 88 | #else |
9f3362c4 | 89 | bool wxFrame::m_useNativeStatusBar = FALSE; |
2bda0e17 KB |
90 | #endif |
91 | ||
7c0ea335 VZ |
92 | // ---------------------------------------------------------------------------- |
93 | // creation/destruction | |
94 | // ---------------------------------------------------------------------------- | |
2bda0e17 | 95 | |
7c0ea335 | 96 | void wxFrame::Init() |
2bda0e17 | 97 | { |
7c0ea335 VZ |
98 | m_iconized = FALSE; |
99 | ||
9f3362c4 VZ |
100 | #if wxUSE_TOOLTIPS |
101 | m_hwndToolTip = 0; | |
102 | #endif | |
a2327a9f JS |
103 | |
104 | // Data to save/restore when calling ShowFullScreen | |
105 | m_fsStyle = 0; | |
106 | m_fsOldWindowStyle = 0; | |
107 | m_fsStatusBarFields = 0; | |
108 | m_fsStatusBarHeight = 0; | |
109 | m_fsToolBarHeight = 0; | |
f6bcfd97 | 110 | // m_fsMenu = 0; |
a2327a9f JS |
111 | m_fsIsMaximized = FALSE; |
112 | m_fsIsShowing = FALSE; | |
f6bcfd97 BP |
113 | |
114 | m_winLastFocused = (wxWindow *)NULL; | |
115 | ||
116 | // unlike (almost?) all other windows, frames are created hidden | |
117 | m_isShown = FALSE; | |
7c0ea335 | 118 | } |
9f3362c4 | 119 | |
7c0ea335 VZ |
120 | bool wxFrame::Create(wxWindow *parent, |
121 | wxWindowID id, | |
122 | const wxString& title, | |
123 | const wxPoint& pos, | |
124 | const wxSize& size, | |
125 | long style, | |
126 | const wxString& name) | |
127 | { | |
2bda0e17 | 128 | SetName(name); |
2bda0e17 KB |
129 | m_windowStyle = style; |
130 | m_frameMenuBar = NULL; | |
7c0ea335 | 131 | m_frameToolBar = NULL; |
2bda0e17 KB |
132 | m_frameStatusBar = NULL; |
133 | ||
134 | SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); | |
135 | ||
2bda0e17 KB |
136 | if ( id > -1 ) |
137 | m_windowId = id; | |
138 | else | |
139 | m_windowId = (int)NewControlId(); | |
140 | ||
141 | if (parent) parent->AddChild(this); | |
142 | ||
143 | int x = pos.x; | |
144 | int y = pos.y; | |
145 | int width = size.x; | |
146 | int height = size.y; | |
147 | ||
148 | m_iconized = FALSE; | |
d2aef312 | 149 | |
f6bcfd97 | 150 | wxTopLevelWindows.Append(this); |
319fefa9 | 151 | |
aeab10d0 | 152 | MSWCreate(m_windowId, parent, wxFrameClassName, this, title, |
d2aef312 | 153 | x, y, width, height, style); |
2bda0e17 KB |
154 | |
155 | wxModelessWindows.Append(this); | |
f6bcfd97 | 156 | |
2bda0e17 KB |
157 | return TRUE; |
158 | } | |
159 | ||
bfc6fde4 | 160 | wxFrame::~wxFrame() |
2bda0e17 KB |
161 | { |
162 | m_isBeingDeleted = TRUE; | |
163 | wxTopLevelWindows.DeleteObject(this); | |
164 | ||
f6bcfd97 BP |
165 | // the ~wxToolBar() code relies on the previous line to be executed before |
166 | // this one, i.e. the frame should remove itself from wxTopLevelWindows | |
167 | // before destorying its toolbar | |
7c0ea335 | 168 | DeleteAllBars(); |
2bda0e17 KB |
169 | |
170 | if (wxTheApp && (wxTopLevelWindows.Number() == 0)) | |
171 | { | |
172 | wxTheApp->SetTopWindow(NULL); | |
173 | ||
174 | if (wxTheApp->GetExitOnFrameDelete()) | |
175 | { | |
176 | PostQuitMessage(0); | |
177 | } | |
178 | } | |
179 | ||
180 | wxModelessWindows.DeleteObject(this); | |
181 | ||
182 | // For some reason, wxWindows can activate another task altogether | |
183 | // when a frame is destroyed after a modal dialog has been invoked. | |
184 | // Try to bring the parent to the top. | |
36e2955a UM |
185 | // MT:Only do this if this frame is currently the active window, else weird |
186 | // things start to happen | |
187 | if ( wxGetActiveWindow() == this ) | |
2bda0e17 KB |
188 | if (GetParent() && GetParent()->GetHWND()) |
189 | ::BringWindowToTop((HWND) GetParent()->GetHWND()); | |
190 | } | |
191 | ||
81d66cf3 | 192 | // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. |
cc2b7472 | 193 | void wxFrame::DoGetClientSize(int *x, int *y) const |
2bda0e17 KB |
194 | { |
195 | RECT rect; | |
42e69d6b | 196 | ::GetClientRect(GetHwnd(), &rect); |
2bda0e17 | 197 | |
7c0ea335 | 198 | #if wxUSE_STATUSBAR |
a2327a9f | 199 | if ( GetStatusBar() && GetStatusBar()->IsShown() ) |
2bda0e17 | 200 | { |
81d66cf3 JS |
201 | int statusX, statusY; |
202 | GetStatusBar()->GetClientSize(&statusX, &statusY); | |
203 | rect.bottom -= statusY; | |
2bda0e17 | 204 | } |
7c0ea335 | 205 | #endif // wxUSE_STATUSBAR |
81d66cf3 JS |
206 | |
207 | wxPoint pt(GetClientAreaOrigin()); | |
208 | rect.bottom -= pt.y; | |
209 | rect.right -= pt.x; | |
210 | ||
0655ad29 VZ |
211 | if ( x ) |
212 | *x = rect.right; | |
213 | if ( y ) | |
214 | *y = rect.bottom; | |
2bda0e17 KB |
215 | } |
216 | ||
217 | // Set the client size (i.e. leave the calculation of borders etc. | |
218 | // to wxWindows) | |
bfc6fde4 | 219 | void wxFrame::DoSetClientSize(int width, int height) |
2bda0e17 | 220 | { |
42e69d6b | 221 | HWND hWnd = GetHwnd(); |
2bda0e17 KB |
222 | |
223 | RECT rect; | |
2de8030d | 224 | ::GetClientRect(hWnd, &rect); |
2bda0e17 KB |
225 | |
226 | RECT rect2; | |
227 | GetWindowRect(hWnd, &rect2); | |
228 | ||
229 | // Find the difference between the entire window (title bar and all) | |
230 | // and the client area; add this to the new client size to move the | |
231 | // window | |
232 | int actual_width = rect2.right - rect2.left - rect.right + width; | |
233 | int actual_height = rect2.bottom - rect2.top - rect.bottom + height; | |
234 | ||
7c0ea335 | 235 | #if wxUSE_STATUSBAR |
a2327a9f | 236 | if ( GetStatusBar() && GetStatusBar()->IsShown()) |
2bda0e17 | 237 | { |
81d66cf3 JS |
238 | int statusX, statusY; |
239 | GetStatusBar()->GetClientSize(&statusX, &statusY); | |
240 | actual_height += statusY; | |
2bda0e17 | 241 | } |
7c0ea335 | 242 | #endif // wxUSE_STATUSBAR |
2bda0e17 | 243 | |
81d66cf3 JS |
244 | wxPoint pt(GetClientAreaOrigin()); |
245 | actual_width += pt.y; | |
246 | actual_height += pt.x; | |
247 | ||
2bda0e17 KB |
248 | POINT point; |
249 | point.x = rect2.left; | |
250 | point.y = rect2.top; | |
251 | ||
252 | MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)TRUE); | |
debe6624 | 253 | |
2bda0e17 KB |
254 | wxSizeEvent event(wxSize(width, height), m_windowId); |
255 | event.SetEventObject( this ); | |
256 | GetEventHandler()->ProcessEvent(event); | |
2bda0e17 KB |
257 | } |
258 | ||
cc2b7472 | 259 | void wxFrame::DoGetSize(int *width, int *height) const |
2bda0e17 KB |
260 | { |
261 | RECT rect; | |
42e69d6b | 262 | GetWindowRect(GetHwnd(), &rect); |
2bda0e17 KB |
263 | *width = rect.right - rect.left; |
264 | *height = rect.bottom - rect.top; | |
265 | } | |
266 | ||
cc2b7472 | 267 | void wxFrame::DoGetPosition(int *x, int *y) const |
2bda0e17 KB |
268 | { |
269 | RECT rect; | |
42e69d6b | 270 | GetWindowRect(GetHwnd(), &rect); |
2bda0e17 KB |
271 | POINT point; |
272 | point.x = rect.left; | |
273 | point.y = rect.top; | |
274 | ||
275 | *x = point.x; | |
276 | *y = point.y; | |
277 | } | |
278 | ||
7c0ea335 VZ |
279 | // ---------------------------------------------------------------------------- |
280 | // variations around ::ShowWindow() | |
281 | // ---------------------------------------------------------------------------- | |
282 | ||
283 | void wxFrame::DoShowWindow(int nShowCmd) | |
284 | { | |
285 | ::ShowWindow(GetHwnd(), nShowCmd); | |
286 | ||
287 | m_iconized = nShowCmd == SW_MINIMIZE; | |
288 | } | |
289 | ||
debe6624 | 290 | bool wxFrame::Show(bool show) |
2bda0e17 | 291 | { |
f6bcfd97 BP |
292 | // don't use wxWindow version as we want to call DoShowWindow() |
293 | if ( !wxWindowBase::Show(show) ) | |
294 | return FALSE; | |
295 | ||
7c0ea335 | 296 | DoShowWindow(show ? SW_SHOW : SW_HIDE); |
2bda0e17 | 297 | |
7c0ea335 | 298 | if ( show ) |
2bda0e17 | 299 | { |
7c0ea335 | 300 | ::BringWindowToTop(GetHwnd()); |
2bda0e17 | 301 | |
7c0ea335 VZ |
302 | wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId); |
303 | event.SetEventObject( this ); | |
304 | GetEventHandler()->ProcessEvent(event); | |
305 | } | |
306 | else | |
307 | { | |
308 | // Try to highlight the correct window (the parent) | |
309 | if ( GetParent() ) | |
310 | { | |
311 | HWND hWndParent = GetHwndOf(GetParent()); | |
312 | if (hWndParent) | |
313 | ::BringWindowToTop(hWndParent); | |
314 | } | |
315 | } | |
2bda0e17 | 316 | |
7c0ea335 | 317 | return TRUE; |
2bda0e17 KB |
318 | } |
319 | ||
debe6624 | 320 | void wxFrame::Iconize(bool iconize) |
2bda0e17 | 321 | { |
7c0ea335 | 322 | DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE); |
2bda0e17 KB |
323 | } |
324 | ||
debe6624 | 325 | void wxFrame::Maximize(bool maximize) |
2bda0e17 | 326 | { |
7c0ea335 VZ |
327 | DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE); |
328 | } | |
329 | ||
330 | void wxFrame::Restore() | |
331 | { | |
332 | DoShowWindow(SW_RESTORE); | |
2bda0e17 KB |
333 | } |
334 | ||
bfc6fde4 | 335 | bool wxFrame::IsIconized() const |
2bda0e17 | 336 | { |
42e69d6b | 337 | ((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0); |
2bda0e17 KB |
338 | return m_iconized; |
339 | } | |
340 | ||
6f63ec3f | 341 | // Is it maximized? |
bfc6fde4 | 342 | bool wxFrame::IsMaximized() const |
6f63ec3f | 343 | { |
7c0ea335 | 344 | return (::IsZoomed(GetHwnd()) != 0); |
2bda0e17 KB |
345 | } |
346 | ||
347 | void wxFrame::SetIcon(const wxIcon& icon) | |
348 | { | |
7c0ea335 VZ |
349 | wxFrameBase::SetIcon(icon); |
350 | ||
2bda0e17 | 351 | #if defined(__WIN95__) |
7c0ea335 VZ |
352 | if ( m_icon.Ok() ) |
353 | { | |
354 | SendMessage(GetHwnd(), WM_SETICON, | |
355 | (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON()); | |
356 | } | |
357 | #endif // __WIN95__ | |
2bda0e17 KB |
358 | } |
359 | ||
67bd5bad GT |
360 | // generate an artificial resize event |
361 | void wxFrame::SendSizeEvent() | |
362 | { | |
363 | RECT r; | |
364 | #ifdef __WIN16__ | |
365 | ::GetWindowRect(GetHwnd(), &r); | |
366 | #else | |
367 | if ( !::GetWindowRect(GetHwnd(), &r) ) | |
368 | { | |
369 | wxLogLastError(_T("GetWindowRect")); | |
370 | } | |
371 | #endif | |
372 | ||
373 | if ( !m_iconized ) | |
374 | { | |
375 | (void)::PostMessage(GetHwnd(), WM_SIZE, | |
376 | IsMaximized() ? SIZE_MAXIMIZED : SIZE_RESTORED, | |
377 | MAKELPARAM(r.right - r.left, r.bottom - r.top)); | |
378 | } | |
379 | } | |
380 | ||
d427503c | 381 | #if wxUSE_STATUSBAR |
7c0ea335 VZ |
382 | wxStatusBar *wxFrame::OnCreateStatusBar(int number, |
383 | long style, | |
384 | wxWindowID id, | |
385 | const wxString& name) | |
2bda0e17 KB |
386 | { |
387 | wxStatusBar *statusBar = NULL; | |
388 | ||
47d67540 | 389 | #if wxUSE_NATIVE_STATUSBAR |
1f0500b3 | 390 | if ( !UsesNativeStatusBar() ) |
2bda0e17 | 391 | { |
1f0500b3 | 392 | statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style); |
2bda0e17 KB |
393 | } |
394 | else | |
395 | #endif | |
396 | { | |
1f0500b3 VZ |
397 | statusBar = new wxStatusBar(this, id, style, name); |
398 | } | |
ed791986 | 399 | |
1f0500b3 VZ |
400 | // Set the height according to the font and the border size |
401 | wxClientDC dc(statusBar); | |
402 | dc.SetFont(statusBar->GetFont()); | |
ed791986 | 403 | |
1f0500b3 VZ |
404 | wxCoord y; |
405 | dc.GetTextExtent(_T("X"), NULL, &y ); | |
ed791986 | 406 | |
1f0500b3 | 407 | int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY()); |
ed791986 | 408 | |
1f0500b3 | 409 | statusBar->SetSize(-1, -1, -1, height); |
ed791986 | 410 | |
1f0500b3 | 411 | statusBar->SetFieldsCount(number); |
2bda0e17 | 412 | |
7c0ea335 | 413 | return statusBar; |
2bda0e17 KB |
414 | } |
415 | ||
bfc6fde4 | 416 | void wxFrame::PositionStatusBar() |
2bda0e17 | 417 | { |
ed791986 VZ |
418 | if ( !m_frameStatusBar ) |
419 | return; | |
420 | ||
cbc66a27 VZ |
421 | int w, h; |
422 | GetClientSize(&w, &h); | |
423 | int sw, sh; | |
424 | m_frameStatusBar->GetSize(&sw, &sh); | |
425 | ||
426 | // Since we wish the status bar to be directly under the client area, | |
427 | // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. | |
428 | m_frameStatusBar->SetSize(0, h, w, sh); | |
2bda0e17 | 429 | } |
d427503c | 430 | #endif // wxUSE_STATUSBAR |
2bda0e17 | 431 | |
ea9a4296 UM |
432 | void wxFrame::DetachMenuBar() |
433 | { | |
f6bcfd97 | 434 | if ( m_frameMenuBar ) |
ea9a4296 UM |
435 | { |
436 | m_frameMenuBar->Detach(); | |
437 | m_frameMenuBar = NULL; | |
438 | } | |
439 | } | |
440 | ||
f6bcfd97 | 441 | void wxFrame::SetMenuBar(wxMenuBar *menubar) |
2bda0e17 | 442 | { |
f6bcfd97 | 443 | if ( !menubar ) |
c2dcfdef | 444 | { |
ea9a4296 | 445 | DetachMenuBar(); |
2bda0e17 | 446 | |
f6bcfd97 BP |
447 | // actually remove the menu from the frame |
448 | m_hMenu = (WXHMENU)0; | |
449 | InternalSetMenuBar(); | |
065de612 | 450 | } |
f6bcfd97 | 451 | else // set new non NULL menu bar |
065de612 | 452 | { |
f6bcfd97 | 453 | m_frameMenuBar = NULL; |
065de612 | 454 | |
f6bcfd97 BP |
455 | // Can set a menubar several times. |
456 | // TODO: how to prevent a memory leak if you have a currently-unattached | |
457 | // menubar? wxWindows assumes that the frame will delete the menu (otherwise | |
458 | // there are problems for MDI). | |
459 | if ( menubar->GetHMenu() ) | |
460 | { | |
461 | m_hMenu = menubar->GetHMenu(); | |
462 | } | |
463 | else | |
464 | { | |
465 | menubar->Detach(); | |
065de612 | 466 | |
f6bcfd97 | 467 | m_hMenu = menubar->Create(); |
065de612 | 468 | |
f6bcfd97 BP |
469 | if ( !m_hMenu ) |
470 | return; | |
471 | } | |
065de612 | 472 | |
f6bcfd97 | 473 | InternalSetMenuBar(); |
065de612 | 474 | |
f6bcfd97 BP |
475 | m_frameMenuBar = menubar; |
476 | menubar->Attach(this); | |
065de612 | 477 | } |
2bda0e17 KB |
478 | } |
479 | ||
42e69d6b | 480 | void wxFrame::InternalSetMenuBar() |
2bda0e17 | 481 | { |
42e69d6b | 482 | if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) |
2bda0e17 | 483 | { |
f6bcfd97 | 484 | wxLogLastError(wxT("SetMenu")); |
2bda0e17 | 485 | } |
2bda0e17 KB |
486 | } |
487 | ||
488 | // Responds to colour changes, and passes event on to children. | |
489 | void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) | |
490 | { | |
491 | SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); | |
492 | Refresh(); | |
493 | ||
494 | if ( m_frameStatusBar ) | |
495 | { | |
496 | wxSysColourChangedEvent event2; | |
497 | event2.SetEventObject( m_frameStatusBar ); | |
02800301 | 498 | m_frameStatusBar->GetEventHandler()->ProcessEvent(event2); |
2bda0e17 KB |
499 | } |
500 | ||
501 | // Propagate the event to the non-top-level children | |
502 | wxWindow::OnSysColourChanged(event); | |
503 | } | |
504 | ||
a2327a9f JS |
505 | // Pass TRUE to show full screen, FALSE to restore. |
506 | bool wxFrame::ShowFullScreen(bool show, long style) | |
507 | { | |
508 | if (show) | |
509 | { | |
510 | if (IsFullScreen()) | |
511 | return FALSE; | |
512 | ||
513 | m_fsIsShowing = TRUE; | |
514 | m_fsStyle = style; | |
515 | ||
f6bcfd97 BP |
516 | wxToolBar *theToolBar = GetToolBar(); |
517 | wxStatusBar *theStatusBar = GetStatusBar(); | |
a2327a9f JS |
518 | |
519 | int dummyWidth; | |
520 | ||
521 | if (theToolBar) | |
522 | theToolBar->GetSize(&dummyWidth, &m_fsToolBarHeight); | |
523 | if (theStatusBar) | |
524 | theStatusBar->GetSize(&dummyWidth, &m_fsStatusBarHeight); | |
525 | ||
526 | // zap the toolbar, menubar, and statusbar | |
527 | ||
528 | if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) | |
529 | { | |
530 | theToolBar->SetSize(-1,0); | |
531 | theToolBar->Show(FALSE); | |
532 | } | |
533 | ||
534 | if (style & wxFULLSCREEN_NOMENUBAR) | |
535 | SetMenu((HWND)GetHWND(), (HMENU) NULL); | |
536 | ||
537 | // Save the number of fields in the statusbar | |
538 | if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) | |
539 | { | |
579b10c2 JS |
540 | //m_fsStatusBarFields = theStatusBar->GetFieldsCount(); |
541 | //SetStatusBar((wxStatusBar*) NULL); | |
542 | //delete theStatusBar; | |
543 | theStatusBar->Show(FALSE); | |
a2327a9f JS |
544 | } |
545 | else | |
546 | m_fsStatusBarFields = 0; | |
547 | ||
548 | // zap the frame borders | |
549 | ||
550 | // save the 'normal' window style | |
551 | m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE); | |
552 | ||
f6bcfd97 | 553 | // save the old position, width & height, maximize state |
a2327a9f | 554 | m_fsOldSize = GetRect(); |
f6bcfd97 | 555 | m_fsIsMaximized = IsMaximized(); |
a2327a9f | 556 | |
f6bcfd97 | 557 | // decide which window style flags to turn off |
a2327a9f JS |
558 | LONG newStyle = m_fsOldWindowStyle; |
559 | LONG offFlags = 0; | |
560 | ||
561 | if (style & wxFULLSCREEN_NOBORDER) | |
562 | offFlags |= WS_BORDER; | |
563 | if (style & wxFULLSCREEN_NOCAPTION) | |
564 | offFlags |= (WS_CAPTION | WS_SYSMENU); | |
565 | ||
566 | newStyle &= (~offFlags); | |
567 | ||
568 | // change our window style to be compatible with full-screen mode | |
569 | SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle); | |
570 | ||
571 | // resize to the size of the desktop | |
572 | int width, height; | |
573 | ||
574 | RECT rect; | |
575 | ::GetWindowRect(GetDesktopWindow(), &rect); | |
576 | width = rect.right - rect.left; | |
577 | height = rect.bottom - rect.top; | |
578 | ||
579 | SetSize(width, height); | |
580 | ||
581 | // now flush the window style cache and actually go full-screen | |
582 | SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED); | |
583 | ||
584 | wxSizeEvent event(wxSize(width, height), GetId()); | |
585 | GetEventHandler()->ProcessEvent(event); | |
586 | ||
587 | return TRUE; | |
588 | } | |
589 | else | |
590 | { | |
591 | if (!IsFullScreen()) | |
592 | return FALSE; | |
593 | ||
594 | m_fsIsShowing = FALSE; | |
595 | ||
596 | wxToolBar *theToolBar = GetToolBar(); | |
597 | ||
598 | // restore the toolbar, menubar, and statusbar | |
599 | if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR)) | |
600 | { | |
601 | theToolBar->SetSize(-1, m_fsToolBarHeight); | |
602 | theToolBar->Show(TRUE); | |
603 | } | |
604 | ||
579b10c2 | 605 | if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR)) // && (m_fsStatusBarFields > 0)) |
a2327a9f | 606 | { |
579b10c2 JS |
607 | //CreateStatusBar(m_fsStatusBarFields); |
608 | if (GetStatusBar()) | |
609 | { | |
610 | GetStatusBar()->Show(TRUE); | |
611 | PositionStatusBar(); | |
612 | } | |
a2327a9f JS |
613 | } |
614 | ||
615 | if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) | |
616 | SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); | |
617 | ||
618 | Maximize(m_fsIsMaximized); | |
619 | SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle); | |
620 | SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y, | |
621 | m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED); | |
622 | ||
623 | return TRUE; | |
624 | } | |
625 | } | |
626 | ||
2bda0e17 KB |
627 | /* |
628 | * Frame window | |
629 | * | |
630 | */ | |
631 | ||
837e5743 | 632 | bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title, |
debe6624 | 633 | int x, int y, int width, int height, long style) |
2bda0e17 KB |
634 | |
635 | { | |
636 | m_defaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); | |
637 | ||
638 | // If child windows aren't properly drawn initially, WS_CLIPCHILDREN | |
639 | // could be the culprit. But without it, you can get a lot of flicker. | |
640 | ||
2bda0e17 | 641 | DWORD msflags = 0; |
3ca6a5f0 BP |
642 | if ( style & wxCAPTION ) |
643 | { | |
644 | if ( style & wxFRAME_TOOL_WINDOW ) | |
645 | msflags |= WS_POPUPWINDOW; | |
646 | else | |
647 | msflags |= WS_OVERLAPPED; | |
648 | } | |
2bda0e17 | 649 | else |
3ca6a5f0 BP |
650 | { |
651 | msflags |= WS_POPUP; | |
652 | } | |
2bda0e17 KB |
653 | |
654 | if (style & wxMINIMIZE_BOX) | |
655 | msflags |= WS_MINIMIZEBOX; | |
656 | if (style & wxMAXIMIZE_BOX) | |
657 | msflags |= WS_MAXIMIZEBOX; | |
658 | if (style & wxTHICK_FRAME) | |
659 | msflags |= WS_THICKFRAME; | |
660 | if (style & wxSYSTEM_MENU) | |
661 | msflags |= WS_SYSMENU; | |
f6bcfd97 | 662 | if ( style & wxMINIMIZE ) |
2bda0e17 KB |
663 | msflags |= WS_MINIMIZE; |
664 | if (style & wxMAXIMIZE) | |
665 | msflags |= WS_MAXIMIZE; | |
666 | if (style & wxCAPTION) | |
667 | msflags |= WS_CAPTION; | |
1c089c47 JS |
668 | if (style & wxCLIP_CHILDREN) |
669 | msflags |= WS_CLIPCHILDREN; | |
2bda0e17 KB |
670 | |
671 | // Keep this in wxFrame because it saves recoding this function | |
672 | // in wxTinyFrame | |
8355a72f | 673 | #if wxUSE_ITSY_BITSY && !defined(__WIN32__) |
2bda0e17 KB |
674 | if (style & wxTINY_CAPTION_VERT) |
675 | msflags |= IBS_VERTCAPTION; | |
676 | if (style & wxTINY_CAPTION_HORIZ) | |
677 | msflags |= IBS_HORZCAPTION; | |
678 | #else | |
679 | if (style & wxTINY_CAPTION_VERT) | |
680 | msflags |= WS_CAPTION; | |
681 | if (style & wxTINY_CAPTION_HORIZ) | |
682 | msflags |= WS_CAPTION; | |
683 | #endif | |
684 | if ((style & wxTHICK_FRAME) == 0) | |
685 | msflags |= WS_BORDER; | |
686 | ||
687 | WXDWORD extendedStyle = MakeExtendedStyle(style); | |
688 | ||
b0a6bb75 | 689 | // make all frames appear in the win9x shell taskbar unless |
b3daa5a3 | 690 | // wxFRAME_TOOL_WINDOW or wxFRAME_NO_TASKBAR is given - without giving them |
b0a6bb75 | 691 | // WS_EX_APPWINDOW style, the child (i.e. owned) frames wouldn't appear in it |
2432b92d | 692 | #if !defined(__WIN16__) && !defined(__SC__) |
4b9fc37a GT |
693 | if ( (style & wxFRAME_TOOL_WINDOW) || |
694 | (style & wxFRAME_NO_TASKBAR) ) | |
b0a6bb75 | 695 | extendedStyle |= WS_EX_TOOLWINDOW; |
b3daa5a3 | 696 | else if ( !(style & wxFRAME_NO_TASKBAR) ) |
b0a6bb75 | 697 | extendedStyle |= WS_EX_APPWINDOW; |
1e6d9499 | 698 | #endif |
cd2df130 | 699 | |
2bda0e17 KB |
700 | if (style & wxSTAY_ON_TOP) |
701 | extendedStyle |= WS_EX_TOPMOST; | |
702 | ||
4204da65 | 703 | #ifndef __WIN16__ |
b96340e6 JS |
704 | if (m_exStyle & wxFRAME_EX_CONTEXTHELP) |
705 | extendedStyle |= WS_EX_CONTEXTHELP; | |
4204da65 | 706 | #endif |
b96340e6 | 707 | |
2bda0e17 | 708 | m_iconized = FALSE; |
a23fd0e1 VZ |
709 | if ( !wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height, |
710 | msflags, NULL, extendedStyle) ) | |
711 | return FALSE; | |
712 | ||
2bda0e17 KB |
713 | // Seems to be necessary if we use WS_POPUP |
714 | // style instead of WS_OVERLAPPED | |
715 | if (width > -1 && height > -1) | |
42e69d6b | 716 | ::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height)); |
a23fd0e1 VZ |
717 | |
718 | return TRUE; | |
2bda0e17 KB |
719 | } |
720 | ||
2bda0e17 KB |
721 | // Default activation behaviour - set the focus for the first child |
722 | // subwindow found. | |
723 | void wxFrame::OnActivate(wxActivateEvent& event) | |
724 | { | |
f6bcfd97 | 725 | if ( event.GetActive() ) |
00c4e897 | 726 | { |
f6bcfd97 BP |
727 | // restore focus to the child which was last focused |
728 | wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); | |
00c4e897 | 729 | |
e9456d8d VZ |
730 | wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent() |
731 | : NULL; | |
732 | if ( !parent ) | |
733 | { | |
734 | parent = this; | |
735 | } | |
736 | ||
737 | wxSetFocusToChild(parent, &m_winLastFocused); | |
00c4e897 | 738 | } |
e9456d8d | 739 | else // deactivating |
2bda0e17 | 740 | { |
e9456d8d | 741 | // remember the last focused child if it is our child |
f6bcfd97 | 742 | m_winLastFocused = FindFocus(); |
e9456d8d VZ |
743 | |
744 | // so we NULL it out if it's a child from some other frame | |
745 | wxWindow *win = m_winLastFocused; | |
746 | while ( win ) | |
319fefa9 | 747 | { |
e9456d8d VZ |
748 | if ( win->IsTopLevel() ) |
749 | { | |
750 | if ( win != this ) | |
751 | { | |
752 | m_winLastFocused = NULL; | |
753 | } | |
754 | ||
f6bcfd97 | 755 | break; |
e9456d8d | 756 | } |
f6bcfd97 | 757 | |
e9456d8d | 758 | win = win->GetParent(); |
319fefa9 | 759 | } |
f6bcfd97 BP |
760 | |
761 | wxLogTrace(_T("focus"), | |
762 | _T("wxFrame %08x deactivated, last focused: %08x."), | |
763 | m_hWnd, | |
764 | m_winLastFocused ? GetHwndOf(m_winLastFocused) | |
765 | : NULL); | |
766 | ||
767 | event.Skip(); | |
2bda0e17 | 768 | } |
2bda0e17 KB |
769 | } |
770 | ||
7c0ea335 VZ |
771 | // ---------------------------------------------------------------------------- |
772 | // tool/status bar stuff | |
773 | // ---------------------------------------------------------------------------- | |
774 | ||
d427503c | 775 | #if wxUSE_TOOLBAR |
7c0ea335 | 776 | |
81d66cf3 JS |
777 | wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) |
778 | { | |
7c0ea335 | 779 | if ( wxFrameBase::CreateToolBar(style, id, name) ) |
81d66cf3 | 780 | { |
81d66cf3 | 781 | PositionToolBar(); |
81d66cf3 | 782 | } |
81d66cf3 | 783 | |
7c0ea335 | 784 | return m_frameToolBar; |
81d66cf3 JS |
785 | } |
786 | ||
bfc6fde4 | 787 | void wxFrame::PositionToolBar() |
81d66cf3 | 788 | { |
81d66cf3 | 789 | RECT rect; |
42e69d6b | 790 | ::GetClientRect(GetHwnd(), &rect); |
81d66cf3 | 791 | |
7c0ea335 | 792 | #if wxUSE_STATUSBAR |
81d66cf3 JS |
793 | if ( GetStatusBar() ) |
794 | { | |
7c0ea335 VZ |
795 | int statusX, statusY; |
796 | GetStatusBar()->GetClientSize(&statusX, &statusY); | |
797 | rect.bottom -= statusY; | |
81d66cf3 | 798 | } |
7c0ea335 | 799 | #endif // wxUSE_STATUSBAR |
81d66cf3 | 800 | |
a2327a9f | 801 | if ( GetToolBar() && GetToolBar()->IsShown() ) |
81d66cf3 JS |
802 | { |
803 | int tw, th; | |
7c0ea335 | 804 | GetToolBar()->GetSize(&tw, &th); |
81d66cf3 | 805 | |
7c0ea335 | 806 | if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL ) |
81d66cf3 | 807 | { |
7c0ea335 | 808 | th = rect.bottom; |
81d66cf3 JS |
809 | } |
810 | else | |
811 | { | |
7c0ea335 | 812 | tw = rect.right; |
81d66cf3 | 813 | } |
7c0ea335 VZ |
814 | |
815 | // Use the 'real' MSW position here | |
816 | GetToolBar()->SetSize(0, 0, tw, th, wxSIZE_NO_ADJUSTMENTS); | |
81d66cf3 JS |
817 | } |
818 | } | |
d427503c | 819 | #endif // wxUSE_TOOLBAR |
d2aef312 | 820 | |
7c0ea335 VZ |
821 | // ---------------------------------------------------------------------------- |
822 | // frame state (iconized/maximized/...) | |
823 | // ---------------------------------------------------------------------------- | |
824 | ||
a23fd0e1 VZ |
825 | // propagate our state change to all child frames: this allows us to emulate X |
826 | // Windows behaviour where child frames float independently of the parent one | |
827 | // on the desktop, but are iconized/restored with it | |
d2aef312 VZ |
828 | void wxFrame::IconizeChildFrames(bool bIconize) |
829 | { | |
a23fd0e1 VZ |
830 | for ( wxWindowList::Node *node = GetChildren().GetFirst(); |
831 | node; | |
832 | node = node->GetNext() ) | |
833 | { | |
834 | wxWindow *win = node->GetData(); | |
835 | ||
3ca6a5f0 BP |
836 | // iconizing the frames with this style under Win95 shell puts them at |
837 | // the bottom of the screen (as the MDI children) instead of making | |
838 | // them appear in the taskbar because they are, by virtue of this | |
839 | // style, not managed by the taskbar - instead leave Windows take care | |
840 | // of them | |
841 | #ifdef __WIN95__ | |
842 | if ( win->GetWindowStyle() & wxFRAME_TOOL_WINDOW ) | |
843 | continue; | |
844 | #endif // Win95 | |
845 | ||
3f7bc32b VZ |
846 | // the child MDI frames are a special case and should not be touched by |
847 | // the parent frame - instead, they are managed by the user | |
848 | wxFrame *frame = wxDynamicCast(win, wxFrame); | |
91dd52fe | 849 | if ( frame && !frame->IsMDIChild() ) |
a23fd0e1 | 850 | { |
3f7bc32b | 851 | frame->Iconize(bIconize); |
a23fd0e1 | 852 | } |
d2aef312 | 853 | } |
d2aef312 VZ |
854 | } |
855 | ||
a23fd0e1 | 856 | // =========================================================================== |
42e69d6b | 857 | // message processing |
a23fd0e1 VZ |
858 | // =========================================================================== |
859 | ||
42e69d6b VZ |
860 | // --------------------------------------------------------------------------- |
861 | // preprocessing | |
862 | // --------------------------------------------------------------------------- | |
863 | ||
864 | bool wxFrame::MSWTranslateMessage(WXMSG* pMsg) | |
865 | { | |
866 | if ( wxWindow::MSWTranslateMessage(pMsg) ) | |
867 | return TRUE; | |
868 | ||
869 | // try the menu bar accels | |
870 | wxMenuBar *menuBar = GetMenuBar(); | |
871 | if ( !menuBar ) | |
872 | return FALSE; | |
873 | ||
874 | const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable(); | |
c50f1fb9 | 875 | return acceleratorTable.Translate(this, pMsg); |
42e69d6b VZ |
876 | } |
877 | ||
878 | // --------------------------------------------------------------------------- | |
879 | // our private (non virtual) message handlers | |
880 | // --------------------------------------------------------------------------- | |
881 | ||
882 | bool wxFrame::HandlePaint() | |
883 | { | |
884 | RECT rect; | |
885 | if ( GetUpdateRect(GetHwnd(), &rect, FALSE) ) | |
886 | { | |
887 | if ( m_iconized ) | |
888 | { | |
c50f1fb9 | 889 | HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) |
42e69d6b VZ |
890 | : (HICON)m_defaultIcon; |
891 | ||
892 | // Hold a pointer to the dc so long as the OnPaint() message | |
893 | // is being processed | |
894 | PAINTSTRUCT ps; | |
895 | HDC hdc = ::BeginPaint(GetHwnd(), &ps); | |
896 | ||
897 | // Erase background before painting or we get white background | |
898 | MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L); | |
899 | ||
900 | if ( hIcon ) | |
901 | { | |
902 | RECT rect; | |
903 | ::GetClientRect(GetHwnd(), &rect); | |
904 | ||
905 | // FIXME: why hardcoded? | |
906 | static const int icon_width = 32; | |
907 | static const int icon_height = 32; | |
908 | ||
909 | int icon_x = (int)((rect.right - icon_width)/2); | |
910 | int icon_y = (int)((rect.bottom - icon_height)/2); | |
911 | ||
912 | ::DrawIcon(hdc, icon_x, icon_y, hIcon); | |
913 | } | |
914 | ||
915 | ::EndPaint(GetHwnd(), &ps); | |
916 | ||
917 | return TRUE; | |
918 | } | |
919 | else | |
920 | { | |
5d1d2d46 | 921 | return wxWindow::HandlePaint(); |
42e69d6b VZ |
922 | } |
923 | } | |
924 | else | |
925 | { | |
926 | // nothing to paint - processed | |
927 | return TRUE; | |
928 | } | |
929 | } | |
930 | ||
931 | bool wxFrame::HandleSize(int x, int y, WXUINT id) | |
932 | { | |
933 | bool processed = FALSE; | |
934 | ||
935 | switch ( id ) | |
936 | { | |
937 | case SIZENORMAL: | |
938 | // only do it it if we were iconized before, otherwise resizing the | |
939 | // parent frame has a curious side effect of bringing it under it's | |
940 | // children | |
941 | if ( !m_iconized ) | |
942 | break; | |
943 | ||
944 | // restore all child frames too | |
945 | IconizeChildFrames(FALSE); | |
946 | ||
947 | // fall through | |
948 | ||
949 | case SIZEFULLSCREEN: | |
950 | m_iconized = FALSE; | |
951 | break; | |
952 | ||
953 | case SIZEICONIC: | |
954 | // iconize all child frames too | |
955 | IconizeChildFrames(TRUE); | |
956 | ||
957 | m_iconized = TRUE; | |
958 | break; | |
959 | } | |
960 | ||
961 | if ( !m_iconized ) | |
962 | { | |
42e69d6b VZ |
963 | PositionStatusBar(); |
964 | PositionToolBar(); | |
965 | ||
966 | wxSizeEvent event(wxSize(x, y), m_windowId); | |
967 | event.SetEventObject( this ); | |
968 | processed = GetEventHandler()->ProcessEvent(event); | |
969 | } | |
970 | ||
971 | return processed; | |
972 | } | |
973 | ||
974 | bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) | |
975 | { | |
976 | if ( control ) | |
977 | { | |
978 | // In case it's e.g. a toolbar. | |
979 | wxWindow *win = wxFindWinFromHandle(control); | |
980 | if ( win ) | |
981 | return win->MSWCommand(cmd, id); | |
982 | } | |
983 | ||
984 | // handle here commands from menus and accelerators | |
985 | if ( cmd == 0 || cmd == 1 ) | |
986 | { | |
987 | if ( wxCurrentPopupMenu ) | |
988 | { | |
989 | wxMenu *popupMenu = wxCurrentPopupMenu; | |
990 | wxCurrentPopupMenu = NULL; | |
991 | ||
992 | return popupMenu->MSWCommand(cmd, id); | |
993 | } | |
994 | ||
995 | if ( ProcessCommand(id) ) | |
996 | { | |
997 | return TRUE; | |
998 | } | |
999 | } | |
1000 | ||
1001 | return FALSE; | |
1002 | } | |
1003 | ||
c219cecc | 1004 | bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) |
a23fd0e1 VZ |
1005 | { |
1006 | int item; | |
c219cecc | 1007 | if ( flags == 0xFFFF && hMenu == 0 ) |
a23fd0e1 | 1008 | { |
c219cecc | 1009 | // menu was removed from screen |
a23fd0e1 VZ |
1010 | item = -1; |
1011 | } | |
c219cecc | 1012 | else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) ) |
a23fd0e1 VZ |
1013 | { |
1014 | item = nItem; | |
1015 | } | |
1016 | else | |
1017 | { | |
c219cecc | 1018 | // don't give hints for separators (doesn't make sense) nor for the |
f6bcfd97 BP |
1019 | // items opening popup menus (they don't have them anyhow) but do clear |
1020 | // the status line - otherwise, we would be left with the help message | |
1021 | // for the previous item which doesn't apply any more | |
1022 | wxStatusBar *statbar = GetStatusBar(); | |
1023 | if ( statbar ) | |
1024 | { | |
1025 | statbar->SetStatusText(wxEmptyString); | |
1026 | } | |
1027 | ||
a23fd0e1 VZ |
1028 | return FALSE; |
1029 | } | |
1030 | ||
1031 | wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); | |
1032 | event.SetEventObject( this ); | |
1033 | ||
1034 | return GetEventHandler()->ProcessEvent(event); | |
1035 | } | |
1036 | ||
1037 | // --------------------------------------------------------------------------- | |
1038 | // the window proc for wxFrame | |
1039 | // --------------------------------------------------------------------------- | |
1040 | ||
1041 | long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) | |
1042 | { | |
1043 | long rc = 0; | |
1044 | bool processed = FALSE; | |
1045 | ||
1046 | switch ( message ) | |
1047 | { | |
42e69d6b VZ |
1048 | case WM_CLOSE: |
1049 | // if we can't close, tell the system that we processed the | |
1050 | // message - otherwise it would close us | |
1051 | processed = !Close(); | |
1052 | break; | |
1053 | ||
1054 | case WM_COMMAND: | |
1055 | { | |
1056 | WORD id, cmd; | |
1057 | WXHWND hwnd; | |
1058 | UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam, | |
1059 | &id, &hwnd, &cmd); | |
1060 | ||
1061 | processed = HandleCommand(id, cmd, (WXHWND)hwnd); | |
1062 | } | |
1063 | break; | |
1064 | ||
a23fd0e1 VZ |
1065 | case WM_MENUSELECT: |
1066 | { | |
42e69d6b VZ |
1067 | WXWORD item, flags; |
1068 | WXHMENU hmenu; | |
1069 | UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); | |
1070 | ||
1071 | processed = HandleMenuSelect(item, flags, hmenu); | |
a23fd0e1 VZ |
1072 | } |
1073 | break; | |
42e69d6b VZ |
1074 | |
1075 | case WM_PAINT: | |
1076 | processed = HandlePaint(); | |
1077 | break; | |
1078 | ||
1079 | case WM_QUERYDRAGICON: | |
1080 | { | |
c50f1fb9 | 1081 | HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) |
42e69d6b VZ |
1082 | : (HICON)(m_defaultIcon); |
1083 | rc = (long)hIcon; | |
1084 | processed = rc != 0; | |
1085 | } | |
1086 | break; | |
1087 | ||
1088 | case WM_SIZE: | |
1089 | processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); | |
1090 | break; | |
a23fd0e1 VZ |
1091 | } |
1092 | ||
1093 | if ( !processed ) | |
1094 | rc = wxWindow::MSWWindowProc(message, wParam, lParam); | |
1095 | ||
1096 | return rc; | |
1097 | } | |
21802234 | 1098 |