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 wxWindow::DoSetSize(x
, y
, width
, height
, sizeFlags
);
246 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
247 event
.SetEventObject( this );
248 GetEventHandler()->ProcessEvent(event
);
251 bool wxFrame::Show(bool show
)
261 // Try to highlight the correct window (the parent)
265 hWndParent
= (HWND
) GetParent()->GetHWND();
267 ::BringWindowToTop(hWndParent
);
271 ShowWindow(GetHwnd(), (BOOL
)cshow
);
274 BringWindowToTop(GetHwnd());
276 wxActivateEvent
event(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
277 event
.SetEventObject( this );
278 GetEventHandler()->ProcessEvent(event
);
283 void wxFrame::Iconize(bool iconize
)
293 ShowWindow(GetHwnd(), (BOOL
)cshow
);
294 m_iconized
= iconize
;
297 // Equivalent to maximize/restore in Windows
298 void wxFrame::Maximize(bool maximize
)
306 ShowWindow(GetHwnd(), cshow
);
310 bool wxFrame::IsIconized() const
312 ((wxFrame
*)this)->m_iconized
= (::IsIconic(GetHwnd()) != 0);
317 bool wxFrame::IsMaximized() const
319 return (::IsZoomed(GetHwnd()) != 0) ;
322 void wxFrame::SetIcon(const wxIcon
& icon
)
325 #if defined(__WIN95__)
327 SendMessage(GetHwnd(), WM_SETICON
,
328 (WPARAM
)TRUE
, (LPARAM
)(HICON
) m_icon
.GetHICON());
333 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
, long style
, wxWindowID id
,
334 const wxString
& name
)
336 wxStatusBar
*statusBar
= NULL
;
338 #if wxUSE_NATIVE_STATUSBAR
339 if (UsesNativeStatusBar())
341 statusBar
= new wxStatusBar95(this, id
, style
);
346 statusBar
= new wxStatusBar(this, id
, wxPoint(0, 0), wxSize(100, 20),
349 // Set the height according to the font and the border size
350 wxClientDC
dc(statusBar
);
351 dc
.SetFont(statusBar
->GetFont());
354 dc
.GetTextExtent("X", &x
, &y
);
356 int height
= (int)( (y
* 1.1) + 2* statusBar
->GetBorderY());
358 statusBar
->SetSize(-1, -1, 100, height
);
361 statusBar
->SetFieldsCount(number
);
365 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
, wxWindowID id
,
366 const wxString
& name
)
368 // VZ: calling CreateStatusBar twice is an error - why anyone would do it?
369 wxCHECK_MSG( m_frameStatusBar
== NULL
, FALSE
,
370 _T("recreating status bar in wxFrame") );
372 m_frameStatusBar
= OnCreateStatusBar(number
, style
, id
,
374 if ( m_frameStatusBar
)
377 return m_frameStatusBar
;
383 void wxFrame::SetStatusText(const wxString
& text
, int number
)
385 wxCHECK_RET( m_frameStatusBar
!= NULL
, _T("no statusbar to set text for") );
387 m_frameStatusBar
->SetStatusText(text
, number
);
390 void wxFrame::SetStatusWidths(int n
, const int widths_field
[])
392 wxCHECK_RET( m_frameStatusBar
!= NULL
, _T("no statusbar to set widths for") );
394 m_frameStatusBar
->SetStatusWidths(n
, widths_field
);
398 void wxFrame::PositionStatusBar()
400 // native status bar positions itself
402 #if wxUSE_NATIVE_STATUSBAR
403 && !m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
))
408 GetClientSize(&w
, &h
);
410 m_frameStatusBar
->GetSize(&sw
, &sh
);
412 // Since we wish the status bar to be directly under the client area,
413 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
414 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
417 #endif // wxUSE_STATUSBAR
419 void wxFrame::SetMenuBar(wxMenuBar
*menu_bar
)
423 m_frameMenuBar
= NULL
;
427 wxCHECK_RET( !menu_bar
->GetFrame(), _T("this menubar is already attached") );
430 delete m_frameMenuBar
;
432 m_hMenu
= menu_bar
->Create();
437 InternalSetMenuBar();
439 m_frameMenuBar
= menu_bar
;
440 menu_bar
->Attach(this);
443 void wxFrame::InternalSetMenuBar()
445 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
447 wxLogLastError("SetMenu");
451 // Responds to colour changes, and passes event on to children.
452 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
454 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
457 if ( m_frameStatusBar
)
459 wxSysColourChangedEvent event2
;
460 event2
.SetEventObject( m_frameStatusBar
);
461 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
464 // Propagate the event to the non-top-level children
465 wxWindow::OnSysColourChanged(event
);
473 bool wxFrame::MSWCreate(int id
, wxWindow
*parent
, const wxChar
*wclass
, wxWindow
*wx_win
, const wxChar
*title
,
474 int x
, int y
, int width
, int height
, long style
)
477 m_defaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
479 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
480 // could be the culprit. But without it, you can get a lot of flicker.
483 if ((style
& wxCAPTION
) == wxCAPTION
)
484 msflags
= WS_OVERLAPPED
;
488 if (style
& wxMINIMIZE_BOX
)
489 msflags
|= WS_MINIMIZEBOX
;
490 if (style
& wxMAXIMIZE_BOX
)
491 msflags
|= WS_MAXIMIZEBOX
;
492 if (style
& wxTHICK_FRAME
)
493 msflags
|= WS_THICKFRAME
;
494 if (style
& wxSYSTEM_MENU
)
495 msflags
|= WS_SYSMENU
;
496 if ((style
& wxMINIMIZE
) || (style
& wxICONIZE
))
497 msflags
|= WS_MINIMIZE
;
498 if (style
& wxMAXIMIZE
)
499 msflags
|= WS_MAXIMIZE
;
500 if (style
& wxCAPTION
)
501 msflags
|= WS_CAPTION
;
502 if (style
& wxCLIP_CHILDREN
)
503 msflags
|= WS_CLIPCHILDREN
;
505 // Keep this in wxFrame because it saves recoding this function
508 if (style
& wxTINY_CAPTION_VERT
)
509 msflags
|= IBS_VERTCAPTION
;
510 if (style
& wxTINY_CAPTION_HORIZ
)
511 msflags
|= IBS_HORZCAPTION
;
513 if (style
& wxTINY_CAPTION_VERT
)
514 msflags
|= WS_CAPTION
;
515 if (style
& wxTINY_CAPTION_HORIZ
)
516 msflags
|= WS_CAPTION
;
518 if ((style
& wxTHICK_FRAME
) == 0)
519 msflags
|= WS_BORDER
;
521 WXDWORD extendedStyle
= MakeExtendedStyle(style
);
523 #if !defined(__WIN16__) && !defined(__SC__)
524 if (style
& wxFRAME_TOOL_WINDOW
)
525 extendedStyle
|= WS_EX_TOOLWINDOW
;
528 if (style
& wxSTAY_ON_TOP
)
529 extendedStyle
|= WS_EX_TOPMOST
;
532 if ( !wxWindow::MSWCreate(id
, parent
, wclass
, wx_win
, title
, x
, y
, width
, height
,
533 msflags
, NULL
, extendedStyle
) )
536 // Seems to be necessary if we use WS_POPUP
537 // style instead of WS_OVERLAPPED
538 if (width
> -1 && height
> -1)
539 ::PostMessage(GetHwnd(), WM_SIZE
, SIZE_RESTORED
, MAKELPARAM(width
, height
));
544 // Default resizing behaviour - if only ONE subwindow, resize to client
546 void wxFrame::OnSize(wxSizeEvent
& event
)
548 // if we're using constraints - do use them
549 #if wxUSE_CONSTRAINTS
550 if ( GetAutoLayout() )
557 // do we have _exactly_ one child?
558 wxWindow
*child
= NULL
;
559 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
561 node
= node
->GetNext() )
563 wxWindow
*win
= node
->GetData();
564 if ( !win
->IsTopLevel()
566 && (win
!= GetStatusBar())
567 #endif // wxUSE_STATUSBAR
569 && (win
!= GetToolBar())
570 #endif // wxUSE_TOOLBAR
574 return; // it's our second subwindow - nothing to do
580 // we have exactly one child - set it's size to fill the whole frame
581 int clientW
, clientH
;
582 GetClientSize(&clientW
, &clientH
);
587 child
->SetSize(x
, y
, clientW
, clientH
);
591 // Default activation behaviour - set the focus for the first child
593 void wxFrame::OnActivate(wxActivateEvent
& event
)
595 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
597 node
= node
->GetNext() )
599 // FIXME all this is totally bogus - we need to do the same as wxPanel,
600 // but how to do it without duplicating the code?
603 wxWindow
*child
= node
->GetData();
605 if ( !child
->IsTopLevel()
607 && !wxDynamicCast(child
, wxToolBar
)
608 #endif // wxUSE_TOOLBAR
610 && !wxDynamicCast(child
, wxStatusBar
)
611 #endif // wxUSE_STATUSBAR
620 // The default implementation for the close window event.
621 void wxFrame::OnCloseWindow(wxCloseEvent
& event
)
626 // Destroy the window (delayed, if a managed window)
627 bool wxFrame::Destroy()
629 if (!wxPendingDelete
.Member(this))
630 wxPendingDelete
.Append(this);
634 // Default menu selection behaviour - display a help string
635 void wxFrame::OnMenuHighlight(wxMenuEvent
& event
)
640 int menuId
= event
.GetMenuId();
643 wxMenuBar
*menuBar
= GetMenuBar();
644 if (menuBar
&& menuBar
->FindItem(menuId
))
646 help
= menuBar
->GetHelpString(menuId
);
650 // set status text even if the string is empty - this will at
651 // least remove the string from the item which was previously
657 wxMenuBar
*wxFrame::GetMenuBar() const
659 return m_frameMenuBar
;
662 bool wxFrame::ProcessCommand(int id
)
664 wxMenuBar
*bar
= GetMenuBar() ;
668 wxMenuItem
*item
= bar
->FindItemForId(id
);
672 if ( item
->IsCheckable() )
674 bar
->Check(id
, !bar
->IsChecked(id
)) ;
677 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, id
);
678 commandEvent
.SetInt( id
);
679 commandEvent
.SetEventObject( this );
681 return GetEventHandler()->ProcessEvent(commandEvent
);
684 // Checks if there is a toolbar, and returns the first free client position
685 wxPoint
wxFrame::GetClientAreaOrigin() const
691 GetToolBar()->GetSize(& w
, & h
);
693 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
705 void wxFrame::ScreenToClient(int *x
, int *y
) const
707 wxWindow::ScreenToClient(x
, y
);
709 // We may be faking the client origin.
710 // So a window that's really at (0, 30) may appear
711 // (to wxWin apps) to be at (0, 0).
712 wxPoint
pt(GetClientAreaOrigin());
717 void wxFrame::ClientToScreen(int *x
, int *y
) const
719 // We may be faking the client origin.
720 // So a window that's really at (0, 30) may appear
721 // (to wxWin apps) to be at (0, 0).
722 wxPoint
pt1(GetClientAreaOrigin());
726 wxWindow::ClientToScreen(x
, y
);
730 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
732 wxCHECK_MSG( m_frameToolBar
== NULL
, FALSE
,
733 _T("recreating toolbar in wxFrame") );
735 wxToolBar
* toolBar
= OnCreateToolBar(style
, id
, name
);
748 wxToolBar
* wxFrame::OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
750 return new wxToolBar(this, id
, wxDefaultPosition
, wxDefaultSize
, style
, name
);
753 void wxFrame::PositionToolBar()
756 ::GetClientRect(GetHwnd(), &rect
);
758 if ( GetStatusBar() )
760 int statusX
, statusY
;
761 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
762 rect
.bottom
-= statusY
;
768 GetToolBar()->GetSize(& tw
, & th
);
770 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
772 // Use the 'real' MSW position
773 GetToolBar()->SetSize(0, 0, tw
, rect
.bottom
, wxSIZE_NO_ADJUSTMENTS
);
777 // Use the 'real' MSW position
778 GetToolBar()->SetSize(0, 0, rect
.right
, th
, wxSIZE_NO_ADJUSTMENTS
);
782 #endif // wxUSE_TOOLBAR
784 // propagate our state change to all child frames: this allows us to emulate X
785 // Windows behaviour where child frames float independently of the parent one
786 // on the desktop, but are iconized/restored with it
787 void wxFrame::IconizeChildFrames(bool bIconize
)
789 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
791 node
= node
->GetNext() )
793 wxWindow
*win
= node
->GetData();
795 if ( win
->IsKindOf(CLASSINFO(wxFrame
)) )
797 ((wxFrame
*)win
)->Iconize(bIconize
);
803 // make the window modal (all other windows unresponsive)
804 void wxFrame::MakeModal(bool modal
)
807 wxEnableTopLevelWindows(FALSE
);
808 Enable(TRUE
); // keep this window enabled
811 wxEnableTopLevelWindows(TRUE
);
816 // ===========================================================================
817 // message processing
818 // ===========================================================================
820 // ---------------------------------------------------------------------------
822 // ---------------------------------------------------------------------------
824 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
826 if ( wxWindow::MSWTranslateMessage(pMsg
) )
829 // try the menu bar accels
830 wxMenuBar
*menuBar
= GetMenuBar();
834 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
835 return acceleratorTable
.Translate(this, pMsg
);
838 // ---------------------------------------------------------------------------
839 // our private (non virtual) message handlers
840 // ---------------------------------------------------------------------------
842 bool wxFrame::HandlePaint()
845 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
849 HICON hIcon
= m_icon
.Ok() ? GetHiconOf(m_icon
)
850 : (HICON
)m_defaultIcon
;
852 // Hold a pointer to the dc so long as the OnPaint() message
853 // is being processed
855 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
857 // Erase background before painting or we get white background
858 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
863 ::GetClientRect(GetHwnd(), &rect
);
865 // FIXME: why hardcoded?
866 static const int icon_width
= 32;
867 static const int icon_height
= 32;
869 int icon_x
= (int)((rect
.right
- icon_width
)/2);
870 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
872 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
875 ::EndPaint(GetHwnd(), &ps
);
881 return wxWindow::HandlePaint();
886 // nothing to paint - processed
891 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
893 bool processed
= FALSE
;
898 // only do it it if we were iconized before, otherwise resizing the
899 // parent frame has a curious side effect of bringing it under it's
904 // restore all child frames too
905 IconizeChildFrames(FALSE
);
914 // iconize all child frames too
915 IconizeChildFrames(TRUE
);
923 // forward WM_SIZE to status bar control
924 #if wxUSE_NATIVE_STATUSBAR
925 if (m_frameStatusBar
&& m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
)))
927 wxSizeEvent
event(wxSize(x
, y
), m_frameStatusBar
->GetId());
928 event
.SetEventObject( m_frameStatusBar
);
930 ((wxStatusBar95
*)m_frameStatusBar
)->OnSize(event
);
932 #endif // wxUSE_NATIVE_STATUSBAR
937 wxSizeEvent
event(wxSize(x
, y
), m_windowId
);
938 event
.SetEventObject( this );
939 processed
= GetEventHandler()->ProcessEvent(event
);
945 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
949 // In case it's e.g. a toolbar.
950 wxWindow
*win
= wxFindWinFromHandle(control
);
952 return win
->MSWCommand(cmd
, id
);
955 // handle here commands from menus and accelerators
956 if ( cmd
== 0 || cmd
== 1 )
958 if ( wxCurrentPopupMenu
)
960 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
961 wxCurrentPopupMenu
= NULL
;
963 return popupMenu
->MSWCommand(cmd
, id
);
966 if ( ProcessCommand(id
) )
975 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU hMenu
)
978 if ( flags
== 0xFFFF && hMenu
== 0 )
980 // menu was removed from screen
983 else if ( !(flags
& MF_POPUP
) && !(flags
& MF_SEPARATOR
) )
989 // don't give hints for separators (doesn't make sense) nor for the
990 // items opening popup menus (they don't have them anyhow)
994 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
995 event
.SetEventObject( this );
997 return GetEventHandler()->ProcessEvent(event
);
1000 // ---------------------------------------------------------------------------
1001 // the window proc for wxFrame
1002 // ---------------------------------------------------------------------------
1004 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
1007 bool processed
= FALSE
;
1012 // if we can't close, tell the system that we processed the
1013 // message - otherwise it would close us
1014 processed
= !Close();
1021 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
1024 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
1032 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
1034 processed
= HandleMenuSelect(item
, flags
, hmenu
);
1039 processed
= HandlePaint();
1042 case WM_QUERYDRAGICON
:
1044 HICON hIcon
= m_icon
.Ok() ? GetHiconOf(m_icon
)
1045 : (HICON
)(m_defaultIcon
);
1047 processed
= rc
!= 0;
1052 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
1057 rc
= wxWindow::MSWWindowProc(message
, wParam
, lParam
);