]> git.saurik.com Git - wxWidgets.git/blob - src/msw/frame.cpp
3455129a19d7c5bd28bf5b028a2ef19c73a012e5
[wxWidgets.git] / src / msw / frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/frame.cpp
3 // Purpose: wxFrame
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "frame.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
32 #include "wx/frame.h"
33 #include "wx/app.h"
34 #include "wx/menu.h"
35 #include "wx/utils.h"
36 #include "wx/dialog.h"
37 #include "wx/settings.h"
38 #include "wx/dcclient.h"
39 #include "wx/mdi.h"
40 #include "wx/panel.h"
41 #endif // WX_PRECOMP
42
43 #include "wx/msw/private.h"
44
45 #ifdef __WXWINCE__
46 #include <commctrl.h>
47 #endif
48
49 #if wxUSE_STATUSBAR
50 #include "wx/statusbr.h"
51 #include "wx/generic/statusbr.h"
52 #endif // wxUSE_STATUSBAR
53
54 #if wxUSE_TOOLBAR
55 #include "wx/toolbar.h"
56 #endif // wxUSE_TOOLBAR
57
58 #include "wx/menuitem.h"
59 #include "wx/log.h"
60
61 #ifdef __WXUNIVERSAL__
62 #include "wx/univ/theme.h"
63 #include "wx/univ/colschem.h"
64 #endif // __WXUNIVERSAL__
65
66 // ----------------------------------------------------------------------------
67 // globals
68 // ----------------------------------------------------------------------------
69
70 #if wxUSE_MENUS_NATIVE
71 extern wxMenu *wxCurrentPopupMenu;
72 #endif // wxUSE_MENUS_NATIVE
73
74 // ----------------------------------------------------------------------------
75 // event tables
76 // ----------------------------------------------------------------------------
77
78 BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
79 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
80 END_EVENT_TABLE()
81
82 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
83
84 // ============================================================================
85 // implementation
86 // ============================================================================
87
88 // ----------------------------------------------------------------------------
89 // static class members
90 // ----------------------------------------------------------------------------
91
92 #if wxUSE_STATUSBAR
93 #if wxUSE_NATIVE_STATUSBAR
94 bool wxFrame::m_useNativeStatusBar = TRUE;
95 #else
96 bool wxFrame::m_useNativeStatusBar = FALSE;
97 #endif
98 #endif // wxUSE_NATIVE_STATUSBAR
99
100 // ----------------------------------------------------------------------------
101 // creation/destruction
102 // ----------------------------------------------------------------------------
103
104 void wxFrame::Init()
105 {
106 #if wxUSE_TOOLTIPS
107 m_hwndToolTip = 0;
108 #endif
109 #ifdef __WXWINCE__
110 m_commandBar = 0;
111 #endif
112
113 // Data to save/restore when calling ShowFullScreen
114 m_fsStatusBarFields = 0;
115 m_fsStatusBarHeight = 0;
116 m_fsToolBarHeight = 0;
117
118 m_wasMinimized = FALSE;
119 }
120
121 bool wxFrame::Create(wxWindow *parent,
122 wxWindowID id,
123 const wxString& title,
124 const wxPoint& pos,
125 const wxSize& size,
126 long style,
127 const wxString& name)
128 {
129 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
130 return FALSE;
131
132 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
133
134 wxModelessWindows.Append(this);
135
136 return TRUE;
137 }
138
139 wxFrame::~wxFrame()
140 {
141 m_isBeingDeleted = TRUE;
142 DeleteAllBars();
143 #ifdef __WXWINCE__
144 if (m_commandBar)
145 {
146 ::DestroyWindow((HWND) m_commandBar);
147 m_commandBar = NULL;
148 }
149 #endif
150
151 }
152
153 // ----------------------------------------------------------------------------
154 // wxFrame client size calculations
155 // ----------------------------------------------------------------------------
156
157 void wxFrame::DoSetClientSize(int width, int height)
158 {
159 // leave enough space for the status bar if we have (and show) it
160 #if wxUSE_STATUSBAR
161 wxStatusBar *statbar = GetStatusBar();
162 if ( statbar && statbar->IsShown() )
163 {
164 height += statbar->GetSize().y;
165 }
166 #endif // wxUSE_STATUSBAR
167
168 // call GetClientAreaOrigin() to take the toolbar into account
169 wxPoint pt = GetClientAreaOrigin();
170 width += pt.x;
171 height += pt.y;
172
173 wxTopLevelWindow::DoSetClientSize(width, height);
174 }
175
176 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
177 void wxFrame::DoGetClientSize(int *x, int *y) const
178 {
179 wxTopLevelWindow::DoGetClientSize(x, y);
180
181 // account for the possible toolbar
182 wxPoint pt = GetClientAreaOrigin();
183 if ( x )
184 *x -= pt.x;
185
186 if ( y )
187 *y -= pt.y;
188
189 #if wxUSE_STATUSBAR
190 // adjust client area height to take the status bar into account
191 if ( y )
192 {
193 wxStatusBar *statbar = GetStatusBar();
194 if ( statbar && statbar->IsShown() )
195 {
196 *y -= statbar->GetClientSize().y;
197 }
198 }
199 #endif // wxUSE_STATUSBAR
200 }
201
202 // ----------------------------------------------------------------------------
203 // wxFrame: various geometry-related functions
204 // ----------------------------------------------------------------------------
205
206 void wxFrame::Raise()
207 {
208 ::SetForegroundWindow(GetHwnd());
209 }
210
211 // generate an artificial resize event
212 void wxFrame::SendSizeEvent()
213 {
214 if ( !m_iconized )
215 {
216 RECT r = wxGetWindowRect(GetHwnd());
217
218 (void)::PostMessage(GetHwnd(), WM_SIZE,
219 IsMaximized() ? SIZE_MAXIMIZED : SIZE_RESTORED,
220 MAKELPARAM(r.right - r.left, r.bottom - r.top));
221 }
222 }
223
224 #if wxUSE_STATUSBAR
225 wxStatusBar *wxFrame::OnCreateStatusBar(int number,
226 long style,
227 wxWindowID id,
228 const wxString& name)
229 {
230 wxStatusBar *statusBar = NULL;
231
232 #if wxUSE_NATIVE_STATUSBAR
233 if ( !UsesNativeStatusBar() )
234 {
235 statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style);
236 }
237 else
238 #endif
239 {
240 statusBar = new wxStatusBar(this, id, style, name);
241 }
242
243 statusBar->SetFieldsCount(number);
244
245 return statusBar;
246 }
247
248 void wxFrame::PositionStatusBar()
249 {
250 if ( !m_frameStatusBar || !m_frameStatusBar->IsShown() )
251 return;
252
253 int w, h;
254 GetClientSize(&w, &h);
255 int sw, sh;
256 m_frameStatusBar->GetSize(&sw, &sh);
257
258 // Since we wish the status bar to be directly under the client area,
259 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
260 m_frameStatusBar->SetSize(0, h, w, sh);
261 }
262 #endif // wxUSE_STATUSBAR
263
264 #if wxUSE_MENUS_NATIVE
265
266 void wxFrame::AttachMenuBar(wxMenuBar *menubar)
267 {
268 wxFrameBase::AttachMenuBar(menubar);
269
270 if ( !menubar )
271 {
272 // actually remove the menu from the frame
273 m_hMenu = (WXHMENU)0;
274 InternalSetMenuBar();
275 }
276 else // set new non NULL menu bar
277 {
278 // Can set a menubar several times.
279 if ( menubar->GetHMenu() )
280 {
281 m_hMenu = menubar->GetHMenu();
282 }
283 else // no HMENU yet
284 {
285 m_hMenu = menubar->Create();
286
287 if ( !m_hMenu )
288 {
289 wxFAIL_MSG( _T("failed to create menu bar") );
290 return;
291 }
292 }
293
294 InternalSetMenuBar();
295 }
296 }
297
298 void wxFrame::InternalSetMenuBar()
299 {
300 #ifdef __WXMICROWIN__
301 // Nothing
302 #elif defined(__WXWINCE__)
303 if (!m_commandBar)
304 {
305 // TODO: what identifer shall we use?
306 // TODO: eventually have a wxCommandBar class
307 m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), GetHwnd(), 999);
308 }
309 if (m_commandBar)
310 {
311 CommandBar_InsertMenubarEx((HWND) m_commandBar, wxGetInstance(),
312 (LPTSTR) (HMENU) m_hMenu, 0);
313 }
314 #else
315 if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
316 {
317 wxLogLastError(wxT("SetMenu"));
318 }
319 #endif
320 }
321
322 #endif // wxUSE_MENUS_NATIVE
323
324 // Responds to colour changes, and passes event on to children.
325 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
326 {
327 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
328 Refresh();
329
330 #if wxUSE_STATUSBAR
331 if ( m_frameStatusBar )
332 {
333 wxSysColourChangedEvent event2;
334 event2.SetEventObject( m_frameStatusBar );
335 m_frameStatusBar->GetEventHandler()->ProcessEvent(event2);
336 }
337 #endif // wxUSE_STATUSBAR
338
339 // Propagate the event to the non-top-level children
340 wxWindow::OnSysColourChanged(event);
341 }
342
343 // Pass TRUE to show full screen, FALSE to restore.
344 bool wxFrame::ShowFullScreen(bool show, long style)
345 {
346 if ( IsFullScreen() == show )
347 return FALSE;
348
349 if (show)
350 {
351 #if wxUSE_TOOLBAR
352 wxToolBar *theToolBar = GetToolBar();
353 if (theToolBar)
354 theToolBar->GetSize(NULL, &m_fsToolBarHeight);
355
356 // zap the toolbar, menubar, and statusbar
357
358 if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
359 {
360 theToolBar->SetSize(-1,0);
361 theToolBar->Show(FALSE);
362 }
363 #endif // wxUSE_TOOLBAR
364
365 // TODO: make it work for WinCE
366 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
367 if (style & wxFULLSCREEN_NOMENUBAR)
368 SetMenu((HWND)GetHWND(), (HMENU) NULL);
369 #endif
370
371 #if wxUSE_STATUSBAR
372 wxStatusBar *theStatusBar = GetStatusBar();
373 if (theStatusBar)
374 theStatusBar->GetSize(NULL, &m_fsStatusBarHeight);
375
376 // Save the number of fields in the statusbar
377 if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
378 {
379 //m_fsStatusBarFields = theStatusBar->GetFieldsCount();
380 //SetStatusBar((wxStatusBar*) NULL);
381 //delete theStatusBar;
382 theStatusBar->Show(FALSE);
383 }
384 else
385 m_fsStatusBarFields = 0;
386 #endif // wxUSE_STATUSBAR
387 }
388 else
389 {
390 #if wxUSE_TOOLBAR
391 wxToolBar *theToolBar = GetToolBar();
392
393 // restore the toolbar, menubar, and statusbar
394 if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR))
395 {
396 theToolBar->SetSize(-1, m_fsToolBarHeight);
397 theToolBar->Show(TRUE);
398 }
399 #endif // wxUSE_TOOLBAR
400
401 #if wxUSE_STATUSBAR
402 if ( m_fsStyle & wxFULLSCREEN_NOSTATUSBAR )
403 {
404 //CreateStatusBar(m_fsStatusBarFields);
405 if (GetStatusBar())
406 {
407 GetStatusBar()->Show(TRUE);
408 PositionStatusBar();
409 }
410 }
411 #endif // wxUSE_STATUSBAR
412
413 // TODO: make it work for WinCE
414 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
415 if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
416 SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
417 #endif
418 }
419
420 return wxFrameBase::ShowFullScreen(show, style);
421 }
422
423 // ----------------------------------------------------------------------------
424 // tool/status bar stuff
425 // ----------------------------------------------------------------------------
426
427 #if wxUSE_TOOLBAR
428
429 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
430 {
431 if ( wxFrameBase::CreateToolBar(style, id, name) )
432 {
433 PositionToolBar();
434 }
435
436 return m_frameToolBar;
437 }
438
439 void wxFrame::PositionToolBar()
440 {
441 wxToolBar *toolbar = GetToolBar();
442 if ( toolbar && toolbar->IsShown() )
443 {
444 // don't call our (or even wxTopLevelWindow) version because we want
445 // the real (full) client area size, not excluding the tool/status bar
446 int width, height;
447 wxWindow::DoGetClientSize(&width, &height);
448
449 #if wxUSE_STATUSBAR
450 wxStatusBar *statbar = GetStatusBar();
451 if ( statbar && statbar->IsShown() )
452 {
453 height -= statbar->GetClientSize().y;
454 }
455 #endif // wxUSE_STATUSBAR
456
457 int tw, th;
458 toolbar->GetSize(&tw, &th);
459
460 if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
461 {
462 th = height;
463 }
464 else
465 {
466 tw = width;
467 if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
468 th -= 3;
469 }
470
471 // use the 'real' MSW position here, don't offset relativly to the
472 // client area origin
473 toolbar->SetSize(0, 0, tw, th, wxSIZE_NO_ADJUSTMENTS);
474 }
475 }
476
477 #endif // wxUSE_TOOLBAR
478
479 // ----------------------------------------------------------------------------
480 // frame state (iconized/maximized/...)
481 // ----------------------------------------------------------------------------
482
483 // propagate our state change to all child frames: this allows us to emulate X
484 // Windows behaviour where child frames float independently of the parent one
485 // on the desktop, but are iconized/restored with it
486 void wxFrame::IconizeChildFrames(bool bIconize)
487 {
488 for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
489 node;
490 node = node->GetNext() )
491 {
492 wxWindow *win = node->GetData();
493
494 // iconizing the frames with this style under Win95 shell puts them at
495 // the bottom of the screen (as the MDI children) instead of making
496 // them appear in the taskbar because they are, by virtue of this
497 // style, not managed by the taskbar - instead leave Windows take care
498 // of them
499 #ifdef __WIN95__
500 if ( win->GetWindowStyle() & wxFRAME_TOOL_WINDOW )
501 continue;
502 #endif // Win95
503
504 // the child MDI frames are a special case and should not be touched by
505 // the parent frame - instead, they are managed by the user
506 wxFrame *frame = wxDynamicCast(win, wxFrame);
507 if ( frame
508 #if wxUSE_MDI_ARCHITECTURE
509 && !wxDynamicCast(frame, wxMDIChildFrame)
510 #endif // wxUSE_MDI_ARCHITECTURE
511 )
512 {
513 // we don't want to restore the child frames which had been
514 // iconized even before we were iconized, so save the child frame
515 // status when iconizing the parent frame and check it when
516 // restoring it
517 if ( bIconize )
518 {
519 // note that we shouldn't touch the hidden frames neither
520 // because iconizing/restoring them would show them as a side
521 // effect
522 frame->m_wasMinimized = frame->IsIconized() || !frame->IsShown();
523 }
524
525 // this test works for both iconizing and restoring
526 if ( !frame->m_wasMinimized )
527 frame->Iconize(bIconize);
528 }
529 }
530 }
531
532 WXHICON wxFrame::GetDefaultIcon() const
533 {
534 // we don't have any standard icons (any more)
535 return (WXHICON)0;
536 }
537
538 // ===========================================================================
539 // message processing
540 // ===========================================================================
541
542 // ---------------------------------------------------------------------------
543 // preprocessing
544 // ---------------------------------------------------------------------------
545
546 bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
547 {
548 if ( wxWindow::MSWTranslateMessage(pMsg) )
549 return TRUE;
550
551 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
552 // try the menu bar accels
553 wxMenuBar *menuBar = GetMenuBar();
554 if ( !menuBar )
555 return FALSE;
556
557 const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
558 return acceleratorTable.Translate(this, pMsg);
559 #else
560 return FALSE;
561 #endif // wxUSE_MENUS && wxUSE_ACCEL
562 }
563
564 // ---------------------------------------------------------------------------
565 // our private (non virtual) message handlers
566 // ---------------------------------------------------------------------------
567
568 bool wxFrame::HandlePaint()
569 {
570 RECT rect;
571 if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
572 {
573 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
574 if ( m_iconized )
575 {
576 const wxIcon& icon = GetIcon();
577 HICON hIcon = icon.Ok() ? GetHiconOf(icon)
578 : (HICON)GetDefaultIcon();
579
580 // Hold a pointer to the dc so long as the OnPaint() message
581 // is being processed
582 PAINTSTRUCT ps;
583 HDC hdc = ::BeginPaint(GetHwnd(), &ps);
584
585 // Erase background before painting or we get white background
586 MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
587
588 if ( hIcon )
589 {
590 RECT rect;
591 ::GetClientRect(GetHwnd(), &rect);
592
593 // FIXME: why hardcoded?
594 static const int icon_width = 32;
595 static const int icon_height = 32;
596
597 int icon_x = (int)((rect.right - icon_width)/2);
598 int icon_y = (int)((rect.bottom - icon_height)/2);
599
600 ::DrawIcon(hdc, icon_x, icon_y, hIcon);
601 }
602
603 ::EndPaint(GetHwnd(), &ps);
604
605 return TRUE;
606 }
607 else
608 #endif
609 {
610 return wxWindow::HandlePaint();
611 }
612 }
613 else
614 {
615 // nothing to paint - processed
616 return TRUE;
617 }
618 }
619
620 bool wxFrame::HandleSize(int x, int y, WXUINT id)
621 {
622 bool processed = FALSE;
623 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
624
625 switch ( id )
626 {
627 case SIZENORMAL:
628 // only do it it if we were iconized before, otherwise resizing the
629 // parent frame has a curious side effect of bringing it under it's
630 // children
631 if ( !m_iconized )
632 break;
633
634 // restore all child frames too
635 IconizeChildFrames(FALSE);
636
637 (void)SendIconizeEvent(FALSE);
638
639 // fall through
640
641 case SIZEFULLSCREEN:
642 m_iconized = FALSE;
643 break;
644
645 case SIZEICONIC:
646 // iconize all child frames too
647 IconizeChildFrames(TRUE);
648
649 (void)SendIconizeEvent();
650
651 m_iconized = TRUE;
652 break;
653 }
654 #endif
655
656 if ( !m_iconized )
657 {
658 #if wxUSE_STATUSBAR
659 PositionStatusBar();
660 #endif // wxUSE_STATUSBAR
661
662 #if wxUSE_TOOLBAR
663 PositionToolBar();
664 #endif // wxUSE_TOOLBAR
665
666 processed = wxWindow::HandleSize(x, y, id);
667 }
668
669 return processed;
670 }
671
672 bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
673 {
674 if ( control )
675 {
676 // In case it's e.g. a toolbar.
677 wxWindow *win = wxFindWinFromHandle(control);
678 if ( win )
679 return win->MSWCommand(cmd, id);
680 }
681
682 // handle here commands from menus and accelerators
683 if ( cmd == 0 || cmd == 1 )
684 {
685 #if wxUSE_MENUS_NATIVE
686 if ( wxCurrentPopupMenu )
687 {
688 wxMenu *popupMenu = wxCurrentPopupMenu;
689 wxCurrentPopupMenu = NULL;
690
691 return popupMenu->MSWCommand(cmd, id);
692 }
693 #endif // wxUSE_MENUS_NATIVE
694
695 if ( ProcessCommand(id) )
696 {
697 return TRUE;
698 }
699 }
700
701 return FALSE;
702 }
703
704 bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
705 {
706 int item;
707 if ( flags == 0xFFFF && hMenu == 0 )
708 {
709 // menu was removed from screen
710 item = -1;
711 }
712 #ifndef __WXMICROWIN__
713 else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) )
714 {
715 item = nItem;
716 }
717 #endif
718 else
719 {
720 // don't give hints for separators (doesn't make sense) nor for the
721 // items opening popup menus (they don't have them anyhow) but do clear
722 // the status line - otherwise, we would be left with the help message
723 // for the previous item which doesn't apply any more
724 DoGiveHelp(wxEmptyString, FALSE);
725
726 return FALSE;
727 }
728
729 wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
730 event.SetEventObject(this);
731
732 return GetEventHandler()->ProcessEvent(event);
733 }
734
735 bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)
736 {
737 // we don't have the menu id here, so we use the id to specify if the event
738 // was from a popup menu or a normal one
739 wxMenuEvent event(evtType, isPopup ? -1 : 0);
740 event.SetEventObject(this);
741
742 return GetEventHandler()->ProcessEvent(event);
743 }
744
745 // ---------------------------------------------------------------------------
746 // the window proc for wxFrame
747 // ---------------------------------------------------------------------------
748
749 long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
750 {
751 long rc = 0;
752 bool processed = FALSE;
753
754 switch ( message )
755 {
756 case WM_CLOSE:
757 // if we can't close, tell the system that we processed the
758 // message - otherwise it would close us
759 processed = !Close();
760 break;
761
762 case WM_SIZE:
763 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
764 break;
765
766 case WM_COMMAND:
767 {
768 WORD id, cmd;
769 WXHWND hwnd;
770 UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
771 &id, &hwnd, &cmd);
772
773 processed = HandleCommand(id, cmd, (WXHWND)hwnd);
774 }
775 break;
776
777 case WM_PAINT:
778 processed = HandlePaint();
779 break;
780
781 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
782 case WM_MENUSELECT:
783 {
784 WXWORD item, flags;
785 WXHMENU hmenu;
786 UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
787
788 processed = HandleMenuSelect(item, flags, hmenu);
789 }
790 break;
791
792 case WM_INITMENU:
793 processed = HandleInitMenu();
794 break;
795
796 case WM_EXITMENULOOP:
797 processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam);
798 break;
799
800 case WM_QUERYDRAGICON:
801 {
802 const wxIcon& icon = GetIcon();
803 HICON hIcon = icon.Ok() ? GetHiconOf(icon)
804 : (HICON)GetDefaultIcon();
805 rc = (long)hIcon;
806 processed = rc != 0;
807 }
808 break;
809 #endif // !__WXMICROWIN__
810 }
811
812 if ( !processed )
813 rc = wxFrameBase::MSWWindowProc(message, wParam, lParam);
814
815 return rc;
816 }
817
818 // handle WM_INITMENU message
819 bool wxFrame::HandleInitMenu()
820 {
821 wxMenuEvent event(wxEVT_MENU_OPEN, 0);
822 event.SetEventObject(this);
823
824 return GetEventHandler()->ProcessEvent(event);
825 }
826
827