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 #if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
326 wxToolBar
* toolBar
= new wxToolBar(this, -1,
327 wxDefaultPosition
, wxDefaultSize
,
328 wxBORDER_NONE
| wxTB_HORIZONTAL
,
329 wxToolBarNameStr
, menubar
);
331 menubar
->SetToolBar(toolBar
);
335 wxFrameBase::AttachMenuBar(menubar
);
339 // actually remove the menu from the frame
340 m_hMenu
= (WXHMENU
)0;
341 InternalSetMenuBar();
343 else // set new non NULL menu bar
345 #if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
346 // Can set a menubar several times.
347 if ( menubar
->GetHMenu() )
349 m_hMenu
= menubar
->GetHMenu();
353 m_hMenu
= menubar
->Create();
357 wxFAIL_MSG( _T("failed to create menu bar") );
362 InternalSetMenuBar();
366 void wxFrame::InternalSetMenuBar()
368 #if defined(__WXMICROWIN__) || defined(__WXWINCE__)
371 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
373 wxLogLastError(wxT("SetMenu"));
378 #endif // wxUSE_MENUS_NATIVE
380 // Responds to colour changes, and passes event on to children.
381 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
383 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
387 if ( m_frameStatusBar
)
389 wxSysColourChangedEvent event2
;
390 event2
.SetEventObject( m_frameStatusBar
);
391 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
393 #endif // wxUSE_STATUSBAR
395 // Propagate the event to the non-top-level children
396 wxWindow::OnSysColourChanged(event
);
399 // Pass TRUE to show full screen, FALSE to restore.
400 bool wxFrame::ShowFullScreen(bool show
, long style
)
402 if ( IsFullScreen() == show
)
408 #if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
409 // TODO: hide commandbar
411 wxToolBar
*theToolBar
= GetToolBar();
413 theToolBar
->GetSize(NULL
, &m_fsToolBarHeight
);
415 // zap the toolbar, menubar, and statusbar
417 if ((style
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
419 theToolBar
->SetSize(-1,0);
420 theToolBar
->Show(FALSE
);
422 #endif // __WXWINCE__
423 #endif // wxUSE_TOOLBAR
425 #if defined(__WXMICROWIN__)
426 #elif defined(__WXWINCE__)
427 // TODO: make it work for WinCE
429 if (style
& wxFULLSCREEN_NOMENUBAR
)
430 SetMenu((HWND
)GetHWND(), (HMENU
) NULL
);
434 wxStatusBar
*theStatusBar
= GetStatusBar();
436 theStatusBar
->GetSize(NULL
, &m_fsStatusBarHeight
);
438 // Save the number of fields in the statusbar
439 if ((style
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
441 //m_fsStatusBarFields = theStatusBar->GetFieldsCount();
442 //SetStatusBar((wxStatusBar*) NULL);
443 //delete theStatusBar;
444 theStatusBar
->Show(FALSE
);
447 m_fsStatusBarFields
= 0;
448 #endif // wxUSE_STATUSBAR
453 #if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
454 // TODO: show commandbar
456 wxToolBar
*theToolBar
= GetToolBar();
458 // restore the toolbar, menubar, and statusbar
459 if (theToolBar
&& (m_fsStyle
& wxFULLSCREEN_NOTOOLBAR
))
461 theToolBar
->SetSize(-1, m_fsToolBarHeight
);
462 theToolBar
->Show(TRUE
);
464 #endif // __WXWINCE__
465 #endif // wxUSE_TOOLBAR
468 if ( m_fsStyle
& wxFULLSCREEN_NOSTATUSBAR
)
470 //CreateStatusBar(m_fsStatusBarFields);
473 GetStatusBar()->Show(TRUE
);
477 #endif // wxUSE_STATUSBAR
479 #if defined(__WXMICROWIN__)
480 #elif defined(__WXWINCE__)
481 // TODO: make it work for WinCE
483 if ((m_fsStyle
& wxFULLSCREEN_NOMENUBAR
) && (m_hMenu
!= 0))
484 SetMenu((HWND
)GetHWND(), (HMENU
)m_hMenu
);
488 return wxFrameBase::ShowFullScreen(show
, style
);
491 // ----------------------------------------------------------------------------
492 // tool/status bar stuff
493 // ----------------------------------------------------------------------------
497 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
499 #if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
500 // We may already have a toolbar from calling SetMenuBar.
504 if ( wxFrameBase::CreateToolBar(style
, id
, name
) )
509 return m_frameToolBar
;
512 void wxFrame::PositionToolBar()
514 wxToolBar
*toolbar
= GetToolBar();
515 if ( toolbar
&& toolbar
->IsShown() )
517 #if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
518 // We want to do something different in WinCE, because
519 // the toolbar should be associated with the commandbar,
520 // and not an independent window.
523 // don't call our (or even wxTopLevelWindow) version because we want
524 // the real (full) client area size, not excluding the tool/status bar
526 wxWindow::DoGetClientSize(&width
, &height
);
529 wxStatusBar
*statbar
= GetStatusBar();
530 if ( statbar
&& statbar
->IsShown() )
532 height
-= statbar
->GetClientSize().y
;
534 #endif // wxUSE_STATUSBAR
538 toolbar
->GetPosition(&tx
, &ty
);
539 toolbar
->GetSize(&tw
, &th
);
542 if (ty
< 0 && (-ty
== th
))
544 if (tx
< 0 && (-tx
== tw
))
550 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
557 // if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
561 // use the 'real' MSW position here, don't offset relativly to the
562 // client area origin
564 // Optimise such that we don't have to always resize the toolbar
565 // when the frame changes, otherwise we'll get a lot of flicker.
566 bool heightChanging
= TRUE
;
567 bool widthChanging
= TRUE
;
569 if ( toolbar
->GetWindowStyleFlag() & wxTB_VERTICAL
)
571 // It's OK if the current height is greater than what can be shown.
572 heightChanging
= (desiredH
> th
) ;
573 widthChanging
= (desiredW
!= tw
) ;
575 // The next time around, we may not have to set the size
577 desiredH
= desiredH
+ 200;
581 // It's OK if the current width is greater than what can be shown.
582 widthChanging
= (desiredW
> tw
) ;
583 heightChanging
= (desiredH
!= th
) ;
585 // The next time around, we may not have to set the size
587 desiredW
= desiredW
+ 200;
590 if (tx
!= 0 || ty
!= 0 || widthChanging
|| heightChanging
)
591 toolbar
->SetSize(0, 0, desiredW
, desiredH
, wxSIZE_NO_ADJUSTMENTS
);
593 #endif // __WXWINCE__
597 #endif // wxUSE_TOOLBAR
599 // ----------------------------------------------------------------------------
600 // frame state (iconized/maximized/...)
601 // ----------------------------------------------------------------------------
603 // propagate our state change to all child frames: this allows us to emulate X
604 // Windows behaviour where child frames float independently of the parent one
605 // on the desktop, but are iconized/restored with it
606 void wxFrame::IconizeChildFrames(bool bIconize
)
608 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
610 node
= node
->GetNext() )
612 wxWindow
*win
= node
->GetData();
614 // iconizing the frames with this style under Win95 shell puts them at
615 // the bottom of the screen (as the MDI children) instead of making
616 // them appear in the taskbar because they are, by virtue of this
617 // style, not managed by the taskbar - instead leave Windows take care
620 if ( win
->GetWindowStyle() & wxFRAME_TOOL_WINDOW
)
624 // the child MDI frames are a special case and should not be touched by
625 // the parent frame - instead, they are managed by the user
626 wxFrame
*frame
= wxDynamicCast(win
, wxFrame
);
628 #if wxUSE_MDI_ARCHITECTURE
629 && !wxDynamicCast(frame
, wxMDIChildFrame
)
630 #endif // wxUSE_MDI_ARCHITECTURE
633 // we don't want to restore the child frames which had been
634 // iconized even before we were iconized, so save the child frame
635 // status when iconizing the parent frame and check it when
639 frame
->m_wasMinimized
= frame
->IsIconized();
642 // note that we shouldn't touch the hidden frames neither because
643 // iconizing/restoring them would show them as a side effect
644 if ( !frame
->m_wasMinimized
&& frame
->IsShown() )
645 frame
->Iconize(bIconize
);
650 WXHICON
wxFrame::GetDefaultIcon() const
652 // we don't have any standard icons (any more)
656 // ===========================================================================
657 // message processing
658 // ===========================================================================
660 // ---------------------------------------------------------------------------
662 // ---------------------------------------------------------------------------
664 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
666 if ( wxWindow::MSWTranslateMessage(pMsg
) )
669 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
670 // try the menu bar accels
671 wxMenuBar
*menuBar
= GetMenuBar();
675 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
676 return acceleratorTable
.Translate(this, pMsg
);
679 #endif // wxUSE_MENUS && wxUSE_ACCEL
682 // ---------------------------------------------------------------------------
683 // our private (non virtual) message handlers
684 // ---------------------------------------------------------------------------
686 bool wxFrame::HandlePaint()
689 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
691 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
694 const wxIcon
& icon
= GetIcon();
695 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
696 : (HICON
)GetDefaultIcon();
698 // Hold a pointer to the dc so long as the OnPaint() message
699 // is being processed
701 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
703 // Erase background before painting or we get white background
704 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
709 ::GetClientRect(GetHwnd(), &rect
);
711 // FIXME: why hardcoded?
712 static const int icon_width
= 32;
713 static const int icon_height
= 32;
715 int icon_x
= (int)((rect
.right
- icon_width
)/2);
716 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
718 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
721 ::EndPaint(GetHwnd(), &ps
);
728 return wxWindow::HandlePaint();
733 // nothing to paint - processed
738 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
740 bool processed
= FALSE
;
741 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
746 // only do it it if we were iconized before, otherwise resizing the
747 // parent frame has a curious side effect of bringing it under it's
752 // restore all child frames too
753 IconizeChildFrames(FALSE
);
755 (void)SendIconizeEvent(FALSE
);
764 // iconize all child frames too
765 IconizeChildFrames(TRUE
);
767 (void)SendIconizeEvent();
778 #endif // wxUSE_STATUSBAR
782 #endif // wxUSE_TOOLBAR
784 processed
= wxWindow::HandleSize(x
, y
, id
);
790 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
794 // In case it's e.g. a toolbar.
795 wxWindow
*win
= wxFindWinFromHandle(control
);
797 return win
->MSWCommand(cmd
, id
);
800 // handle here commands from menus and accelerators
801 if ( cmd
== 0 || cmd
== 1 )
803 #if wxUSE_MENUS_NATIVE
804 if ( wxCurrentPopupMenu
)
806 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
807 wxCurrentPopupMenu
= NULL
;
809 return popupMenu
->MSWCommand(cmd
, id
);
811 #endif // wxUSE_MENUS_NATIVE
813 if ( ProcessCommand(id
) )
822 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU hMenu
)
825 if ( flags
== 0xFFFF && hMenu
== 0 )
827 // menu was removed from screen
830 #ifndef __WXMICROWIN__
831 else if ( !(flags
& MF_POPUP
) && !(flags
& MF_SEPARATOR
) )
838 // don't give hints for separators (doesn't make sense) nor for the
839 // items opening popup menus (they don't have them anyhow) but do clear
840 // the status line - otherwise, we would be left with the help message
841 // for the previous item which doesn't apply any more
842 DoGiveHelp(wxEmptyString
, FALSE
);
847 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
848 event
.SetEventObject(this);
850 return GetEventHandler()->ProcessEvent(event
);
853 bool wxFrame::HandleMenuLoop(const wxEventType
& evtType
, WXWORD isPopup
)
855 // we don't have the menu id here, so we use the id to specify if the event
856 // was from a popup menu or a normal one
857 wxMenuEvent
event(evtType
, isPopup
? -1 : 0);
858 event
.SetEventObject(this);
860 return GetEventHandler()->ProcessEvent(event
);
863 // ---------------------------------------------------------------------------
864 // the window proc for wxFrame
865 // ---------------------------------------------------------------------------
867 WXLRESULT
wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
870 bool processed
= FALSE
;
875 // if we can't close, tell the system that we processed the
876 // message - otherwise it would close us
877 processed
= !Close();
881 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
888 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
891 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
896 processed
= HandlePaint();
899 case WM_INITMENUPOPUP
:
900 processed
= HandleInitMenuPopup((WXHMENU
) wParam
);
903 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
908 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
910 processed
= HandleMenuSelect(item
, flags
, hmenu
);
914 case WM_EXITMENULOOP
:
915 processed
= HandleMenuLoop(wxEVT_MENU_CLOSE
, wParam
);
918 case WM_QUERYDRAGICON
:
920 const wxIcon
& icon
= GetIcon();
921 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
922 : (HICON
)GetDefaultIcon();
927 #endif // !__WXMICROWIN__
931 rc
= wxFrameBase::MSWWindowProc(message
, wParam
, lParam
);
936 // handle WM_INITMENUPOPUP message
937 bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu
)
942 int nCount
= GetMenuBar()->GetMenuCount();
943 for (int n
= 0; n
< nCount
; n
++)
945 if (GetMenuBar()->GetMenu(n
)->GetHMenu() == hMenu
)
947 menu
= GetMenuBar()->GetMenu(n
);
953 wxMenuEvent
event(wxEVT_MENU_OPEN
, 0, menu
);
954 event
.SetEventObject(this);
956 return GetEventHandler()->ProcessEvent(event
);