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 WX_BEGIN_FLAGS( wxFrameStyle
)
86 // new style border flags, we put them first to
87 // use them for streaming out
88 WX_FLAGS_MEMBER(wxBORDER_SIMPLE
)
89 WX_FLAGS_MEMBER(wxBORDER_SUNKEN
)
90 WX_FLAGS_MEMBER(wxBORDER_DOUBLE
)
91 WX_FLAGS_MEMBER(wxBORDER_RAISED
)
92 WX_FLAGS_MEMBER(wxBORDER_STATIC
)
93 WX_FLAGS_MEMBER(wxBORDER_NONE
)
95 // old style border flags
96 WX_FLAGS_MEMBER(wxSIMPLE_BORDER
)
97 WX_FLAGS_MEMBER(wxSUNKEN_BORDER
)
98 WX_FLAGS_MEMBER(wxDOUBLE_BORDER
)
99 WX_FLAGS_MEMBER(wxRAISED_BORDER
)
100 WX_FLAGS_MEMBER(wxSTATIC_BORDER
)
101 WX_FLAGS_MEMBER(wxNO_BORDER
)
103 // standard window styles
104 WX_FLAGS_MEMBER(wxTAB_TRAVERSAL
)
105 WX_FLAGS_MEMBER(wxCLIP_CHILDREN
)
106 WX_FLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
107 WX_FLAGS_MEMBER(wxWANTS_CHARS
)
108 WX_FLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE
)
109 WX_FLAGS_MEMBER(wxALWAYS_SHOW_SB
)
110 WX_FLAGS_MEMBER(wxVSCROLL
)
111 WX_FLAGS_MEMBER(wxHSCROLL
)
114 WX_FLAGS_MEMBER(wxSTAY_ON_TOP
)
115 WX_FLAGS_MEMBER(wxCAPTION
)
116 WX_FLAGS_MEMBER(wxTHICK_FRAME
)
117 WX_FLAGS_MEMBER(wxSYSTEM_MENU
)
118 WX_FLAGS_MEMBER(wxRESIZE_BORDER
)
119 WX_FLAGS_MEMBER(wxRESIZE_BOX
)
120 WX_FLAGS_MEMBER(wxCLOSE_BOX
)
121 WX_FLAGS_MEMBER(wxMAXIMIZE_BOX
)
122 WX_FLAGS_MEMBER(wxMINIMIZE_BOX
)
124 WX_FLAGS_MEMBER(wxFRAME_TOOL_WINDOW
)
125 WX_FLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT
)
127 WX_FLAGS_MEMBER(wxFRAME_SHAPED
)
129 WX_END_FLAGS( wxFrameStyle
)
131 IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame
, wxTopLevelWindow
,"wx/frame.h")
133 WX_BEGIN_PROPERTIES_TABLE(wxFrame
)
134 WX_PROPERTY( Title
,wxString
, SetTitle
, GetTitle
, wxEmptyString
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
135 WX_PROPERTY_FLAGS( WindowStyle
, wxFrameStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
139 style (wxDEFAULT_FRAME_STYLE)
140 centered (bool, false )
142 WX_END_PROPERTIES_TABLE()
144 WX_BEGIN_HANDLERS_TABLE(wxFrame
)
145 WX_END_HANDLERS_TABLE()
147 WX_CONSTRUCTOR_6( wxFrame
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Title
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
150 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxTopLevelWindow
)
153 // ============================================================================
155 // ============================================================================
157 // ----------------------------------------------------------------------------
158 // static class members
159 // ----------------------------------------------------------------------------
162 #if wxUSE_NATIVE_STATUSBAR
163 bool wxFrame::m_useNativeStatusBar
= TRUE
;
165 bool wxFrame::m_useNativeStatusBar
= FALSE
;
167 #endif // wxUSE_NATIVE_STATUSBAR
169 // ----------------------------------------------------------------------------
170 // creation/destruction
171 // ----------------------------------------------------------------------------
179 // Data to save/restore when calling ShowFullScreen
180 m_fsStatusBarFields
= 0;
181 m_fsStatusBarHeight
= 0;
182 m_fsToolBarHeight
= 0;
184 m_wasMinimized
= FALSE
;
187 bool wxFrame::Create(wxWindow
*parent
,
189 const wxString
& title
,
193 const wxString
& name
)
195 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
198 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
200 wxModelessWindows
.Append(this);
207 m_isBeingDeleted
= TRUE
;
211 // ----------------------------------------------------------------------------
212 // wxFrame client size calculations
213 // ----------------------------------------------------------------------------
215 void wxFrame::DoSetClientSize(int width
, int height
)
217 // leave enough space for the status bar if we have (and show) it
219 wxStatusBar
*statbar
= GetStatusBar();
220 if ( statbar
&& statbar
->IsShown() )
222 height
+= statbar
->GetSize().y
;
224 #endif // wxUSE_STATUSBAR
226 // call GetClientAreaOrigin() to take the toolbar into account
227 wxPoint pt
= GetClientAreaOrigin();
231 wxTopLevelWindow::DoSetClientSize(width
, height
);
234 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
235 void wxFrame::DoGetClientSize(int *x
, int *y
) const
237 wxTopLevelWindow::DoGetClientSize(x
, y
);
239 // account for the possible toolbar
240 wxPoint pt
= GetClientAreaOrigin();
248 // adjust client area height to take the status bar into account
251 wxStatusBar
*statbar
= GetStatusBar();
252 if ( statbar
&& statbar
->IsShown() )
254 *y
-= statbar
->GetClientSize().y
;
257 #endif // wxUSE_STATUSBAR
260 // ----------------------------------------------------------------------------
261 // wxFrame: various geometry-related functions
262 // ----------------------------------------------------------------------------
264 void wxFrame::Raise()
266 ::SetForegroundWindow(GetHwnd());
269 // generate an artificial resize event
270 void wxFrame::SendSizeEvent()
274 RECT r
= wxGetWindowRect(GetHwnd());
276 (void)::PostMessage(GetHwnd(), WM_SIZE
,
277 IsMaximized() ? SIZE_MAXIMIZED
: SIZE_RESTORED
,
278 MAKELPARAM(r
.right
- r
.left
, r
.bottom
- r
.top
));
283 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
,
286 const wxString
& name
)
288 wxStatusBar
*statusBar
= NULL
;
290 #if wxUSE_NATIVE_STATUSBAR
291 if ( !UsesNativeStatusBar() )
293 statusBar
= (wxStatusBar
*)new wxStatusBarGeneric(this, id
, style
);
298 statusBar
= new wxStatusBar(this, id
, style
, name
);
301 statusBar
->SetFieldsCount(number
);
306 void wxFrame::PositionStatusBar()
308 if ( !m_frameStatusBar
|| !m_frameStatusBar
->IsShown() )
312 GetClientSize(&w
, &h
);
314 m_frameStatusBar
->GetSize(&sw
, &sh
);
316 // Since we wish the status bar to be directly under the client area,
317 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
318 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
320 #endif // wxUSE_STATUSBAR
322 #if wxUSE_MENUS_NATIVE
324 void wxFrame::AttachMenuBar(wxMenuBar
*menubar
)
326 wxFrameBase::AttachMenuBar(menubar
);
330 // actually remove the menu from the frame
331 m_hMenu
= (WXHMENU
)0;
332 InternalSetMenuBar();
334 else // set new non NULL menu bar
337 // Can set a menubar several times.
338 if ( menubar
->GetHMenu() )
340 m_hMenu
= menubar
->GetHMenu();
344 m_hMenu
= menubar
->Create();
348 wxFAIL_MSG( _T("failed to create menu bar") );
353 InternalSetMenuBar();
357 void wxFrame::InternalSetMenuBar()
359 #ifdef __WXMICROWIN__
361 #elif defined(__WXWINCE__)
365 wxToolBar
* toolBar
= new wxToolBar(this, -1,
366 wxDefaultPosition
, wxDefaultSize
,
367 wxBORDER_NONE
| wxTB_HORIZONTAL
,
368 wxToolBarNameStr
, GetMenuBar());
372 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
374 wxLogLastError(wxT("SetMenu"));
379 #endif // wxUSE_MENUS_NATIVE
381 // Responds to colour changes, and passes event on to children.
382 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
384 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
388 if ( m_frameStatusBar
)
390 wxSysColourChangedEvent event2
;
391 event2
.SetEventObject( m_frameStatusBar
);
392 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
394 #endif // wxUSE_STATUSBAR
396 // Propagate the event to the non-top-level children
397 wxWindow::OnSysColourChanged(event
);
400 // Pass TRUE to show full screen, FALSE to restore.
401 bool wxFrame::ShowFullScreen(bool show
, long style
)
403 if ( IsFullScreen() == show
)
410 // TODO: hide commandbar
412 wxToolBar
*theToolBar
= GetToolBar();
414 theToolBar
->GetSize(NULL
, &m_fsToolBarHeight
);
416 // zap the toolbar, menubar, and statusbar
418 if ((style
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
420 theToolBar
->SetSize(-1,0);
421 theToolBar
->Show(FALSE
);
423 #endif // __WXWINCE__
424 #endif // wxUSE_TOOLBAR
426 // TODO: make it work for WinCE
427 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
428 if (style
& wxFULLSCREEN_NOMENUBAR
)
429 SetMenu((HWND
)GetHWND(), (HMENU
) NULL
);
433 wxStatusBar
*theStatusBar
= GetStatusBar();
435 theStatusBar
->GetSize(NULL
, &m_fsStatusBarHeight
);
437 // Save the number of fields in the statusbar
438 if ((style
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
440 //m_fsStatusBarFields = theStatusBar->GetFieldsCount();
441 //SetStatusBar((wxStatusBar*) NULL);
442 //delete theStatusBar;
443 theStatusBar
->Show(FALSE
);
446 m_fsStatusBarFields
= 0;
447 #endif // wxUSE_STATUSBAR
453 // TODO: show commandbar
455 wxToolBar
*theToolBar
= GetToolBar();
457 // restore the toolbar, menubar, and statusbar
458 if (theToolBar
&& (m_fsStyle
& wxFULLSCREEN_NOTOOLBAR
))
460 theToolBar
->SetSize(-1, m_fsToolBarHeight
);
461 theToolBar
->Show(TRUE
);
463 #endif // __WXWINCE__
464 #endif // wxUSE_TOOLBAR
467 if ( m_fsStyle
& wxFULLSCREEN_NOSTATUSBAR
)
469 //CreateStatusBar(m_fsStatusBarFields);
472 GetStatusBar()->Show(TRUE
);
476 #endif // wxUSE_STATUSBAR
478 // TODO: make it work for WinCE
479 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
480 if ((m_fsStyle
& wxFULLSCREEN_NOMENUBAR
) && (m_hMenu
!= 0))
481 SetMenu((HWND
)GetHWND(), (HMENU
)m_hMenu
);
485 return wxFrameBase::ShowFullScreen(show
, style
);
488 // ----------------------------------------------------------------------------
489 // tool/status bar stuff
490 // ----------------------------------------------------------------------------
494 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
497 // We may already have a toolbar from calling SetMenuBar.
501 if ( wxFrameBase::CreateToolBar(style
, id
, name
) )
506 return m_frameToolBar
;
509 void wxFrame::PositionToolBar()
511 wxToolBar
*toolbar
= GetToolBar();
512 if ( toolbar
&& toolbar
->IsShown() )
515 // We want to do something different in WinCE, because
516 // the toolbar should be associated with the commandbar,
517 // and not an independent window.
520 // don't call our (or even wxTopLevelWindow) version because we want
521 // the real (full) client area size, not excluding the tool/status bar
523 wxWindow::DoGetClientSize(&width
, &height
);
526 wxStatusBar
*statbar
= GetStatusBar();
527 if ( statbar
&& statbar
->IsShown() )
529 height
-= statbar
->GetClientSize().y
;
531 #endif // wxUSE_STATUSBAR
535 toolbar
->GetPosition(&tx
, &ty
);
536 toolbar
->GetSize(&tw
, &th
);
539 if (ty
< 0 && (-ty
== th
))
541 if (tx
< 0 && (-tx
== tw
))
547 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
554 // if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
558 // use the 'real' MSW position here, don't offset relativly to the
559 // client area origin
561 // Optimise such that we don't have to always resize the toolbar
562 // when the frame changes, otherwise we'll get a lot of flicker.
563 bool heightChanging
= TRUE
;
564 bool widthChanging
= TRUE
;
566 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
568 // It's OK if the current height is greater than what can be shown.
569 heightChanging
= (desiredH
> th
) ;
570 widthChanging
= (desiredW
!= tw
) ;
572 // The next time around, we may not have to set the size
574 desiredH
= desiredH
+ 200;
578 // It's OK if the current width is greater than what can be shown.
579 widthChanging
= (desiredW
> tw
) ;
580 heightChanging
= (desiredH
!= th
) ;
582 // The next time around, we may not have to set the size
584 desiredW
= desiredW
+ 200;
587 if (tx
!= 0 || ty
!= 0 || widthChanging
|| heightChanging
)
588 toolbar
->SetSize(0, 0, desiredW
, desiredH
, wxSIZE_NO_ADJUSTMENTS
);
590 #endif // __WXWINCE__
594 #endif // wxUSE_TOOLBAR
596 // ----------------------------------------------------------------------------
597 // frame state (iconized/maximized/...)
598 // ----------------------------------------------------------------------------
600 // propagate our state change to all child frames: this allows us to emulate X
601 // Windows behaviour where child frames float independently of the parent one
602 // on the desktop, but are iconized/restored with it
603 void wxFrame::IconizeChildFrames(bool bIconize
)
605 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
607 node
= node
->GetNext() )
609 wxWindow
*win
= node
->GetData();
611 // iconizing the frames with this style under Win95 shell puts them at
612 // the bottom of the screen (as the MDI children) instead of making
613 // them appear in the taskbar because they are, by virtue of this
614 // style, not managed by the taskbar - instead leave Windows take care
617 if ( win
->GetWindowStyle() & wxFRAME_TOOL_WINDOW
)
621 // the child MDI frames are a special case and should not be touched by
622 // the parent frame - instead, they are managed by the user
623 wxFrame
*frame
= wxDynamicCast(win
, wxFrame
);
625 #if wxUSE_MDI_ARCHITECTURE
626 && !wxDynamicCast(frame
, wxMDIChildFrame
)
627 #endif // wxUSE_MDI_ARCHITECTURE
630 // we don't want to restore the child frames which had been
631 // iconized even before we were iconized, so save the child frame
632 // status when iconizing the parent frame and check it when
636 // note that we shouldn't touch the hidden frames neither
637 // because iconizing/restoring them would show them as a side
639 frame
->m_wasMinimized
= frame
->IsIconized() || !frame
->IsShown();
642 // this test works for both iconizing and restoring
643 if ( !frame
->m_wasMinimized
)
644 frame
->Iconize(bIconize
);
649 WXHICON
wxFrame::GetDefaultIcon() const
651 // we don't have any standard icons (any more)
655 // ===========================================================================
656 // message processing
657 // ===========================================================================
659 // ---------------------------------------------------------------------------
661 // ---------------------------------------------------------------------------
663 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
665 if ( wxWindow::MSWTranslateMessage(pMsg
) )
668 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
669 // try the menu bar accels
670 wxMenuBar
*menuBar
= GetMenuBar();
674 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
675 return acceleratorTable
.Translate(this, pMsg
);
678 #endif // wxUSE_MENUS && wxUSE_ACCEL
681 // ---------------------------------------------------------------------------
682 // our private (non virtual) message handlers
683 // ---------------------------------------------------------------------------
685 bool wxFrame::HandlePaint()
688 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
690 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
693 const wxIcon
& icon
= GetIcon();
694 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
695 : (HICON
)GetDefaultIcon();
697 // Hold a pointer to the dc so long as the OnPaint() message
698 // is being processed
700 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
702 // Erase background before painting or we get white background
703 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
708 ::GetClientRect(GetHwnd(), &rect
);
710 // FIXME: why hardcoded?
711 static const int icon_width
= 32;
712 static const int icon_height
= 32;
714 int icon_x
= (int)((rect
.right
- icon_width
)/2);
715 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
717 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
720 ::EndPaint(GetHwnd(), &ps
);
727 return wxWindow::HandlePaint();
732 // nothing to paint - processed
737 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
739 bool processed
= FALSE
;
740 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
745 // only do it it if we were iconized before, otherwise resizing the
746 // parent frame has a curious side effect of bringing it under it's
751 // restore all child frames too
752 IconizeChildFrames(FALSE
);
754 (void)SendIconizeEvent(FALSE
);
763 // iconize all child frames too
764 IconizeChildFrames(TRUE
);
766 (void)SendIconizeEvent();
777 #endif // wxUSE_STATUSBAR
781 #endif // wxUSE_TOOLBAR
783 processed
= wxWindow::HandleSize(x
, y
, id
);
789 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
793 // In case it's e.g. a toolbar.
794 wxWindow
*win
= wxFindWinFromHandle(control
);
796 return win
->MSWCommand(cmd
, id
);
799 // handle here commands from menus and accelerators
800 if ( cmd
== 0 || cmd
== 1 )
802 #if wxUSE_MENUS_NATIVE
803 if ( wxCurrentPopupMenu
)
805 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
806 wxCurrentPopupMenu
= NULL
;
808 return popupMenu
->MSWCommand(cmd
, id
);
810 #endif // wxUSE_MENUS_NATIVE
812 if ( ProcessCommand(id
) )
821 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU hMenu
)
824 if ( flags
== 0xFFFF && hMenu
== 0 )
826 // menu was removed from screen
829 #ifndef __WXMICROWIN__
830 else if ( !(flags
& MF_POPUP
) && !(flags
& MF_SEPARATOR
) )
837 // don't give hints for separators (doesn't make sense) nor for the
838 // items opening popup menus (they don't have them anyhow) but do clear
839 // the status line - otherwise, we would be left with the help message
840 // for the previous item which doesn't apply any more
841 DoGiveHelp(wxEmptyString
, FALSE
);
846 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
847 event
.SetEventObject(this);
849 return GetEventHandler()->ProcessEvent(event
);
852 bool wxFrame::HandleMenuLoop(const wxEventType
& evtType
, WXWORD isPopup
)
854 // we don't have the menu id here, so we use the id to specify if the event
855 // was from a popup menu or a normal one
856 wxMenuEvent
event(evtType
, isPopup
? -1 : 0);
857 event
.SetEventObject(this);
859 return GetEventHandler()->ProcessEvent(event
);
862 // ---------------------------------------------------------------------------
863 // the window proc for wxFrame
864 // ---------------------------------------------------------------------------
866 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
869 bool processed
= FALSE
;
874 // if we can't close, tell the system that we processed the
875 // message - otherwise it would close us
876 processed
= !Close();
880 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
887 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
890 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
895 processed
= HandlePaint();
898 case WM_INITMENUPOPUP
:
899 processed
= HandleInitMenuPopup((WXHMENU
) wParam
);
902 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
907 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
909 processed
= HandleMenuSelect(item
, flags
, hmenu
);
913 case WM_EXITMENULOOP
:
914 processed
= HandleMenuLoop(wxEVT_MENU_CLOSE
, wParam
);
917 case WM_QUERYDRAGICON
:
919 const wxIcon
& icon
= GetIcon();
920 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
921 : (HICON
)GetDefaultIcon();
926 #endif // !__WXMICROWIN__
930 rc
= wxFrameBase::MSWWindowProc(message
, wParam
, lParam
);
935 // handle WM_INITMENUPOPUP message
936 bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu
)
941 int nCount
= GetMenuBar()->GetMenuCount();
942 for (int n
= 0; n
< nCount
; n
++)
944 if (GetMenuBar()->GetMenu(n
)->GetHMenu() == hMenu
)
946 menu
= GetMenuBar()->GetMenu(n
);
952 wxMenuEvent
event(wxEVT_MENU_OPEN
, 0, menu
);
953 event
.SetEventObject(this);
955 return GetEventHandler()->ProcessEvent(event
);