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 char 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 wxTopLevelWindows
.Append(this);
93 m_windowStyle
= style
;
94 m_frameMenuBar
= NULL
;
95 m_frameToolBar
= NULL
;
96 m_frameStatusBar
= NULL
;
98 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
104 m_windowId
= (int)NewControlId();
106 if (parent
) parent
->AddChild(this);
115 // we pass NULL as parent to MSWCreate because frames with parents behave
116 // very strangely under Win95 shell
117 // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
119 if ((m_windowStyle
& wxFRAME_FLOAT_ON_PARENT
) == 0)
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());
349 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
, long style
, wxWindowID id
,
350 const wxString
& name
)
352 wxStatusBar
*statusBar
= NULL
;
354 #if wxUSE_NATIVE_STATUSBAR
355 if (UsesNativeStatusBar())
357 statusBar
= new wxStatusBar95(this, id
, style
);
362 statusBar
= new wxStatusBar(this, id
, wxPoint(0, 0), wxSize(100, 20),
365 // Set the height according to the font and the border size
366 wxClientDC
dc(statusBar
);
367 dc
.SetFont(statusBar
->GetFont());
370 dc
.GetTextExtent("X", &x
, &y
);
372 int height
= (int)( (y
* 1.1) + 2* statusBar
->GetBorderY());
374 statusBar
->SetSize(-1, -1, 100, height
);
377 statusBar
->SetFieldsCount(number
);
381 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
, wxWindowID id
,
382 const wxString
& name
)
384 // VZ: calling CreateStatusBar twice is an error - why anyone would do it?
385 wxCHECK_MSG( m_frameStatusBar
== NULL
, FALSE
,
386 "recreating status bar in wxFrame" );
388 m_frameStatusBar
= OnCreateStatusBar(number
, style
, id
,
390 if ( m_frameStatusBar
)
393 return m_frameStatusBar
;
399 void wxFrame::SetStatusText(const wxString
& text
, int number
)
401 wxCHECK_RET( m_frameStatusBar
!= NULL
, "no statusbar to set text for" );
403 m_frameStatusBar
->SetStatusText(text
, number
);
406 void wxFrame::SetStatusWidths(int n
, const int widths_field
[])
408 wxCHECK_RET( m_frameStatusBar
!= NULL
, "no statusbar to set widths for" );
410 m_frameStatusBar
->SetStatusWidths(n
, widths_field
);
414 void wxFrame::PositionStatusBar()
416 // native status bar positions itself
418 #if wxUSE_NATIVE_STATUSBAR
419 && !m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
))
424 GetClientSize(&w
, &h
);
426 m_frameStatusBar
->GetSize(&sw
, &sh
);
428 // Since we wish the status bar to be directly under the client area,
429 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
430 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
434 void wxFrame::SetMenuBar(wxMenuBar
*menu_bar
)
438 m_frameMenuBar
= NULL
;
442 wxCHECK_RET( !menu_bar
->GetFrame(), "this menubar is already attached" );
445 delete m_frameMenuBar
;
447 m_hMenu
= menu_bar
->Create();
452 InternalSetMenuBar();
454 m_frameMenuBar
= menu_bar
;
455 menu_bar
->Attach(this);
458 void wxFrame::InternalSetMenuBar()
460 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
462 wxLogLastError("SetMenu");
466 // Responds to colour changes, and passes event on to children.
467 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
469 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
472 if ( m_frameStatusBar
)
474 wxSysColourChangedEvent event2
;
475 event2
.SetEventObject( m_frameStatusBar
);
476 m_frameStatusBar
->GetEventHandler()->ProcessEvent(event2
);
479 // Propagate the event to the non-top-level children
480 wxWindow::OnSysColourChanged(event
);
488 bool wxFrame::MSWCreate(int id
, wxWindow
*parent
, const char *wclass
, wxWindow
*wx_win
, const char *title
,
489 int x
, int y
, int width
, int height
, long style
)
492 m_defaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
494 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
495 // could be the culprit. But without it, you can get a lot of flicker.
498 if ((style
& wxCAPTION
) == wxCAPTION
)
499 msflags
= WS_OVERLAPPED
;
503 if (style
& wxMINIMIZE_BOX
)
504 msflags
|= WS_MINIMIZEBOX
;
505 if (style
& wxMAXIMIZE_BOX
)
506 msflags
|= WS_MAXIMIZEBOX
;
507 if (style
& wxTHICK_FRAME
)
508 msflags
|= WS_THICKFRAME
;
509 if (style
& wxSYSTEM_MENU
)
510 msflags
|= WS_SYSMENU
;
511 if ((style
& wxMINIMIZE
) || (style
& wxICONIZE
))
512 msflags
|= WS_MINIMIZE
;
513 if (style
& wxMAXIMIZE
)
514 msflags
|= WS_MAXIMIZE
;
515 if (style
& wxCAPTION
)
516 msflags
|= WS_CAPTION
;
517 if (style
& wxCLIP_CHILDREN
)
518 msflags
|= WS_CLIPCHILDREN
;
520 // Keep this in wxFrame because it saves recoding this function
523 if (style
& wxTINY_CAPTION_VERT
)
524 msflags
|= IBS_VERTCAPTION
;
525 if (style
& wxTINY_CAPTION_HORIZ
)
526 msflags
|= IBS_HORZCAPTION
;
528 if (style
& wxTINY_CAPTION_VERT
)
529 msflags
|= WS_CAPTION
;
530 if (style
& wxTINY_CAPTION_HORIZ
)
531 msflags
|= WS_CAPTION
;
533 if ((style
& wxTHICK_FRAME
) == 0)
534 msflags
|= WS_BORDER
;
536 WXDWORD extendedStyle
= MakeExtendedStyle(style
);
538 #if !defined(__WIN16__) && !defined(__SC__)
539 if (style
& wxFRAME_TOOL_WINDOW
)
540 extendedStyle
|= WS_EX_TOOLWINDOW
;
543 if (style
& wxSTAY_ON_TOP
)
544 extendedStyle
|= WS_EX_TOPMOST
;
547 if ( !wxWindow::MSWCreate(id
, parent
, wclass
, wx_win
, title
, x
, y
, width
, height
,
548 msflags
, NULL
, extendedStyle
) )
551 // Seems to be necessary if we use WS_POPUP
552 // style instead of WS_OVERLAPPED
553 if (width
> -1 && height
> -1)
554 ::PostMessage(GetHwnd(), WM_SIZE
, SIZE_RESTORED
, MAKELPARAM(width
, height
));
559 // Default resizing behaviour - if only ONE subwindow, resize to client
561 void wxFrame::OnSize(wxSizeEvent
& event
)
563 // if we're using constraints - do use them
564 #if wxUSE_CONSTRAINTS
565 if ( GetAutoLayout() )
572 // do we have _exactly_ one child?
573 wxWindow
*child
= NULL
;
574 for ( wxNode
*node
= GetChildren().First(); node
; node
= node
->Next() )
576 wxWindow
*win
= (wxWindow
*)node
->Data();
577 if ( !win
->IsKindOf(CLASSINFO(wxFrame
)) &&
578 !win
->IsKindOf(CLASSINFO(wxDialog
)) &&
579 (win
!= GetStatusBar()) &&
580 (win
!= GetToolBar()) )
583 return; // it's our second subwindow - nothing to do
589 // we have exactly one child - set it's size to fill the whole frame
590 int clientW
, clientH
;
591 GetClientSize(&clientW
, &clientH
);
596 child
->SetSize(x
, y
, clientW
, clientH
);
600 // Default activation behaviour - set the focus for the first child
602 void wxFrame::OnActivate(wxActivateEvent
& event
)
604 for(wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
606 // Find a child that's a subwindow, but not a dialog box.
607 wxWindow
*child
= (wxWindow
*)node
->Data();
608 if (!child
->IsKindOf(CLASSINFO(wxFrame
)) &&
609 !child
->IsKindOf(CLASSINFO(wxDialog
)))
617 // The default implementation for the close window event.
618 void wxFrame::OnCloseWindow(wxCloseEvent
& event
)
623 // Destroy the window (delayed, if a managed window)
624 bool wxFrame::Destroy()
626 if (!wxPendingDelete
.Member(this))
627 wxPendingDelete
.Append(this);
631 // Default menu selection behaviour - display a help string
632 void wxFrame::OnMenuHighlight(wxMenuEvent
& event
)
636 int menuId
= event
.GetMenuId();
639 wxMenuBar
*menuBar
= GetMenuBar();
640 if (menuBar
&& menuBar
->FindItem(menuId
))
642 // set status text even if the string is empty - this will at
643 // least remove the string from the item which was previously
645 SetStatusText(menuBar
->GetHelpString(menuId
));
651 wxMenuBar
*wxFrame::GetMenuBar() const
653 return m_frameMenuBar
;
656 bool wxFrame::ProcessCommand(int id
)
658 wxMenuBar
*bar
= GetMenuBar() ;
662 wxMenuItem
*item
= bar
->FindItemForId(id
);
666 if ( item
->IsCheckable() )
668 bar
->Check(id
, !bar
->IsChecked(id
)) ;
671 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, id
);
672 commandEvent
.SetInt( id
);
673 commandEvent
.SetEventObject( this );
675 return GetEventHandler()->ProcessEvent(commandEvent
);
678 // Checks if there is a toolbar, and returns the first free client position
679 wxPoint
wxFrame::GetClientAreaOrigin() const
685 GetToolBar()->GetSize(& w
, & h
);
687 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
699 void wxFrame::ScreenToClient(int *x
, int *y
) const
701 wxWindow::ScreenToClient(x
, y
);
703 // We may be faking the client origin.
704 // So a window that's really at (0, 30) may appear
705 // (to wxWin apps) to be at (0, 0).
706 wxPoint
pt(GetClientAreaOrigin());
711 void wxFrame::ClientToScreen(int *x
, int *y
) const
713 // We may be faking the client origin.
714 // So a window that's really at (0, 30) may appear
715 // (to wxWin apps) to be at (0, 0).
716 wxPoint
pt1(GetClientAreaOrigin());
720 wxWindow::ClientToScreen(x
, y
);
723 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
725 wxCHECK_MSG( m_frameToolBar
== NULL
, FALSE
,
726 "recreating toolbar in wxFrame" );
728 wxToolBar
* toolBar
= OnCreateToolBar(style
, id
, name
);
741 wxToolBar
* wxFrame::OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
743 return new wxToolBar(this, id
, wxDefaultPosition
, wxDefaultSize
, style
, name
);
746 void wxFrame::PositionToolBar()
749 ::GetClientRect(GetHwnd(), &rect
);
751 if ( GetStatusBar() )
753 int statusX
, statusY
;
754 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
755 rect
.bottom
-= statusY
;
761 GetToolBar()->GetSize(& tw
, & th
);
763 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
765 // Use the 'real' MSW position
766 GetToolBar()->SetSize(0, 0, tw
, rect
.bottom
, wxSIZE_NO_ADJUSTMENTS
);
770 // Use the 'real' MSW position
771 GetToolBar()->SetSize(0, 0, rect
.right
, th
, wxSIZE_NO_ADJUSTMENTS
);
776 // propagate our state change to all child frames: this allows us to emulate X
777 // Windows behaviour where child frames float independently of the parent one
778 // on the desktop, but are iconized/restored with it
779 void wxFrame::IconizeChildFrames(bool bIconize
)
781 for ( wxWindowList::Node
*node
= GetChildren().GetFirst();
783 node
= node
->GetNext() )
785 wxWindow
*win
= node
->GetData();
787 if ( win
->IsKindOf(CLASSINFO(wxFrame
)) )
789 ((wxFrame
*)win
)->Iconize(bIconize
);
794 // ===========================================================================
795 // message processing
796 // ===========================================================================
798 // ---------------------------------------------------------------------------
800 // ---------------------------------------------------------------------------
802 bool wxFrame::MSWTranslateMessage(WXMSG
* pMsg
)
804 if ( wxWindow::MSWTranslateMessage(pMsg
) )
807 // try the menu bar accels
808 wxMenuBar
*menuBar
= GetMenuBar();
812 const wxAcceleratorTable
& acceleratorTable
= menuBar
->GetAccelTable();
813 return acceleratorTable
.Ok() &&
814 ::TranslateAccelerator(GetHwnd(),
815 GetTableHaccel(acceleratorTable
),
819 // ---------------------------------------------------------------------------
820 // our private (non virtual) message handlers
821 // ---------------------------------------------------------------------------
823 bool wxFrame::HandlePaint()
826 if ( GetUpdateRect(GetHwnd(), &rect
, FALSE
) )
830 HICON hIcon
= m_icon
.Ok() ? GetIconHicon(m_icon
)
831 : (HICON
)m_defaultIcon
;
833 // Hold a pointer to the dc so long as the OnPaint() message
834 // is being processed
836 HDC hdc
= ::BeginPaint(GetHwnd(), &ps
);
838 // Erase background before painting or we get white background
839 MSWDefWindowProc(WM_ICONERASEBKGND
, (WORD
)(LONG
)ps
.hdc
, 0L);
844 ::GetClientRect(GetHwnd(), &rect
);
846 // FIXME: why hardcoded?
847 static const int icon_width
= 32;
848 static const int icon_height
= 32;
850 int icon_x
= (int)((rect
.right
- icon_width
)/2);
851 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
853 ::DrawIcon(hdc
, icon_x
, icon_y
, hIcon
);
856 ::EndPaint(GetHwnd(), &ps
);
862 wxPaintEvent
event(m_windowId
);
863 event
.m_eventObject
= this;
865 return GetEventHandler()->ProcessEvent(event
);
870 // nothing to paint - processed
875 bool wxFrame::HandleSize(int x
, int y
, WXUINT id
)
877 bool processed
= FALSE
;
882 // only do it it if we were iconized before, otherwise resizing the
883 // parent frame has a curious side effect of bringing it under it's
888 // restore all child frames too
889 IconizeChildFrames(FALSE
);
898 // iconize all child frames too
899 IconizeChildFrames(TRUE
);
907 // forward WM_SIZE to status bar control
908 #if wxUSE_NATIVE_STATUSBAR
909 if (m_frameStatusBar
&& m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
)))
911 wxSizeEvent
event(wxSize(x
, y
), m_frameStatusBar
->GetId());
912 event
.SetEventObject( m_frameStatusBar
);
914 ((wxStatusBar95
*)m_frameStatusBar
)->OnSize(event
);
916 #endif // wxUSE_NATIVE_STATUSBAR
921 wxSizeEvent
event(wxSize(x
, y
), m_windowId
);
922 event
.SetEventObject( this );
923 processed
= GetEventHandler()->ProcessEvent(event
);
929 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
933 // In case it's e.g. a toolbar.
934 wxWindow
*win
= wxFindWinFromHandle(control
);
936 return win
->MSWCommand(cmd
, id
);
939 // handle here commands from menus and accelerators
940 if ( cmd
== 0 || cmd
== 1 )
942 if ( wxCurrentPopupMenu
)
944 wxMenu
*popupMenu
= wxCurrentPopupMenu
;
945 wxCurrentPopupMenu
= NULL
;
947 return popupMenu
->MSWCommand(cmd
, id
);
950 if ( ProcessCommand(id
) )
959 bool wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
)
962 if ( nFlags
== 0xFFFF && hMenu
== 0 )
964 // FIXME: what does this do? does it ever happen?
967 else if ((nFlags
!= MF_SEPARATOR
) && (nItem
!= 0) && (nItem
!= 65535))
976 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
977 event
.SetEventObject( this );
979 return GetEventHandler()->ProcessEvent(event
);
982 // ---------------------------------------------------------------------------
983 // the window proc for wxFrame
984 // ---------------------------------------------------------------------------
986 long wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
989 bool processed
= FALSE
;
994 // if we can't close, tell the system that we processed the
995 // message - otherwise it would close us
996 processed
= !Close();
1003 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
1006 processed
= HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
1014 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
1016 processed
= HandleMenuSelect(item
, flags
, hmenu
);
1021 processed
= HandlePaint();
1024 case WM_QUERYDRAGICON
:
1026 HICON hIcon
= m_icon
.Ok() ? GetIconHicon(m_icon
)
1027 : (HICON
)(m_defaultIcon
);
1029 processed
= rc
!= 0;
1034 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
1039 rc
= wxWindow::MSWWindowProc(message
, wParam
, lParam
);