1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "frame.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
36 #include "wx/dialog.h"
37 #include "wx/settings.h"
38 #include "wx/dcclient.h"
43 #include "wx/msw/private.h"
50 #include "wx/statusbr.h"
51 #include "wx/generic/statusbr.h"
52 #endif // wxUSE_STATUSBAR
55 #include "wx/toolbar.h"
56 #endif // wxUSE_TOOLBAR
58 #include "wx/menuitem.h"
61 #ifdef __WXUNIVERSAL__
62 #include "wx/univ/theme.h"
63 #include "wx/univ/colschem.h"
64 #endif // __WXUNIVERSAL__
66 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 #if wxUSE_MENUS_NATIVE
71 extern wxMenu
*wxCurrentPopupMenu
;
72 #endif // wxUSE_MENUS_NATIVE
74 // ----------------------------------------------------------------------------
76 // ----------------------------------------------------------------------------
78 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
79 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
82 #if wxUSE_EXTENDED_RTTI
83 WX_DEFINE_FLAGS( wxFrameStyle
)
85 wxBEGIN_FLAGS( wxFrameStyle
)
86 // new style border flags, we put them first to
87 // use them for streaming out
88 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
89 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
90 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
91 wxFLAGS_MEMBER(wxBORDER_RAISED
)
92 wxFLAGS_MEMBER(wxBORDER_STATIC
)
93 wxFLAGS_MEMBER(wxBORDER_NONE
)
95 // old style border flags
96 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
97 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
98 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
99 wxFLAGS_MEMBER(wxRAISED_BORDER
)
100 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
101 wxFLAGS_MEMBER(wxBORDER
)
103 // standard window styles
104 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
105 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
106 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
107 wxFLAGS_MEMBER(wxWANTS_CHARS
)
108 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
109 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
110 wxFLAGS_MEMBER(wxVSCROLL
)
111 wxFLAGS_MEMBER(wxHSCROLL
)
114 wxFLAGS_MEMBER(wxSTAY_ON_TOP
)
115 wxFLAGS_MEMBER(wxCAPTION
)
116 wxFLAGS_MEMBER(wxTHICK_FRAME
)
117 wxFLAGS_MEMBER(wxSYSTEM_MENU
)
118 wxFLAGS_MEMBER(wxRESIZE_BORDER
)
119 wxFLAGS_MEMBER(wxRESIZE_BOX
)
120 wxFLAGS_MEMBER(wxCLOSE_BOX
)
121 wxFLAGS_MEMBER(wxMAXIMIZE_BOX
)
122 wxFLAGS_MEMBER(wxMINIMIZE_BOX
)
124 wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW
)
125 wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT
)
127 wxFLAGS_MEMBER(wxFRAME_SHAPED
)
129 wxEND_FLAGS( wxFrameStyle
)
131 IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame
, wxTopLevelWindow
,"wx/frame.h")
133 wxBEGIN_PROPERTIES_TABLE(wxFrame
)
134 wxEVENT_PROPERTY( Menu
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEvent
)
136 wxPROPERTY( Title
,wxString
, SetTitle
, GetTitle
, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
137 wxPROPERTY_FLAGS( WindowStyle
, wxFrameStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
138 wxPROPERTY( MenuBar
, wxMenuBar
* , SetMenuBar
, GetMenuBar
, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
139 wxEND_PROPERTIES_TABLE()
141 wxBEGIN_HANDLERS_TABLE(wxFrame
)
142 wxEND_HANDLERS_TABLE()
144 wxCONSTRUCTOR_6( wxFrame
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Title
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
147 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxTopLevelWindow
)
150 // ============================================================================
152 // ============================================================================
154 // ----------------------------------------------------------------------------
155 // static class members
156 // ----------------------------------------------------------------------------
159 #if wxUSE_NATIVE_STATUSBAR
160 bool wxFrame::m_useNativeStatusBar
= TRUE
;
162 bool wxFrame::m_useNativeStatusBar
= FALSE
;
164 #endif // wxUSE_NATIVE_STATUSBAR
166 // ----------------------------------------------------------------------------
167 // creation/destruction
168 // ----------------------------------------------------------------------------
176 // Data to save/restore when calling ShowFullScreen
177 m_fsStatusBarFields
= 0;
178 m_fsStatusBarHeight
= 0;
179 m_fsToolBarHeight
= 0;
181 m_wasMinimized
= FALSE
;
184 bool wxFrame::Create(wxWindow
*parent
,
186 const wxString
& title
,
190 const wxString
& name
)
192 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
195 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
197 wxModelessWindows
.Append(this);
204 m_isBeingDeleted
= TRUE
;
208 // ----------------------------------------------------------------------------
209 // wxFrame client size calculations
210 // ----------------------------------------------------------------------------
212 void wxFrame::DoSetClientSize(int width
, int height
)
214 // leave enough space for the status bar if we have (and show) it
216 wxStatusBar
*statbar
= GetStatusBar();
217 if ( statbar
&& statbar
->IsShown() )
219 height
+= statbar
->GetSize().y
;
221 #endif // wxUSE_STATUSBAR
223 // call GetClientAreaOrigin() to take the toolbar into account
224 wxPoint pt
= GetClientAreaOrigin();
228 wxTopLevelWindow::DoSetClientSize(width
, height
);
231 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
232 void wxFrame::DoGetClientSize(int *x
, int *y
) const
234 wxTopLevelWindow::DoGetClientSize(x
, y
);
236 // account for the possible toolbar
237 wxPoint pt
= GetClientAreaOrigin();
245 // adjust client area height to take the status bar into account
248 wxStatusBar
*statbar
= GetStatusBar();
249 if ( statbar
&& statbar
->IsShown() )
251 *y
-= statbar
->GetClientSize().y
;
254 #endif // wxUSE_STATUSBAR
257 // ----------------------------------------------------------------------------
258 // wxFrame: various geometry-related functions
259 // ----------------------------------------------------------------------------
261 void wxFrame::Raise()
263 ::SetForegroundWindow(GetHwnd());
266 // generate an artificial resize event
267 void wxFrame::SendSizeEvent()
271 RECT r
= wxGetWindowRect(GetHwnd());
273 (void)::PostMessage(GetHwnd(), WM_SIZE
,
274 IsMaximized() ? SIZE_MAXIMIZED
: SIZE_RESTORED
,
275 MAKELPARAM(r
.right
- r
.left
, r
.bottom
- r
.top
));
280 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
,
283 const wxString
& name
)
285 wxStatusBar
*statusBar
= NULL
;
287 #if wxUSE_NATIVE_STATUSBAR
288 if ( !UsesNativeStatusBar() )
290 statusBar
= (wxStatusBar
*)new wxStatusBarGeneric(this, id
, style
);
295 statusBar
= new wxStatusBar(this, id
, style
, name
);
298 statusBar
->SetFieldsCount(number
);
303 void wxFrame::PositionStatusBar()
305 if ( !m_frameStatusBar
|| !m_frameStatusBar
->IsShown() )
309 GetClientSize(&w
, &h
);
311 m_frameStatusBar
->GetSize(&sw
, &sh
);
313 // Since we wish the status bar to be directly under the client area,
314 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
315 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
317 #endif // wxUSE_STATUSBAR
319 #if wxUSE_MENUS_NATIVE
321 void wxFrame::AttachMenuBar(wxMenuBar
*menubar
)
323 wxFrameBase::AttachMenuBar(menubar
);
327 // actually remove the menu from the frame
328 m_hMenu
= (WXHMENU
)0;
329 InternalSetMenuBar();
331 else // set new non NULL menu bar
334 // Can set a menubar several times.
335 if ( menubar
->GetHMenu() )
337 m_hMenu
= menubar
->GetHMenu();
341 m_hMenu
= menubar
->Create();
345 wxFAIL_MSG( _T("failed to create menu bar") );
350 InternalSetMenuBar();
354 void wxFrame::InternalSetMenuBar()
356 #ifdef __WXMICROWIN__
358 #elif defined(__WXWINCE__)
362 wxToolBar
* toolBar
= new wxToolBar(this, -1,
363 wxDefaultPosition
, wxDefaultSize
,
364 wxBORDER_NONE
| wxTB_HORIZONTAL
,
365 wxToolBarNameStr
, GetMenuBar());
369 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
371 wxLogLastError(wxT("SetMenu"));
376 #endif // wxUSE_MENUS_NATIVE
378 // Responds to colour changes, and passes event on to children.
379 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
381 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
385 if ( m_frameStatusBar
)
387 wxSysColourChangedEvent event2
;
388 event2
.SetEventObject( m_frameStatusBar
);
389 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
391 #endif // wxUSE_STATUSBAR
393 // Propagate the event to the non-top-level children
394 wxWindow::OnSysColourChanged(event
);
397 // Pass TRUE to show full screen, FALSE to restore.
398 bool wxFrame::ShowFullScreen(bool show
, long style
)
400 if ( IsFullScreen() == show
)
407 // TODO: hide commandbar
409 wxToolBar
*theToolBar
= GetToolBar();
411 theToolBar
->GetSize(NULL
, &m_fsToolBarHeight
);
413 // zap the toolbar, menubar, and statusbar
415 if ((style
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
417 theToolBar
->SetSize(-1,0);
418 theToolBar
->Show(FALSE
);
420 #endif // __WXWINCE__
421 #endif // wxUSE_TOOLBAR
423 // TODO: make it work for WinCE
424 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
425 if (style
& wxFULLSCREEN_NOMENUBAR
)
426 SetMenu((HWND
)GetHWND(), (HMENU
) NULL
);
430 wxStatusBar
*theStatusBar
= GetStatusBar();
432 theStatusBar
->GetSize(NULL
, &m_fsStatusBarHeight
);
434 // Save the number of fields in the statusbar
435 if ((style
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
437 //m_fsStatusBarFields = theStatusBar->GetFieldsCount();
438 //SetStatusBar((wxStatusBar*) NULL);
439 //delete theStatusBar;
440 theStatusBar
->Show(FALSE
);
443 m_fsStatusBarFields
= 0;
444 #endif // wxUSE_STATUSBAR
450 // TODO: show commandbar
452 wxToolBar
*theToolBar
= GetToolBar();
454 // restore the toolbar, menubar, and statusbar
455 if (theToolBar
&& (m_fsStyle
& wxFULLSCREEN_NOTOOLBAR
))
457 theToolBar
->SetSize(-1, m_fsToolBarHeight
);
458 theToolBar
->Show(TRUE
);
460 #endif // __WXWINCE__
461 #endif // wxUSE_TOOLBAR
464 if ( m_fsStyle
& wxFULLSCREEN_NOSTATUSBAR
)
466 //CreateStatusBar(m_fsStatusBarFields);
469 GetStatusBar()->Show(TRUE
);
473 #endif // wxUSE_STATUSBAR
475 // TODO: make it work for WinCE
476 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
477 if ((m_fsStyle
& wxFULLSCREEN_NOMENUBAR
) && (m_hMenu
!= 0))
478 SetMenu((HWND
)GetHWND(), (HMENU
)m_hMenu
);
482 return wxFrameBase::ShowFullScreen(show
, style
);
485 // ----------------------------------------------------------------------------
486 // tool/status bar stuff
487 // ----------------------------------------------------------------------------
491 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
494 // We may already have a toolbar from calling SetMenuBar.
498 if ( wxFrameBase::CreateToolBar(style
, id
, name
) )
503 return m_frameToolBar
;
506 void wxFrame::PositionToolBar()
508 wxToolBar
*toolbar
= GetToolBar();
509 if ( toolbar
&& toolbar
->IsShown() )
512 // We want to do something different in WinCE, because
513 // the toolbar should be associated with the commandbar,
514 // and not an independent window.
517 // don't call our (or even wxTopLevelWindow) version because we want
518 // the real (full) client area size, not excluding the tool/status bar
520 wxWindow::DoGetClientSize(&width
, &height
);
523 wxStatusBar
*statbar
= GetStatusBar();
524 if ( statbar
&& statbar
->IsShown() )
526 height
-= statbar
->GetClientSize().y
;
528 #endif // wxUSE_STATUSBAR
532 toolbar
->GetPosition(&tx
, &ty
);
533 toolbar
->GetSize(&tw
, &th
);
536 if (ty
< 0 && (-ty
== th
))
538 if (tx
< 0 && (-tx
== tw
))
544 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
551 // if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
555 // use the 'real' MSW position here, don't offset relativly to the
556 // client area origin
558 // Optimise such that we don't have to always resize the toolbar
559 // when the frame changes, otherwise we'll get a lot of flicker.
560 bool heightChanging
= TRUE
;
561 bool widthChanging
= TRUE
;
563 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
565 // It's OK if the current height is greater than what can be shown.
566 heightChanging
= (desiredH
> th
) ;
567 widthChanging
= (desiredW
!= tw
) ;
569 // The next time around, we may not have to set the size
571 desiredH
= desiredH
+ 200;
575 // It's OK if the current width is greater than what can be shown.
576 widthChanging
= (desiredW
> tw
) ;
577 heightChanging
= (desiredH
!= th
) ;
579 // The next time around, we may not have to set the size
581 desiredW
= desiredW
+ 200;
584 if (tx
!= 0 || ty
!= 0 || widthChanging
|| heightChanging
)
585 toolbar
->SetSize(0, 0, desiredW
, desiredH
, wxSIZE_NO_ADJUSTMENTS
);
587 #endif // __WXWINCE__
591 #endif // wxUSE_TOOLBAR
593 // ----------------------------------------------------------------------------
594 // frame state (iconized/maximized/...)
595 // ----------------------------------------------------------------------------
597 // propagate our state change to all child frames: this allows us to emulate X
598 // Windows behaviour where child frames float independently of the parent one
599 // on the desktop, but are iconized/restored with it
600 void wxFrame::IconizeChildFrames(bool bIconize
)
602 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
604 node
= node
->GetNext() )
606 wxWindow
*win
= node
->GetData();
608 // iconizing the frames with this style under Win95 shell puts them at
609 // the bottom of the screen (as the MDI children) instead of making
610 // them appear in the taskbar because they are, by virtue of this
611 // style, not managed by the taskbar - instead leave Windows take care
614 if ( win
->GetWindowStyle() & wxFRAME_TOOL_WINDOW
)
618 // the child MDI frames are a special case and should not be touched by
619 // the parent frame - instead, they are managed by the user
620 wxFrame
*frame
= wxDynamicCast(win
, wxFrame
);
622 #if wxUSE_MDI_ARCHITECTURE
623 && !wxDynamicCast(frame
, wxMDIChildFrame
)
624 #endif // wxUSE_MDI_ARCHITECTURE
627 // we don't want to restore the child frames which had been
628 // iconized even before we were iconized, so save the child frame
629 // status when iconizing the parent frame and check it when
633 // note that we shouldn't touch the hidden frames neither
634 // because iconizing/restoring them would show them as a side
636 frame
->m_wasMinimized
= frame
->IsIconized() || !frame
->IsShown();
639 // this test works for both iconizing and restoring
640 if ( !frame
->m_wasMinimized
)
641 frame
->Iconize(bIconize
);
646 WXHICON
wxFrame::GetDefaultIcon() const
648 // we don't have any standard icons (any more)
652 // ===========================================================================
653 // message processing
654 // ===========================================================================
656 // ---------------------------------------------------------------------------
658 // ---------------------------------------------------------------------------
660 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
662 if ( wxWindow::MSWTranslateMessage(pMsg
) )
665 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
666 // try the menu bar accels
667 wxMenuBar
*menuBar
= GetMenuBar();
671 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
672 return acceleratorTable
.Translate(this, pMsg
);
675 #endif // wxUSE_MENUS && wxUSE_ACCEL
678 // ---------------------------------------------------------------------------
679 // our private (non virtual) message handlers
680 // ---------------------------------------------------------------------------
682 bool wxFrame::HandlePaint()
685 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
687 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
690 const wxIcon
& icon
= GetIcon();
691 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
692 : (HICON
)GetDefaultIcon();
694 // Hold a pointer to the dc so long as the OnPaint() message
695 // is being processed
697 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
699 // Erase background before painting or we get white background
700 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
705 ::GetClientRect(GetHwnd(), &rect
);
707 // FIXME: why hardcoded?
708 static const int icon_width
= 32;
709 static const int icon_height
= 32;
711 int icon_x
= (int)((rect
.right
- icon_width
)/2);
712 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
714 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
717 ::EndPaint(GetHwnd(), &ps
);
724 return wxWindow::HandlePaint();
729 // nothing to paint - processed
734 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
736 bool processed
= FALSE
;
737 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
742 // only do it it if we were iconized before, otherwise resizing the
743 // parent frame has a curious side effect of bringing it under it's
748 // restore all child frames too
749 IconizeChildFrames(FALSE
);
751 (void)SendIconizeEvent(FALSE
);
760 // iconize all child frames too
761 IconizeChildFrames(TRUE
);
763 (void)SendIconizeEvent();
774 #endif // wxUSE_STATUSBAR
778 #endif // wxUSE_TOOLBAR
780 processed
= wxWindow::HandleSize(x
, y
, id
);
786 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
790 // In case it's e.g. a toolbar.
791 wxWindow
*win
= wxFindWinFromHandle(control
);
793 return win
->MSWCommand(cmd
, id
);
796 // handle here commands from menus and accelerators
797 if ( cmd
== 0 || cmd
== 1 )
799 #if wxUSE_MENUS_NATIVE
800 if ( wxCurrentPopupMenu
)
802 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
803 wxCurrentPopupMenu
= NULL
;
805 return popupMenu
->MSWCommand(cmd
, id
);
807 #endif // wxUSE_MENUS_NATIVE
809 if ( ProcessCommand(id
) )
818 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU hMenu
)
821 if ( flags
== 0xFFFF && hMenu
== 0 )
823 // menu was removed from screen
826 #ifndef __WXMICROWIN__
827 else if ( !(flags
& MF_POPUP
) && !(flags
& MF_SEPARATOR
) )
834 // don't give hints for separators (doesn't make sense) nor for the
835 // items opening popup menus (they don't have them anyhow) but do clear
836 // the status line - otherwise, we would be left with the help message
837 // for the previous item which doesn't apply any more
838 DoGiveHelp(wxEmptyString
, FALSE
);
843 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
844 event
.SetEventObject(this);
846 return GetEventHandler()->ProcessEvent(event
);
849 bool wxFrame::HandleMenuLoop(const wxEventType
& evtType
, WXWORD isPopup
)
851 // we don't have the menu id here, so we use the id to specify if the event
852 // was from a popup menu or a normal one
853 wxMenuEvent
event(evtType
, isPopup
? -1 : 0);
854 event
.SetEventObject(this);
856 return GetEventHandler()->ProcessEvent(event
);
859 // ---------------------------------------------------------------------------
860 // the window proc for wxFrame
861 // ---------------------------------------------------------------------------
863 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
866 bool processed
= FALSE
;
871 // if we can't close, tell the system that we processed the
872 // message - otherwise it would close us
873 processed
= !Close();
877 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
884 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
887 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
892 processed
= HandlePaint();
895 case WM_INITMENUPOPUP
:
896 processed
= HandleInitMenuPopup((WXHMENU
) wParam
);
899 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
904 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
906 processed
= HandleMenuSelect(item
, flags
, hmenu
);
910 case WM_EXITMENULOOP
:
911 processed
= HandleMenuLoop(wxEVT_MENU_CLOSE
, wParam
);
914 case WM_QUERYDRAGICON
:
916 const wxIcon
& icon
= GetIcon();
917 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
918 : (HICON
)GetDefaultIcon();
923 #endif // !__WXMICROWIN__
927 rc
= wxFrameBase::MSWWindowProc(message
, wParam
, lParam
);
932 // handle WM_INITMENUPOPUP message
933 bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu
)
938 int nCount
= GetMenuBar()->GetMenuCount();
939 for (int n
= 0; n
< nCount
; n
++)
941 if (GetMenuBar()->GetMenu(n
)->GetHMenu() == hMenu
)
943 menu
= GetMenuBar()->GetMenu(n
);
949 wxMenuEvent
event(wxEVT_MENU_OPEN
, 0, menu
);
950 event
.SetEventObject(this);
952 return GetEventHandler()->ProcessEvent(event
);