1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "frame.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 #include "wx/dialog.h"
30 #include "wx/settings.h"
31 #include "wx/dcclient.h"
34 #include "wx/msw/private.h"
35 #include "wx/statusbr.h"
36 #include "wx/toolbar.h"
37 #include "wx/menuitem.h"
40 #if wxUSE_NATIVE_STATUSBAR
41 #include <wx/msw/statbr95.h>
44 extern wxWindowList wxModelessWindows
;
45 extern wxList WXDLLEXPORT wxPendingDelete
;
46 extern wxChar wxFrameClassName
[];
47 extern wxMenu
*wxCurrentPopupMenu
;
49 #if !USE_SHARED_LIBRARY
50 BEGIN_EVENT_TABLE(wxFrame
, wxWindow
)
51 EVT_SIZE(wxFrame::OnSize
)
52 EVT_ACTIVATE(wxFrame::OnActivate
)
53 EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight
)
54 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
55 EVT_IDLE(wxFrame::OnIdle
)
56 EVT_CLOSE(wxFrame::OnCloseWindow
)
59 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxWindow
)
62 #if wxUSE_NATIVE_STATUSBAR
63 bool wxFrame::m_useNativeStatusBar
= TRUE
;
65 bool wxFrame::m_useNativeStatusBar
= FALSE
;
70 m_frameToolBar
= NULL
;
71 m_frameMenuBar
= NULL
;
72 m_frameStatusBar
= NULL
;
77 bool wxFrame::Create(wxWindow
*parent
,
79 const wxString
& title
,
90 m_windowStyle
= style
;
91 m_frameMenuBar
= NULL
;
92 m_frameToolBar
= NULL
;
93 m_frameStatusBar
= NULL
;
95 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
101 m_windowId
= (int)NewControlId();
103 if (parent
) parent
->AddChild(this);
112 // we pass NULL as parent to MSWCreate because frames with parents behave
113 // very strangely under Win95 shell
114 // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
116 if ((m_windowStyle
& wxFRAME_FLOAT_ON_PARENT
) == 0)
120 wxTopLevelWindows
.Append(this);
122 MSWCreate(m_windowId
, parent
, wxFrameClassName
, this, title
,
123 x
, y
, width
, height
, style
);
125 wxModelessWindows
.Append(this);
131 m_isBeingDeleted
= TRUE
;
132 wxTopLevelWindows
.DeleteObject(this);
134 if (m_frameStatusBar
)
135 delete m_frameStatusBar
;
137 delete m_frameMenuBar
;
139 /* New behaviour March 1998: check if it's the last top-level window */
140 // if (wxTheApp && (this == wxTheApp->GetTopWindow()))
142 if (wxTheApp
&& (wxTopLevelWindows
.Number() == 0))
144 wxTheApp
->SetTopWindow(NULL
);
146 if (wxTheApp
->GetExitOnFrameDelete())
152 wxModelessWindows
.DeleteObject(this);
154 // For some reason, wxWindows can activate another task altogether
155 // when a frame is destroyed after a modal dialog has been invoked.
156 // Try to bring the parent to the top.
157 if (GetParent() && GetParent()->GetHWND())
158 ::BringWindowToTop((HWND
) GetParent()->GetHWND());
161 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
162 void wxFrame::DoGetClientSize(int *x
, int *y
) const
165 ::GetClientRect(GetHwnd(), &rect
);
167 if ( GetStatusBar() )
169 int statusX
, statusY
;
170 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
171 rect
.bottom
-= statusY
;
174 wxPoint
pt(GetClientAreaOrigin());
182 // Set the client size (i.e. leave the calculation of borders etc.
184 void wxFrame::DoSetClientSize(int width
, int height
)
186 HWND hWnd
= GetHwnd();
189 ::GetClientRect(hWnd
, &rect
);
192 GetWindowRect(hWnd
, &rect2
);
194 // Find the difference between the entire window (title bar and all)
195 // and the client area; add this to the new client size to move the
197 int actual_width
= rect2
.right
- rect2
.left
- rect
.right
+ width
;
198 int actual_height
= rect2
.bottom
- rect2
.top
- rect
.bottom
+ height
;
200 if ( GetStatusBar() )
202 int statusX
, statusY
;
203 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
204 actual_height
+= statusY
;
207 wxPoint
pt(GetClientAreaOrigin());
208 actual_width
+= pt
.y
;
209 actual_height
+= pt
.x
;
212 point
.x
= rect2
.left
;
215 MoveWindow(hWnd
, point
.x
, point
.y
, actual_width
, actual_height
, (BOOL
)TRUE
);
217 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
218 event
.SetEventObject( this );
219 GetEventHandler()->ProcessEvent(event
);
222 void wxFrame::DoGetSize(int *width
, int *height
) const
225 GetWindowRect(GetHwnd(), &rect
);
226 *width
= rect
.right
- rect
.left
;
227 *height
= rect
.bottom
- rect
.top
;
230 void wxFrame::DoGetPosition(int *x
, int *y
) const
233 GetWindowRect(GetHwnd(), &rect
);
242 void wxFrame::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
244 int currentX
, currentY
;
250 GetPosition(¤tX
, ¤tY
);
251 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
253 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
258 if (width
== -1) w1
= ww
;
259 if (height
==-1) h1
= hh
;
261 MoveWindow(GetHwnd(), x1
, y1
, w1
, h1
, (BOOL
)TRUE
);
263 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
264 event
.SetEventObject( this );
265 GetEventHandler()->ProcessEvent(event
);
268 bool wxFrame::Show(bool show
)
278 // Try to highlight the correct window (the parent)
282 hWndParent
= (HWND
) GetParent()->GetHWND();
284 ::BringWindowToTop(hWndParent
);
288 ShowWindow(GetHwnd(), (BOOL
)cshow
);
291 BringWindowToTop(GetHwnd());
293 wxActivateEvent
event(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
294 event
.SetEventObject( this );
295 GetEventHandler()->ProcessEvent(event
);
300 void wxFrame::Iconize(bool iconize
)
310 ShowWindow(GetHwnd(), (BOOL
)cshow
);
311 m_iconized
= iconize
;
314 // Equivalent to maximize/restore in Windows
315 void wxFrame::Maximize(bool maximize
)
323 ShowWindow(GetHwnd(), cshow
);
327 bool wxFrame::IsIconized() const
329 ((wxFrame
*)this)->m_iconized
= (::IsIconic(GetHwnd()) != 0);
334 bool wxFrame::IsMaximized() const
336 return (::IsZoomed(GetHwnd()) != 0) ;
339 void wxFrame::SetIcon(const wxIcon
& icon
)
342 #if defined(__WIN95__)
344 SendMessage(GetHwnd(), WM_SETICON
,
345 (WPARAM
)TRUE
, (LPARAM
)(HICON
) m_icon
.GetHICON());
350 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
, long style
, wxWindowID id
,
351 const wxString
& name
)
353 wxStatusBar
*statusBar
= NULL
;
355 #if wxUSE_NATIVE_STATUSBAR
356 if (UsesNativeStatusBar())
358 statusBar
= new wxStatusBar95(this, id
, style
);
363 statusBar
= new wxStatusBar(this, id
, wxPoint(0, 0), wxSize(100, 20),
366 // Set the height according to the font and the border size
367 wxClientDC
dc(statusBar
);
368 dc
.SetFont(statusBar
->GetFont());
371 dc
.GetTextExtent("X", &x
, &y
);
373 int height
= (int)( (y
* 1.1) + 2* statusBar
->GetBorderY());
375 statusBar
->SetSize(-1, -1, 100, height
);
378 statusBar
->SetFieldsCount(number
);
382 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
, wxWindowID id
,
383 const wxString
& name
)
385 // VZ: calling CreateStatusBar twice is an error - why anyone would do it?
386 wxCHECK_MSG( m_frameStatusBar
== NULL
, FALSE
,
387 _T("recreating status bar in wxFrame") );
389 m_frameStatusBar
= OnCreateStatusBar(number
, style
, id
,
391 if ( m_frameStatusBar
)
394 return m_frameStatusBar
;
400 void wxFrame::SetStatusText(const wxString
& text
, int number
)
402 wxCHECK_RET( m_frameStatusBar
!= NULL
, _T("no statusbar to set text for") );
404 m_frameStatusBar
->SetStatusText(text
, number
);
407 void wxFrame::SetStatusWidths(int n
, const int widths_field
[])
409 wxCHECK_RET( m_frameStatusBar
!= NULL
, _T("no statusbar to set widths for") );
411 m_frameStatusBar
->SetStatusWidths(n
, widths_field
);
415 void wxFrame::PositionStatusBar()
417 // native status bar positions itself
419 #if wxUSE_NATIVE_STATUSBAR
420 && !m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
))
425 GetClientSize(&w
, &h
);
427 m_frameStatusBar
->GetSize(&sw
, &sh
);
429 // Since we wish the status bar to be directly under the client area,
430 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
431 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
434 #endif // wxUSE_STATUSBAR
436 void wxFrame::SetMenuBar(wxMenuBar
*menu_bar
)
440 m_frameMenuBar
= NULL
;
444 wxCHECK_RET( !menu_bar
->GetFrame(), _T("this menubar is already attached") );
447 delete m_frameMenuBar
;
449 m_hMenu
= menu_bar
->Create();
454 InternalSetMenuBar();
456 m_frameMenuBar
= menu_bar
;
457 menu_bar
->Attach(this);
460 void wxFrame::InternalSetMenuBar()
462 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
464 wxLogLastError("SetMenu");
468 // Responds to colour changes, and passes event on to children.
469 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
471 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
474 if ( m_frameStatusBar
)
476 wxSysColourChangedEvent event2
;
477 event2
.SetEventObject( m_frameStatusBar
);
478 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
481 // Propagate the event to the non-top-level children
482 wxWindow::OnSysColourChanged(event
);
490 bool wxFrame::MSWCreate(int id
, wxWindow
*parent
, const wxChar
*wclass
, wxWindow
*wx_win
, const wxChar
*title
,
491 int x
, int y
, int width
, int height
, long style
)
494 m_defaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
496 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
497 // could be the culprit. But without it, you can get a lot of flicker.
500 if ((style
& wxCAPTION
) == wxCAPTION
)
501 msflags
= WS_OVERLAPPED
;
505 if (style
& wxMINIMIZE_BOX
)
506 msflags
|= WS_MINIMIZEBOX
;
507 if (style
& wxMAXIMIZE_BOX
)
508 msflags
|= WS_MAXIMIZEBOX
;
509 if (style
& wxTHICK_FRAME
)
510 msflags
|= WS_THICKFRAME
;
511 if (style
& wxSYSTEM_MENU
)
512 msflags
|= WS_SYSMENU
;
513 if ((style
& wxMINIMIZE
) || (style
& wxICONIZE
))
514 msflags
|= WS_MINIMIZE
;
515 if (style
& wxMAXIMIZE
)
516 msflags
|= WS_MAXIMIZE
;
517 if (style
& wxCAPTION
)
518 msflags
|= WS_CAPTION
;
519 if (style
& wxCLIP_CHILDREN
)
520 msflags
|= WS_CLIPCHILDREN
;
522 // Keep this in wxFrame because it saves recoding this function
525 if (style
& wxTINY_CAPTION_VERT
)
526 msflags
|= IBS_VERTCAPTION
;
527 if (style
& wxTINY_CAPTION_HORIZ
)
528 msflags
|= IBS_HORZCAPTION
;
530 if (style
& wxTINY_CAPTION_VERT
)
531 msflags
|= WS_CAPTION
;
532 if (style
& wxTINY_CAPTION_HORIZ
)
533 msflags
|= WS_CAPTION
;
535 if ((style
& wxTHICK_FRAME
) == 0)
536 msflags
|= WS_BORDER
;
538 WXDWORD extendedStyle
= MakeExtendedStyle(style
);
540 #if !defined(__WIN16__) && !defined(__SC__)
541 if (style
& wxFRAME_TOOL_WINDOW
)
542 extendedStyle
|= WS_EX_TOOLWINDOW
;
545 if (style
& wxSTAY_ON_TOP
)
546 extendedStyle
|= WS_EX_TOPMOST
;
549 if ( !wxWindow::MSWCreate(id
, parent
, wclass
, wx_win
, title
, x
, y
, width
, height
,
550 msflags
, NULL
, extendedStyle
) )
553 // Seems to be necessary if we use WS_POPUP
554 // style instead of WS_OVERLAPPED
555 if (width
> -1 && height
> -1)
556 ::PostMessage(GetHwnd(), WM_SIZE
, SIZE_RESTORED
, MAKELPARAM(width
, height
));
561 // Default resizing behaviour - if only ONE subwindow, resize to client
563 void wxFrame::OnSize(wxSizeEvent
& event
)
565 // if we're using constraints - do use them
566 #if wxUSE_CONSTRAINTS
567 if ( GetAutoLayout() )
574 // do we have _exactly_ one child?
575 wxWindow
*child
= NULL
;
576 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
578 node
= node
->GetNext() )
580 wxWindow
*win
= node
->GetData();
581 if ( !win
->IsTopLevel()
583 && (win
!= GetStatusBar())
584 #endif // wxUSE_STATUSBAR
586 && (win
!= GetToolBar())
587 #endif // wxUSE_TOOLBAR
591 return; // it's our second subwindow - nothing to do
597 // we have exactly one child - set it's size to fill the whole frame
598 int clientW
, clientH
;
599 GetClientSize(&clientW
, &clientH
);
604 child
->SetSize(x
, y
, clientW
, clientH
);
608 // Default activation behaviour - set the focus for the first child
610 void wxFrame::OnActivate(wxActivateEvent
& event
)
612 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
614 node
= node
->GetNext() )
616 // FIXME all this is totally bogus - we need to do the same as wxPanel,
617 // but how to do it without duplicating the code?
620 wxWindow
*child
= node
->GetData();
622 if ( !child
->IsTopLevel()
624 && !wxDynamicCast(child
, wxToolBar
)
625 #endif // wxUSE_TOOLBAR
627 && !wxDynamicCast(child
, wxStatusBar
)
628 #endif // wxUSE_STATUSBAR
637 // The default implementation for the close window event.
638 void wxFrame::OnCloseWindow(wxCloseEvent
& event
)
643 // Destroy the window (delayed, if a managed window)
644 bool wxFrame::Destroy()
646 if (!wxPendingDelete
.Member(this))
647 wxPendingDelete
.Append(this);
651 // Default menu selection behaviour - display a help string
652 void wxFrame::OnMenuHighlight(wxMenuEvent
& event
)
656 int menuId
= event
.GetMenuId();
659 wxMenuBar
*menuBar
= GetMenuBar();
660 if (menuBar
&& menuBar
->FindItem(menuId
))
662 // set status text even if the string is empty - this will at
663 // least remove the string from the item which was previously
665 SetStatusText(menuBar
->GetHelpString(menuId
));
671 wxMenuBar
*wxFrame::GetMenuBar() const
673 return m_frameMenuBar
;
676 bool wxFrame::ProcessCommand(int id
)
678 wxMenuBar
*bar
= GetMenuBar() ;
682 wxMenuItem
*item
= bar
->FindItemForId(id
);
686 if ( item
->IsCheckable() )
688 bar
->Check(id
, !bar
->IsChecked(id
)) ;
691 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, id
);
692 commandEvent
.SetInt( id
);
693 commandEvent
.SetEventObject( this );
695 return GetEventHandler()->ProcessEvent(commandEvent
);
698 // Checks if there is a toolbar, and returns the first free client position
699 wxPoint
wxFrame::GetClientAreaOrigin() const
705 GetToolBar()->GetSize(& w
, & h
);
707 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
719 void wxFrame::ScreenToClient(int *x
, int *y
) const
721 wxWindow::ScreenToClient(x
, y
);
723 // We may be faking the client origin.
724 // So a window that's really at (0, 30) may appear
725 // (to wxWin apps) to be at (0, 0).
726 wxPoint
pt(GetClientAreaOrigin());
731 void wxFrame::ClientToScreen(int *x
, int *y
) const
733 // We may be faking the client origin.
734 // So a window that's really at (0, 30) may appear
735 // (to wxWin apps) to be at (0, 0).
736 wxPoint
pt1(GetClientAreaOrigin());
740 wxWindow::ClientToScreen(x
, y
);
744 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
746 wxCHECK_MSG( m_frameToolBar
== NULL
, FALSE
,
747 _T("recreating toolbar in wxFrame") );
749 wxToolBar
* toolBar
= OnCreateToolBar(style
, id
, name
);
762 wxToolBar
* wxFrame::OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
764 return new wxToolBar(this, id
, wxDefaultPosition
, wxDefaultSize
, style
, name
);
767 void wxFrame::PositionToolBar()
770 ::GetClientRect(GetHwnd(), &rect
);
772 if ( GetStatusBar() )
774 int statusX
, statusY
;
775 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
776 rect
.bottom
-= statusY
;
782 GetToolBar()->GetSize(& tw
, & th
);
784 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
786 // Use the 'real' MSW position
787 GetToolBar()->SetSize(0, 0, tw
, rect
.bottom
, wxSIZE_NO_ADJUSTMENTS
);
791 // Use the 'real' MSW position
792 GetToolBar()->SetSize(0, 0, rect
.right
, th
, wxSIZE_NO_ADJUSTMENTS
);
796 #endif // wxUSE_TOOLBAR
798 // propagate our state change to all child frames: this allows us to emulate X
799 // Windows behaviour where child frames float independently of the parent one
800 // on the desktop, but are iconized/restored with it
801 void wxFrame::IconizeChildFrames(bool bIconize
)
803 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
805 node
= node
->GetNext() )
807 wxWindow
*win
= node
->GetData();
809 if ( win
->IsKindOf(CLASSINFO(wxFrame
)) )
811 ((wxFrame
*)win
)->Iconize(bIconize
);
817 // make the window modal (all other windows unresponsive)
818 void wxFrame::MakeModal(bool modal
)
821 wxEnableTopLevelWindows(FALSE
);
822 Enable(TRUE
); // keep this window enabled
825 wxEnableTopLevelWindows(TRUE
);
830 // ===========================================================================
831 // message processing
832 // ===========================================================================
834 // ---------------------------------------------------------------------------
836 // ---------------------------------------------------------------------------
838 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
840 if ( wxWindow::MSWTranslateMessage(pMsg
) )
843 // try the menu bar accels
844 wxMenuBar
*menuBar
= GetMenuBar();
848 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
849 return acceleratorTable
.Ok() &&
850 ::TranslateAccelerator(GetHwnd(),
851 GetTableHaccel(acceleratorTable
),
855 // ---------------------------------------------------------------------------
856 // our private (non virtual) message handlers
857 // ---------------------------------------------------------------------------
859 bool wxFrame::HandlePaint()
862 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
866 HICON hIcon
= m_icon
.Ok() ? GetIconHicon(m_icon
)
867 : (HICON
)m_defaultIcon
;
869 // Hold a pointer to the dc so long as the OnPaint() message
870 // is being processed
872 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
874 // Erase background before painting or we get white background
875 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
880 ::GetClientRect(GetHwnd(), &rect
);
882 // FIXME: why hardcoded?
883 static const int icon_width
= 32;
884 static const int icon_height
= 32;
886 int icon_x
= (int)((rect
.right
- icon_width
)/2);
887 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
889 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
892 ::EndPaint(GetHwnd(), &ps
);
898 wxPaintEvent
event(m_windowId
);
899 event
.m_eventObject
= this;
901 return GetEventHandler()->ProcessEvent(event
);
906 // nothing to paint - processed
911 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
913 bool processed
= FALSE
;
918 // only do it it if we were iconized before, otherwise resizing the
919 // parent frame has a curious side effect of bringing it under it's
924 // restore all child frames too
925 IconizeChildFrames(FALSE
);
934 // iconize all child frames too
935 IconizeChildFrames(TRUE
);
943 // forward WM_SIZE to status bar control
944 #if wxUSE_NATIVE_STATUSBAR
945 if (m_frameStatusBar
&& m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
)))
947 wxSizeEvent
event(wxSize(x
, y
), m_frameStatusBar
->GetId());
948 event
.SetEventObject( m_frameStatusBar
);
950 ((wxStatusBar95
*)m_frameStatusBar
)->OnSize(event
);
952 #endif // wxUSE_NATIVE_STATUSBAR
957 wxSizeEvent
event(wxSize(x
, y
), m_windowId
);
958 event
.SetEventObject( this );
959 processed
= GetEventHandler()->ProcessEvent(event
);
965 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
969 // In case it's e.g. a toolbar.
970 wxWindow
*win
= wxFindWinFromHandle(control
);
972 return win
->MSWCommand(cmd
, id
);
975 // handle here commands from menus and accelerators
976 if ( cmd
== 0 || cmd
== 1 )
978 if ( wxCurrentPopupMenu
)
980 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
981 wxCurrentPopupMenu
= NULL
;
983 return popupMenu
->MSWCommand(cmd
, id
);
986 if ( ProcessCommand(id
) )
995 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
)
998 if ( nFlags
== 0xFFFF && hMenu
== 0 )
1000 // FIXME: what does this do? does it ever happen?
1003 else if ((nFlags
!= MF_SEPARATOR
) && (nItem
!= 0) && (nItem
!= 65535))
1012 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
1013 event
.SetEventObject( this );
1015 return GetEventHandler()->ProcessEvent(event
);
1018 // ---------------------------------------------------------------------------
1019 // the window proc for wxFrame
1020 // ---------------------------------------------------------------------------
1022 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
1025 bool processed
= FALSE
;
1030 // if we can't close, tell the system that we processed the
1031 // message - otherwise it would close us
1032 processed
= !Close();
1039 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
1042 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
1050 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
1052 processed
= HandleMenuSelect(item
, flags
, hmenu
);
1057 processed
= HandlePaint();
1060 case WM_QUERYDRAGICON
:
1062 HICON hIcon
= m_icon
.Ok() ? GetIconHicon(m_icon
)
1063 : (HICON
)(m_defaultIcon
);
1065 processed
= rc
!= 0;
1070 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
1075 rc
= wxWindow::MSWWindowProc(message
, wParam
, lParam
);