1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "frame.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
37 #include "wx/dialog.h"
38 #include "wx/settings.h"
39 #include "wx/dcclient.h"
42 #include "wx/msw/private.h"
45 #include "wx/statusbr.h"
46 #include "wx/generic/statusbr.h"
47 #endif // wxUSE_STATUSBAR
50 #include "wx/toolbar.h"
51 #endif // wxUSE_TOOLBAR
53 #include "wx/menuitem.h"
56 // ----------------------------------------------------------------------------
58 // ----------------------------------------------------------------------------
60 extern wxWindowList wxModelessWindows
;
61 extern wxList WXDLLEXPORT wxPendingDelete
;
62 extern const wxChar
*wxFrameClassName
;
63 extern wxMenu
*wxCurrentPopupMenu
;
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
70 EVT_ACTIVATE(wxFrame::OnActivate
)
71 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
74 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxWindow
)
76 // ============================================================================
78 // ============================================================================
80 // ----------------------------------------------------------------------------
81 // static class members
82 // ----------------------------------------------------------------------------
84 #if wxUSE_NATIVE_STATUSBAR
85 bool wxFrame::m_useNativeStatusBar
= TRUE
;
87 bool wxFrame::m_useNativeStatusBar
= FALSE
;
90 // ----------------------------------------------------------------------------
91 // creation/destruction
92 // ----------------------------------------------------------------------------
102 // Data to save/restore when calling ShowFullScreen
104 m_fsOldWindowStyle
= 0;
105 m_fsStatusBarFields
= 0;
106 m_fsStatusBarHeight
= 0;
107 m_fsToolBarHeight
= 0;
109 m_fsIsMaximized
= FALSE
;
110 m_fsIsShowing
= FALSE
;
113 bool wxFrame::Create(wxWindow
*parent
,
115 const wxString
& title
,
119 const wxString
& name
)
122 m_windowStyle
= style
;
123 m_frameMenuBar
= NULL
;
124 m_frameToolBar
= NULL
;
125 m_frameStatusBar
= NULL
;
127 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
132 m_windowId
= (int)NewControlId();
134 if (parent
) parent
->AddChild(this);
143 // we pass NULL as parent to MSWCreate because frames with parents behave
144 // very strangely under Win95 shell
145 // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
147 if ((m_windowStyle
& wxFRAME_FLOAT_ON_PARENT
) == 0)
151 wxTopLevelWindows
.Append(this);
153 MSWCreate(m_windowId
, parent
, wxFrameClassName
, this, title
,
154 x
, y
, width
, height
, style
);
156 wxModelessWindows
.Append(this);
162 m_isBeingDeleted
= TRUE
;
163 wxTopLevelWindows
.DeleteObject(this);
167 if (wxTheApp
&& (wxTopLevelWindows
.Number() == 0))
169 wxTheApp
->SetTopWindow(NULL
);
171 if (wxTheApp
->GetExitOnFrameDelete())
177 wxModelessWindows
.DeleteObject(this);
179 // For some reason, wxWindows can activate another task altogether
180 // when a frame is destroyed after a modal dialog has been invoked.
181 // Try to bring the parent to the top.
182 // MT:Only do this if this frame is currently the active window, else weird
183 // things start to happen
184 if ( wxGetActiveWindow() == this )
185 if (GetParent() && GetParent()->GetHWND())
186 ::BringWindowToTop((HWND
) GetParent()->GetHWND());
189 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
190 void wxFrame::DoGetClientSize(int *x
, int *y
) const
193 ::GetClientRect(GetHwnd(), &rect
);
196 if ( GetStatusBar() && GetStatusBar()->IsShown() )
198 int statusX
, statusY
;
199 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
200 rect
.bottom
-= statusY
;
202 #endif // wxUSE_STATUSBAR
204 wxPoint
pt(GetClientAreaOrigin());
214 // Set the client size (i.e. leave the calculation of borders etc.
216 void wxFrame::DoSetClientSize(int width
, int height
)
218 HWND hWnd
= GetHwnd();
221 ::GetClientRect(hWnd
, &rect
);
224 GetWindowRect(hWnd
, &rect2
);
226 // Find the difference between the entire window (title bar and all)
227 // and the client area; add this to the new client size to move the
229 int actual_width
= rect2
.right
- rect2
.left
- rect
.right
+ width
;
230 int actual_height
= rect2
.bottom
- rect2
.top
- rect
.bottom
+ height
;
233 if ( GetStatusBar() && GetStatusBar()->IsShown())
235 int statusX
, statusY
;
236 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
237 actual_height
+= statusY
;
239 #endif // wxUSE_STATUSBAR
241 wxPoint
pt(GetClientAreaOrigin());
242 actual_width
+= pt
.y
;
243 actual_height
+= pt
.x
;
246 point
.x
= rect2
.left
;
249 MoveWindow(hWnd
, point
.x
, point
.y
, actual_width
, actual_height
, (BOOL
)TRUE
);
251 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
252 event
.SetEventObject( this );
253 GetEventHandler()->ProcessEvent(event
);
256 void wxFrame::DoGetSize(int *width
, int *height
) const
259 GetWindowRect(GetHwnd(), &rect
);
260 *width
= rect
.right
- rect
.left
;
261 *height
= rect
.bottom
- rect
.top
;
264 void wxFrame::DoGetPosition(int *x
, int *y
) const
267 GetWindowRect(GetHwnd(), &rect
);
276 // ----------------------------------------------------------------------------
277 // variations around ::ShowWindow()
278 // ----------------------------------------------------------------------------
280 void wxFrame::DoShowWindow(int nShowCmd
)
282 ::ShowWindow(GetHwnd(), nShowCmd
);
284 m_iconized
= nShowCmd
== SW_MINIMIZE
;
287 bool wxFrame::Show(bool show
)
289 DoShowWindow(show
? SW_SHOW
: SW_HIDE
);
293 ::BringWindowToTop(GetHwnd());
295 wxActivateEvent
event(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
296 event
.SetEventObject( this );
297 GetEventHandler()->ProcessEvent(event
);
301 // Try to highlight the correct window (the parent)
304 HWND hWndParent
= GetHwndOf(GetParent());
306 ::BringWindowToTop(hWndParent
);
313 void wxFrame::Iconize(bool iconize
)
315 DoShowWindow(iconize
? SW_MINIMIZE
: SW_RESTORE
);
318 void wxFrame::Maximize(bool maximize
)
320 DoShowWindow(maximize
? SW_MAXIMIZE
: SW_RESTORE
);
323 void wxFrame::Restore()
325 DoShowWindow(SW_RESTORE
);
328 bool wxFrame::IsIconized() const
330 ((wxFrame
*)this)->m_iconized
= (::IsIconic(GetHwnd()) != 0);
335 bool wxFrame::IsMaximized() const
337 return (::IsZoomed(GetHwnd()) != 0);
340 void wxFrame::SetIcon(const wxIcon
& icon
)
342 wxFrameBase::SetIcon(icon
);
344 #if defined(__WIN95__)
347 SendMessage(GetHwnd(), WM_SETICON
,
348 (WPARAM
)TRUE
, (LPARAM
)(HICON
) m_icon
.GetHICON());
354 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
,
357 const wxString
& name
)
359 wxStatusBar
*statusBar
= NULL
;
361 #if wxUSE_NATIVE_STATUSBAR
362 if ( UsesNativeStatusBar() )
364 statusBar
= (wxStatusBar
*)new wxStatusBar95(this, id
, style
);
366 statusBar
->SetFieldsCount(number
);
371 statusBar
= (wxStatusBar
*)new wxStatusBarGeneric(this, id
, style
, name
);
373 // Set the height according to the font and the border size
374 wxClientDC
dc(statusBar
);
375 dc
.SetFont(statusBar
->GetFont());
378 dc
.GetTextExtent(_T("X"), NULL
, &y
);
380 int height
= (int)( (11*y
)/10 + 2*statusBar
->GetBorderY());
382 statusBar
->SetSize(-1, -1, -1, height
);
384 statusBar
->SetFieldsCount(number
);
390 void wxFrame::PositionStatusBar()
392 if ( !m_frameStatusBar
)
395 // native status bar positions itself, but we must forward the WM_SIZE
397 #if wxUSE_NATIVE_STATUSBAR
398 wxStatusBar95
*sb
= wxDynamicCast(m_frameStatusBar
, wxStatusBar95
);
401 wxSizeEvent
event(GetSize(), sb
->GetId());
402 event
.SetEventObject(sb
);
404 sb
->GetEventHandler()->ProcessEvent(event
);
407 #endif // wxUSE_NATIVE_STATUSBAR
410 GetClientSize(&w
, &h
);
412 m_frameStatusBar
->GetSize(&sw
, &sh
);
414 // Since we wish the status bar to be directly under the client area,
415 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
416 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
419 #endif // wxUSE_STATUSBAR
421 void wxFrame::DetachMenuBar()
425 m_frameMenuBar
->Detach();
426 m_frameMenuBar
= NULL
;
430 void wxFrame::SetMenuBar(wxMenuBar
*menu_bar
)
438 m_frameMenuBar
= NULL
;
440 // Can set a menubar several times.
441 // TODO: how to prevent a memory leak if you have a currently-unattached
442 // menubar? wxWindows assumes that the frame will delete the menu (otherwise
443 // there are problems for MDI).
444 if (menu_bar
->GetHMenu())
446 m_hMenu
= menu_bar
->GetHMenu();
452 m_hMenu
= menu_bar
->Create();
458 InternalSetMenuBar();
460 m_frameMenuBar
= menu_bar
;
461 menu_bar
->Attach(this);
463 #if 0 // Old code that assumes only one call of SetMenuBar per frame.
470 wxCHECK_RET( !menu_bar
->GetFrame(), wxT("this menubar is already attached") );
473 delete m_frameMenuBar
;
475 m_hMenu
= menu_bar
->Create();
480 InternalSetMenuBar();
482 m_frameMenuBar
= menu_bar
;
483 menu_bar
->Attach(this);
487 void wxFrame::InternalSetMenuBar()
489 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
491 wxLogLastError("SetMenu");
495 // Responds to colour changes, and passes event on to children.
496 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
498 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
501 if ( m_frameStatusBar
)
503 wxSysColourChangedEvent event2
;
504 event2
.SetEventObject( m_frameStatusBar
);
505 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
508 // Propagate the event to the non-top-level children
509 wxWindow::OnSysColourChanged(event
);
512 // Pass TRUE to show full screen, FALSE to restore.
513 bool wxFrame::ShowFullScreen(bool show
, long style
)
520 m_fsIsShowing
= TRUE
;
523 wxToolBar
*theToolBar
= GetToolBar();
524 wxStatusBar
*theStatusBar
= GetStatusBar();
529 theToolBar
->GetSize(&dummyWidth
, &m_fsToolBarHeight
);
531 theStatusBar
->GetSize(&dummyWidth
, &m_fsStatusBarHeight
);
533 // zap the toolbar, menubar, and statusbar
535 if ((style
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
537 theToolBar
->SetSize(-1,0);
538 theToolBar
->Show(FALSE
);
541 if (style
& wxFULLSCREEN_NOMENUBAR
)
542 SetMenu((HWND
)GetHWND(), (HMENU
) NULL
);
544 // Save the number of fields in the statusbar
545 if ((style
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
547 m_fsStatusBarFields
= theStatusBar
->GetFieldsCount();
548 SetStatusBar((wxStatusBar
*) NULL
);
552 m_fsStatusBarFields
= 0;
554 // zap the frame borders
556 // save the 'normal' window style
557 m_fsOldWindowStyle
= GetWindowLong((HWND
)GetHWND(), GWL_STYLE
);
559 // save the old position, width & height, maximize state
560 m_fsOldSize
= GetRect();
561 m_fsIsMaximized
= IsMaximized();
563 // decide which window style flags to turn off
564 LONG newStyle
= m_fsOldWindowStyle
;
567 if (style
& wxFULLSCREEN_NOBORDER
)
568 offFlags
|= WS_BORDER
;
569 if (style
& wxFULLSCREEN_NOCAPTION
)
570 offFlags
|= (WS_CAPTION
| WS_SYSMENU
);
572 newStyle
&= (~offFlags
);
574 // change our window style to be compatible with full-screen mode
575 SetWindowLong((HWND
)GetHWND(), GWL_STYLE
, newStyle
);
577 // resize to the size of the desktop
581 ::GetWindowRect(GetDesktopWindow(), &rect
);
582 width
= rect
.right
- rect
.left
;
583 height
= rect
.bottom
- rect
.top
;
585 SetSize(width
, height
);
587 // now flush the window style cache and actually go full-screen
588 SetWindowPos((HWND
)GetHWND(), HWND_TOP
, 0, 0, width
, height
, SWP_FRAMECHANGED
);
590 wxSizeEvent
event(wxSize(width
, height
), GetId());
591 GetEventHandler()->ProcessEvent(event
);
600 m_fsIsShowing
= FALSE
;
602 wxToolBar
*theToolBar
= GetToolBar();
604 // restore the toolbar, menubar, and statusbar
605 if (theToolBar
&& (m_fsStyle
& wxFULLSCREEN_NOTOOLBAR
))
607 theToolBar
->SetSize(-1, m_fsToolBarHeight
);
608 theToolBar
->Show(TRUE
);
611 if ((m_fsStyle
& wxFULLSCREEN_NOSTATUSBAR
) && (m_fsStatusBarFields
> 0))
613 CreateStatusBar(m_fsStatusBarFields
);
617 if ((m_fsStyle
& wxFULLSCREEN_NOMENUBAR
) && (m_hMenu
!= 0))
618 SetMenu((HWND
)GetHWND(), (HMENU
)m_hMenu
);
620 Maximize(m_fsIsMaximized
);
621 SetWindowLong((HWND
)GetHWND(),GWL_STYLE
, m_fsOldWindowStyle
);
622 SetWindowPos((HWND
)GetHWND(),HWND_TOP
,m_fsOldSize
.x
, m_fsOldSize
.y
,
623 m_fsOldSize
.width
, m_fsOldSize
.height
, SWP_FRAMECHANGED
);
634 bool wxFrame::MSWCreate(int id
, wxWindow
*parent
, const wxChar
*wclass
, wxWindow
*wx_win
, const wxChar
*title
,
635 int x
, int y
, int width
, int height
, long style
)
638 m_defaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
640 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
641 // could be the culprit. But without it, you can get a lot of flicker.
644 if ((style
& wxCAPTION
) == wxCAPTION
)
645 msflags
= WS_OVERLAPPED
;
649 if (style
& wxMINIMIZE_BOX
)
650 msflags
|= WS_MINIMIZEBOX
;
651 if (style
& wxMAXIMIZE_BOX
)
652 msflags
|= WS_MAXIMIZEBOX
;
653 if (style
& wxTHICK_FRAME
)
654 msflags
|= WS_THICKFRAME
;
655 if (style
& wxSYSTEM_MENU
)
656 msflags
|= WS_SYSMENU
;
657 if ((style
& wxMINIMIZE
) || (style
& wxICONIZE
))
658 msflags
|= WS_MINIMIZE
;
659 if (style
& wxMAXIMIZE
)
660 msflags
|= WS_MAXIMIZE
;
661 if (style
& wxCAPTION
)
662 msflags
|= WS_CAPTION
;
663 if (style
& wxCLIP_CHILDREN
)
664 msflags
|= WS_CLIPCHILDREN
;
666 // Keep this in wxFrame because it saves recoding this function
669 if (style
& wxTINY_CAPTION_VERT
)
670 msflags
|= IBS_VERTCAPTION
;
671 if (style
& wxTINY_CAPTION_HORIZ
)
672 msflags
|= IBS_HORZCAPTION
;
674 if (style
& wxTINY_CAPTION_VERT
)
675 msflags
|= WS_CAPTION
;
676 if (style
& wxTINY_CAPTION_HORIZ
)
677 msflags
|= WS_CAPTION
;
679 if ((style
& wxTHICK_FRAME
) == 0)
680 msflags
|= WS_BORDER
;
682 WXDWORD extendedStyle
= MakeExtendedStyle(style
);
684 #if !defined(__WIN16__) && !defined(__SC__)
685 if (style
& wxFRAME_TOOL_WINDOW
)
686 extendedStyle
|= WS_EX_TOOLWINDOW
;
689 if (style
& wxSTAY_ON_TOP
)
690 extendedStyle
|= WS_EX_TOPMOST
;
693 if ( !wxWindow::MSWCreate(id
, parent
, wclass
, wx_win
, title
, x
, y
, width
, height
,
694 msflags
, NULL
, extendedStyle
) )
697 // Seems to be necessary if we use WS_POPUP
698 // style instead of WS_OVERLAPPED
699 if (width
> -1 && height
> -1)
700 ::PostMessage(GetHwnd(), WM_SIZE
, SIZE_RESTORED
, MAKELPARAM(width
, height
));
705 // Default activation behaviour - set the focus for the first child
707 void wxFrame::OnActivate(wxActivateEvent
& event
)
709 if ( !event
.GetActive() )
716 wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd
);
718 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
720 node
= node
->GetNext() )
722 // FIXME all this is totally bogus - we need to do the same as wxPanel,
723 // but how to do it without duplicating the code?
726 wxWindow
*child
= node
->GetData();
728 if ( !child
->IsTopLevel()
730 && !wxDynamicCast(child
, wxToolBar
)
731 #endif // wxUSE_TOOLBAR
733 && !wxDynamicCast(child
, wxStatusBar
)
734 #endif // wxUSE_STATUSBAR
743 // ----------------------------------------------------------------------------
744 // tool/status bar stuff
745 // ----------------------------------------------------------------------------
749 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
751 if ( wxFrameBase::CreateToolBar(style
, id
, name
) )
756 return m_frameToolBar
;
759 void wxFrame::PositionToolBar()
762 ::GetClientRect(GetHwnd(), &rect
);
765 if ( GetStatusBar() )
767 int statusX
, statusY
;
768 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
769 rect
.bottom
-= statusY
;
771 #endif // wxUSE_STATUSBAR
773 if ( GetToolBar() && GetToolBar()->IsShown() )
776 GetToolBar()->GetSize(&tw
, &th
);
778 if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
787 // Use the 'real' MSW position here
788 GetToolBar()->SetSize(0, 0, tw
, th
, wxSIZE_NO_ADJUSTMENTS
);
791 #endif // wxUSE_TOOLBAR
793 // ----------------------------------------------------------------------------
794 // frame state (iconized/maximized/...)
795 // ----------------------------------------------------------------------------
797 // propagate our state change to all child frames: this allows us to emulate X
798 // Windows behaviour where child frames float independently of the parent one
799 // on the desktop, but are iconized/restored with it
800 void wxFrame::IconizeChildFrames(bool bIconize
)
802 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
804 node
= node
->GetNext() )
806 wxWindow
*win
= node
->GetData();
808 if ( win
->IsKindOf(CLASSINFO(wxFrame
)) )
810 ((wxFrame
*)win
)->Iconize(bIconize
);
815 // ===========================================================================
816 // message processing
817 // ===========================================================================
819 // ---------------------------------------------------------------------------
821 // ---------------------------------------------------------------------------
823 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
825 if ( wxWindow::MSWTranslateMessage(pMsg
) )
828 // try the menu bar accels
829 wxMenuBar
*menuBar
= GetMenuBar();
833 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
834 return acceleratorTable
.Translate(this, pMsg
);
837 // ---------------------------------------------------------------------------
838 // our private (non virtual) message handlers
839 // ---------------------------------------------------------------------------
841 bool wxFrame::HandlePaint()
844 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
848 HICON hIcon
= m_icon
.Ok() ? GetHiconOf(m_icon
)
849 : (HICON
)m_defaultIcon
;
851 // Hold a pointer to the dc so long as the OnPaint() message
852 // is being processed
854 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
856 // Erase background before painting or we get white background
857 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
862 ::GetClientRect(GetHwnd(), &rect
);
864 // FIXME: why hardcoded?
865 static const int icon_width
= 32;
866 static const int icon_height
= 32;
868 int icon_x
= (int)((rect
.right
- icon_width
)/2);
869 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
871 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
874 ::EndPaint(GetHwnd(), &ps
);
880 return wxWindow::HandlePaint();
885 // nothing to paint - processed
890 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
892 bool processed
= FALSE
;
897 // only do it it if we were iconized before, otherwise resizing the
898 // parent frame has a curious side effect of bringing it under it's
903 // restore all child frames too
904 IconizeChildFrames(FALSE
);
913 // iconize all child frames too
914 IconizeChildFrames(TRUE
);
925 wxSizeEvent
event(wxSize(x
, y
), m_windowId
);
926 event
.SetEventObject( this );
927 processed
= GetEventHandler()->ProcessEvent(event
);
933 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
937 // In case it's e.g. a toolbar.
938 wxWindow
*win
= wxFindWinFromHandle(control
);
940 return win
->MSWCommand(cmd
, id
);
943 // handle here commands from menus and accelerators
944 if ( cmd
== 0 || cmd
== 1 )
946 if ( wxCurrentPopupMenu
)
948 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
949 wxCurrentPopupMenu
= NULL
;
951 return popupMenu
->MSWCommand(cmd
, id
);
954 if ( ProcessCommand(id
) )
963 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU hMenu
)
966 if ( flags
== 0xFFFF && hMenu
== 0 )
968 // menu was removed from screen
971 else if ( !(flags
& MF_POPUP
) && !(flags
& MF_SEPARATOR
) )
977 // don't give hints for separators (doesn't make sense) nor for the
978 // items opening popup menus (they don't have them anyhow)
982 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
983 event
.SetEventObject( this );
985 return GetEventHandler()->ProcessEvent(event
);
988 // ---------------------------------------------------------------------------
989 // the window proc for wxFrame
990 // ---------------------------------------------------------------------------
992 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
995 bool processed
= FALSE
;
1000 // if we can't close, tell the system that we processed the
1001 // message - otherwise it would close us
1002 processed
= !Close();
1009 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
1012 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
1020 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
1022 processed
= HandleMenuSelect(item
, flags
, hmenu
);
1027 processed
= HandlePaint();
1030 case WM_QUERYDRAGICON
:
1032 HICON hIcon
= m_icon
.Ok() ? GetHiconOf(m_icon
)
1033 : (HICON
)(m_defaultIcon
);
1035 processed
= rc
!= 0;
1040 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
1045 rc
= wxWindow::MSWWindowProc(message
, wParam
, lParam
);