1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
21 #include "wx/dialog.h"
22 #include "wx/settings.h"
23 #include "wx/dcclient.h"
26 #include "wx/os2/private.h"
29 #include "wx/statusbr.h"
30 #include "wx/generic/statusbr.h"
31 #endif // wxUSE_STATUSBAR
34 #include "wx/toolbar.h"
35 #endif // wxUSE_TOOLBAR
37 #include "wx/menuitem.h"
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 extern wxWindowList wxModelessWindows
;
45 extern wxList WXDLLEXPORT wxPendingDelete
;
46 extern wxChar wxFrameClassName
[];
47 extern wxMenu
*wxCurrentPopupMenu
;
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
54 EVT_ACTIVATE(wxFrame::OnActivate
)
55 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
58 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxWindow
)
60 // ============================================================================
62 // ============================================================================
64 // ----------------------------------------------------------------------------
65 // static class members
66 // ----------------------------------------------------------------------------
68 #if wxUSE_NATIVE_STATUSBAR
69 bool wxFrame::m_bUseNativeStatusBar
= TRUE
;
71 bool wxFrame::m_bUseNativeStatusBar
= FALSE
;
74 // ----------------------------------------------------------------------------
75 // creation/destruction
76 // ----------------------------------------------------------------------------
85 // Data to save/restore when calling ShowFullScreen
87 m_lFsOldWindowStyle
= 0L;
88 m_nFsStatusBarFields
= 0;
89 m_nFsStatusBarHeight
= 0;
90 m_nFsToolBarHeight
= 0;
91 m_bFsIsMaximized
= FALSE
;
92 m_bFsIsShowing
= FALSE
;
93 } // end of wxFrame::Init
98 , const wxString
& rsTitle
100 , const wxSize
& rSize
102 , const wxString
& rsName
107 int nWidth
= rSize
.x
;
108 int nHeight
= rSize
.y
;
111 m_windowStyle
= lulStyle
;
112 m_frameMenuBar
= NULL
;
113 m_frameToolBar
= NULL
;
114 m_frameStatusBar
= NULL
;
116 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
121 m_windowId
= (int)NewControlId();
124 pParent
->AddChild(this);
129 // We pass NULL as parent to MSWCreate because frames with parents behave
130 // very strangely under Win95 shell.
131 // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
132 // with this ulStyle.
134 if ((m_windowStyle
& wxFRAME_FLOAT_ON_PARENT
) == 0)
138 wxTopLevelWindows
.Append(this);
140 OS2Create( m_windowId
152 wxModelessWindows
.Append(this);
154 } // end of wxFrame::Create
158 m_isBeingDeleted
= TRUE
;
159 wxTopLevelWindows
.DeleteObject(this);
163 if (wxTheApp
&& (wxTopLevelWindows
.Number() == 0))
165 wxTheApp
->SetTopWindow(NULL
);
167 if (wxTheApp
->GetExitOnFrameDelete())
169 ::WinPostMsg(GetHwnd(), WM_QUIT
, 0, 0);
172 wxModelessWindows
.DeleteObject(this);
175 // For some reason, wxWindows can activate another task altogether
176 // when a frame is destroyed after a modal dialog has been invoked.
177 // Try to bring the parent to the top.
179 // MT:Only do this if this frame is currently the active window, else weird
180 // things start to happen.
182 if (wxGetActiveWindow() == this)
184 if (GetParent() && GetParent()->GetHWND())
186 ::WinSetWindowPos( (HWND
) GetParent()->GetHWND()
196 } // end of wxFrame::~wxFrame
199 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
201 void wxFrame::DoGetClientSize(
207 // OS/2 PM's coordinates go from bottom-left not
208 // top-left thus the += instead of the -=
214 // PM has no GetClientRect that inherantly knows about the client window
215 // We have to explicitly go fetch it!
217 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
218 ::WinQueryWindowRect(hWndClient
, &vRect
);
221 if ( GetStatusBar() )
226 GetStatusBar()->GetClientSize( &nStatusX
229 vRect
.yBottom
+= nStatusY
;
231 #endif // wxUSE_STATUSBAR
233 wxPoint
vPoint(GetClientAreaOrigin());
235 vRect
.yBottom
+= vPoint
.y
;
236 vRect
.xRight
-= vPoint
.x
;
242 } // end of wxFrame::DoGetClientSize
245 // Set the client size (i.e. leave the calculation of borders etc.
248 void wxFrame::DoSetClientSize(
253 HWND hWnd
= GetHwnd();
258 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
259 ::WinQueryWindowRect(hWndClient
, &vRect
);
261 ::WinQueryWindowRect(hWnd
, &vRect2
);
264 // Find the difference between the entire window (title bar and all)
265 // and the client area; add this to the new client size to move the
266 // window. Remember OS/2's backwards y coord system!
268 int nActualWidth
= vRect2
.xRight
- vRect2
.xLeft
- vRect
.xRight
+ nWidth
;
269 int nActualHeight
= vRect2
.yTop
+ vRect2
.yTop
- vRect
.yTop
+ nHeight
;
272 if ( GetStatusBar() )
277 GetStatusBar()->GetClientSize( &nStatusX
280 nActualHeight
+= nStatusY
;
282 #endif // wxUSE_STATUSBAR
284 wxPoint
vPoint(GetClientAreaOrigin());
285 nActualWidth
+= vPoint
.y
;
286 nActualHeight
+= vPoint
.x
;
290 vPointl
.x
= vRect2
.xLeft
;
291 vPoint
.y
= vRect2
.yTop
;
293 ::WinSetWindowPos( hWnd
299 ,SWP_MOVE
| SWP_SIZE
| SWP_SHOW
302 wxSizeEvent
vEvent( wxSize( nWidth
307 vEvent
.SetEventObject(this);
308 GetEventHandler()->ProcessEvent(vEvent
);
309 } // end of wxFrame::DoSetClientSize
311 void wxFrame::DoGetSize(
318 ::WinQueryWindowRect(GetHwnd(), &vRect
);
319 *pWidth
= vRect
.xRight
- vRect
.xLeft
;
320 *pHeight
= vRect
.yTop
- vRect
.yBottom
;
321 } // end of wxFrame::DoGetSize
323 void wxFrame::DoGetPosition(
331 ::WinQueryWindowRect(GetHwnd(), &vRect
);
332 vPoint
.x
= vRect
.xLeft
;
335 // OS/2 is backwards [WIN32 it is vRect.yTop]
337 vPoint
.y
= vRect
.yBottom
;
341 } // end of wxFrame::DoGetPosition
343 // ----------------------------------------------------------------------------
344 // variations around ::ShowWindow()
345 // ----------------------------------------------------------------------------
347 void wxFrame::DoShowWindow(
351 ::WinShowWindow(GetHwnd(), nShowCmd
);
352 m_bIconized
= nShowCmd
== SWP_MINIMIZE
;
353 } // end of wxFrame::DoShowWindow
359 DoShowWindow(bShow
? SWP_SHOW
: SWP_HIDE
);
363 wxActivateEvent
vEvent(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
365 ::WinSetWindowPos( (HWND
) GetHWND()
373 vEvent
.SetEventObject(this);
374 GetEventHandler()->ProcessEvent(vEvent
);
379 // Try to highlight the correct window (the parent)
383 HWND hWndParent
= GetHwndOf(GetParent());
386 ::WinSetWindowPos( hWndParent
397 } // end of wxFrame::Show
399 void wxFrame::Iconize(
403 DoShowWindow(bIconize
? SWP_MINIMIZE
: SWP_RESTORE
);
404 } // end of wxFrame::Iconize
406 void wxFrame::Maximize(
409 DoShowWindow(bMaximize
? SWP_MAXIMIZE
: SWP_RESTORE
);
410 } // end of wxFrame::Maximize
412 void wxFrame::Restore()
414 DoShowWindow(SWP_RESTORE
);
415 } // end of wxFrame::Restore
417 bool wxFrame::IsIconized() const
422 ::WinQueryWindowPos(GetHwnd(), &vSwp
);
424 if (vSwp
.fl
& SWP_MINIMIZE
)
425 ((wxFrame
*)this)->m_bIconized
= TRUE
;
427 ((wxFrame
*)this)->m_bIconized
= FALSE
;
429 } // end of wxFrame::IsIconized
432 bool wxFrame::IsMaximized() const
437 ::WinQueryWindowPos(GetHwnd(), &vSwp
);
438 return (vSwp
.fl
& SWP_MAXIMIZE
);
439 } // end of wxFrame::IsMaximized
441 void wxFrame::SetIcon(
445 wxFrameBase::SetIcon(rIcon
);
449 WinSendMsg( GetHwnd()
451 ,(MPARAM
)((HICON
)m_icon
.GetHICON())
455 } // end of wxFrame::SetIcon
458 wxStatusBar
* wxFrame::OnCreateStatusBar(
462 , const wxString
& rName
465 wxStatusBar
* pStatusBar
= NULL
;
467 pStatusBar
= wxFrameBase::OnCreateStatusBar( nNumber
473 } // end of wxFrame::OnCreateStatusBar
475 void wxFrame::PositionStatusBar()
478 // Native status bar positions itself
480 if (m_frameStatusBar
)
489 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
490 ::WinQueryWindowRect(hWndClient
, &vRect
);
491 nWidth
= vRect
.xRight
- vRect
.xLeft
;
492 nHeight
= vRect
.yTop
- vRect
.yBottom
;
494 m_frameStatusBar
->GetSize( &nStatbarWidth
499 // Since we wish the status bar to be directly under the client area,
500 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
502 m_frameStatusBar
->SetSize( 0
508 } // end of wxFrame::PositionStatusBar
509 #endif // wxUSE_STATUSBAR
511 void wxFrame::DetachMenuBar()
515 m_frameMenuBar
->Detach();
516 m_frameMenuBar
= NULL
;
518 } // end of wxFrame::DetachMenuBar
520 void wxFrame::SetMenuBar(
530 m_frameMenuBar
= NULL
;
532 // Can set a menubar several times.
533 // TODO: how to prevent a memory leak if you have a currently-unattached
534 // menubar? wxWindows assumes that the frame will delete the menu (otherwise
535 // there are problems for MDI).
536 if (pMenuBar
->GetHMenu())
538 m_hMenu
= pMenuBar
->GetHMenu();
544 m_hMenu
= pMenuBar
->Create();
550 InternalSetMenuBar();
552 m_frameMenuBar
= pMenuBar
;
553 pMenuBar
->Attach(this);
554 } // end of wxFrame::SetMenuBar
556 void wxFrame::InternalSetMenuBar()
559 ::WinPostMsg( GetHwnd()
564 } // end of wxFrame::InternalSetMenuBar
567 // Responds to colour changes, and passes event on to children
569 void wxFrame::OnSysColourChanged(
570 wxSysColourChangedEvent
& rEvent
573 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
576 if (m_frameStatusBar
)
578 wxSysColourChangedEvent vEvent2
;
580 vEvent2
.SetEventObject(m_frameStatusBar
);
581 m_frameStatusBar
->GetEventHandler()->ProcessEvent(vEvent2
);
585 // Propagate the event to the non-top-level children
587 wxWindow::OnSysColourChanged(rEvent
);
588 } // end of wxFrame::OnSysColourChanged
590 // Pass TRUE to show full screen, FALSE to restore.
591 bool wxFrame::ShowFullScreen(
603 m_fsIsShowing = TRUE;
606 wxToolBar *theToolBar = GetToolBar();
607 wxStatusBar *theStatusBar = GetStatusBar();
612 theToolBar->GetSize(&dummyWidth, &m_fsToolBarHeight);
614 theStatusBar->GetSize(&dummyWidth, &m_fsStatusBarHeight);
616 // zap the toolbar, menubar, and statusbar
618 if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
620 theToolBar->SetSize(-1,0);
621 theToolBar->Show(FALSE);
624 if (style & wxFULLSCREEN_NOMENUBAR)
625 SetMenu((HWND)GetHWND(), (HMENU) NULL);
627 // Save the number of fields in the statusbar
628 if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
630 m_fsStatusBarFields = theStatusBar->GetFieldsCount();
631 SetStatusBar((wxStatusBar*) NULL);
635 m_fsStatusBarFields = 0;
637 // zap the frame borders
639 // save the 'normal' window style
640 m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE);
642 // save the old position, width & height, maximize state
643 m_fsOldSize = GetRect();
644 m_fsIsMaximized = IsMaximized();
646 // decide which window style flags to turn off
647 LONG newStyle = m_fsOldWindowStyle;
650 if (style & wxFULLSCREEN_NOBORDER)
651 offFlags |= WS_BORDER;
652 if (style & wxFULLSCREEN_NOCAPTION)
653 offFlags |= (WS_CAPTION | WS_SYSMENU);
655 newStyle &= (~offFlags);
657 // change our window style to be compatible with full-screen mode
658 SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
660 // resize to the size of the desktop
664 ::GetWindowRect(GetDesktopWindow(), &rect);
665 width = rect.right - rect.left;
666 height = rect.bottom - rect.top;
668 SetSize(width, height);
670 // now flush the window style cache and actually go full-screen
671 SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
673 wxSizeEvent event(wxSize(width, height), GetId());
674 GetEventHandler()->ProcessEvent(event);
683 m_fsIsShowing = FALSE;
685 wxToolBar *theToolBar = GetToolBar();
687 // restore the toolbar, menubar, and statusbar
688 if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR))
690 theToolBar->SetSize(-1, m_fsToolBarHeight);
691 theToolBar->Show(TRUE);
694 if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_fsStatusBarFields > 0))
696 CreateStatusBar(m_fsStatusBarFields);
700 if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
701 SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
703 Maximize(m_fsIsMaximized);
704 SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle);
705 SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y,
706 m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED);
712 } // end of wxFrame::ShowFullScreen
717 bool wxFrame::OS2Create(
720 , const wxChar
* zWclass
722 , const wxChar
* zTitle
730 ULONG ulPmFlags
= 0L;
731 ULONG ulExtraFlags
= 0L;
732 ULONG ulTempFlags
= FCF_STANDARD
;
734 m_hDefaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
736 if (ulStyle
== wxDEFAULT_FRAME_STYLE
)
737 ulPmFlags
= FCF_STANDARD
;
740 if ((ulStyle
& wxCAPTION
) == wxCAPTION
)
741 ulPmFlags
= FCF_TASKLIST
;
743 ulPmFlags
= FCF_NOMOVEWITHOWNER
;
745 if (ulStyle
& wxMINIMIZE_BOX
)
746 ulPmFlags
|= FCF_MINBUTTON
;
747 if (ulStyle
& wxMAXIMIZE_BOX
)
748 ulPmFlags
|= FCF_MAXBUTTON
;
749 if (ulStyle
& wxTHICK_FRAME
)
750 ulPmFlags
|= FCF_DLGBORDER
;
751 if (ulStyle
& wxSYSTEM_MENU
)
752 ulPmFlags
|= FCF_SYSMENU
;
753 if ((ulStyle
& wxMINIMIZE
) || (ulStyle
& wxICONIZE
))
754 ulPmFlags
|= WS_MINIMIZED
;
755 if (ulStyle
& wxMAXIMIZE
)
756 ulPmFlags
|= WS_MAXIMIZED
;
757 if (ulStyle
& wxCAPTION
)
758 ulPmFlags
|= FCF_TASKLIST
;
759 if (ulStyle
& wxCLIP_CHILDREN
)
761 // Invalid for frame windows under PM
765 // Keep this in wxFrame because it saves recoding this function
769 if (ulStyle
& wxTINY_CAPTION_VERT
)
770 ulExtraFlags
|= kVertCaption
;
771 if (ulStyle
& wxTINY_CAPTION_HORIZ
)
772 ulExtraFlags
|= kHorzCaption
;
774 if (ulStyle
& wxTINY_CAPTION_VERT
)
775 ulPmFlags
|= FCF_TASKLIST
;
776 if (ulStyle
& wxTINY_CAPTION_HORIZ
)
777 ulPmFlags
|= FCF_TASKLIST
;
779 if ((ulStyle
& wxTHICK_FRAME
) == 0)
780 ulPmFlags
|= FCF_BORDER
;
781 if (ulStyle
& wxFRAME_TOOL_WINDOW
)
782 ulExtraFlags
= kFrameToolWindow
;
784 if (ulStyle
& wxSTAY_ON_TOP
)
785 ulPmFlags
|= FCF_SYSMODAL
;
788 // Clear the visible flag, we always call show
790 ulPmFlags
&= (unsigned long)~WS_VISIBLE
;
792 if ( !wxWindow::OS2Create( nId
808 } // end of wxFrame::OS2Create
811 // Default activation behaviour - set the focus for the first child
814 void wxFrame::OnActivate(
815 wxActivateEvent
& rEvent
818 for (wxWindowList::Node
* pNode
= GetChildren().GetFirst();
820 pNode
= pNode
->GetNext())
822 // FIXME all this is totally bogus - we need to do the same as wxPanel,
823 // but how to do it without duplicating the code?
826 wxWindow
* pChild
= pNode
->GetData();
828 if (!pChild
->IsTopLevel()
830 && !wxDynamicCast(pChild
, wxToolBar
)
831 #endif // wxUSE_TOOLBAR
833 && !wxDynamicCast(pChild
, wxStatusBar
)
834 #endif // wxUSE_STATUSBAR
841 } // end of wxFrame::OnActivate
843 // ----------------------------------------------------------------------------
844 // wxFrame size management: we exclude the areas taken by menu/status/toolbars
845 // from the client area, so the client area is what's really available for the
847 // ----------------------------------------------------------------------------
849 // Checks if there is a toolbar, and returns the first free client position
850 wxPoint
wxFrame::GetClientAreaOrigin() const
852 wxPoint
vPoint(0, 0);
859 GetToolBar()->GetSize( &nWidth
863 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
869 // PM is backwards from windows
874 } // end of wxFrame::GetClientAreaOrigin
876 // ----------------------------------------------------------------------------
877 // tool/status bar stuff
878 // ----------------------------------------------------------------------------
882 wxToolBar
* wxFrame::CreateToolBar(
885 , const wxString
& rName
888 if (wxFrameBase::CreateToolBar( lStyle
895 return m_frameToolBar
;
896 } // end of wxFrame::CreateToolBar
898 void wxFrame::PositionToolBar()
903 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
904 ::WinQueryWindowRect(hWndClient
, &vRect
);
912 GetStatusBar()->GetClientSize( &nStatusX
915 // PM is backwards from windows
916 vRect
.yBottom
+= nStatusY
;
918 #endif // wxUSE_STATUSBAR
925 GetToolBar()->GetSize( &nToolbarWidth
929 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
931 nToolbarHeight
= vRect
.yBottom
;
935 nToolbarWidth
= vRect
.xRight
;
939 // Use the 'real' PM position here
941 GetToolBar()->SetSize( 0
945 ,wxSIZE_NO_ADJUSTMENTS
948 } // end of wxFrame::PositionToolBar
949 #endif // wxUSE_TOOLBAR
951 // ----------------------------------------------------------------------------
952 // frame state (iconized/maximized/...)
953 // ----------------------------------------------------------------------------
956 // propagate our state change to all child frames: this allows us to emulate X
957 // Windows behaviour where child frames float independently of the parent one
958 // on the desktop, but are iconized/restored with it
960 void wxFrame::IconizeChildFrames(
964 for (wxWindowList::Node
* pNode
= GetChildren().GetFirst();
966 pNode
= pNode
->GetNext() )
968 wxWindow
* pWin
= pNode
->GetData();
970 if (pWin
->IsKindOf(CLASSINFO(wxFrame
)) )
972 ((wxFrame
*)pWin
)->Iconize(bIconize
);
975 } // end of wxFrame::IconizeChildFrames
977 // ===========================================================================
978 // message processing
979 // ===========================================================================
981 // ---------------------------------------------------------------------------
983 // ---------------------------------------------------------------------------
984 bool wxFrame::OS2TranslateMessage(
988 if (wxWindow::OS2TranslateMessage(pMsg
))
991 // try the menu bar accels
993 wxMenuBar
* pMenuBar
= GetMenuBar();
998 const wxAcceleratorTable
& rAcceleratorTable
= pMenuBar
->GetAccelTable();
999 return rAcceleratorTable
.Translate(this, pMsg
);
1000 } // end of wxFrame::OS2TranslateMessage
1002 // ---------------------------------------------------------------------------
1003 // our private (non virtual) message handlers
1004 // ---------------------------------------------------------------------------
1005 bool wxFrame::HandlePaint()
1009 if (::WinQueryUpdateRect(GetHwnd(), &vRect
))
1014 // Icons in PM are the same as "pointers"
1019 hIcon
= (HPOINTER
)::WinSendMsg(GetHwnd(), WM_QUERYICON
, 0L, 0L);
1021 hIcon
= (HPOINTER
)m_hDefaultIcon
;
1024 // Hold a pointer to the dc so long as the OnPaint() message
1025 // is being processed
1028 HPS hPs
= ::WinBeginPaint(GetHwnd(), NULLHANDLE
, &vRect2
);
1031 // Erase background before painting or we get white background
1033 OS2DefWindowProc(WM_ERASEBACKGROUND
, (MPARAM
)hPs
, (MPARAM
)&vRect2
);
1040 hWndClient
= ::WinWindowFromID(GetHwnd(), FID_CLIENT
);
1041 ::WinQueryWindowRect(hWndClient
, &vRect3
);
1043 static const int nIconWidth
= 32;
1044 static const int nIconHeight
= 32;
1045 int nIconX
= (int)((vRect3
.xRight
- nIconWidth
)/2);
1046 int nIconY
= (int)((vRect3
.yBottom
+ nIconHeight
)/2);
1048 ::WinDrawPointer(hPs
, nIconX
, nIconY
, hIcon
, DP_NORMAL
);
1055 return wxWindow::HandlePaint();
1060 // nothing to paint - processed
1064 } // end of wxFrame::HandlePaint
1066 bool wxFrame::HandleSize(
1072 bool bProcessed
= FALSE
;
1078 // Only do it it if we were iconized before, otherwise resizing the
1079 // parent frame has a curious side effect of bringing it under it's
1085 // restore all child frames too
1087 IconizeChildFrames(FALSE
);
1094 m_bIconized
= FALSE
;
1099 // Iconize all child frames too
1101 IconizeChildFrames(TRUE
);
1109 // forward WM_SIZE to status bar control
1111 #if wxUSE_NATIVE_STATUSBAR
1112 if (m_frameStatusBar
&& m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
)))
1114 wxSizeEvent
vEvent( wxSize( nX
1117 ,m_frameStatusBar
->GetId()
1120 vEvent
.SetEventObject(m_frameStatusBar
);
1121 m_frameStatusBar
->OnSize(vEvent
);
1123 #endif // wxUSE_NATIVE_STATUSBAR
1125 PositionStatusBar();
1127 wxSizeEvent
vEvent( wxSize( nX
1133 vEvent
.SetEventObject(this);
1134 bProcessed
= GetEventHandler()->ProcessEvent(vEvent
);
1137 } // end of wxFrame::HandleSize
1139 bool wxFrame::HandleCommand(
1148 // In case it's e.g. a toolbar.
1150 wxWindow
* pWin
= wxFindWinFromHandle(hControl
);
1153 return pWin
->OS2Command( nCmd
1159 // Handle here commands from menus and accelerators
1161 if (nCmd
== 0 || nCmd
== 1)
1163 if (wxCurrentPopupMenu
)
1165 wxMenu
* pPopupMenu
= wxCurrentPopupMenu
;
1167 wxCurrentPopupMenu
= NULL
;
1169 return pPopupMenu
->OS2Command( nCmd
1174 if (ProcessCommand(nId
))
1180 } // end of wxFrame::HandleCommand
1182 bool wxFrame::HandleMenuSelect(
1190 if (nFlags
== 0xFFFF && hMenu
== 0)
1193 // Menu was removed from screen
1197 else if (!(nFlags
& MIS_SUBMENU
) && !(nFlags
& MIS_SEPARATOR
))
1204 // Don't give hints for separators (doesn't make sense) nor for the
1205 // items opening popup menus (they don't have them anyhow)
1209 wxMenuEvent
vEvent(wxEVT_MENU_HIGHLIGHT
, nMenuItem
);
1211 vEvent
.SetEventObject(this);
1212 return GetEventHandler()->ProcessEvent(vEvent
);
1213 } // end of wxFrame::HandleMenuSelect
1215 // ---------------------------------------------------------------------------
1216 // the window proc for wxFrame
1217 // ---------------------------------------------------------------------------
1219 MRESULT
wxFrame::OS2WindowProc(
1226 bool bProcessed
= FALSE
;
1232 // If we can't close, tell the system that we processed the
1233 // message - otherwise it would close us
1235 bProcessed
= !Close();
1244 UnpackCommand( (WXWPARAM
)wParam
1250 bProcessed
= HandleCommand( wId
1263 UnpackMenuSelect( wParam
1269 bProcessed
= HandleMenuSelect( wItem
1277 bProcessed
= HandlePaint();
1280 case CM_QUERYDRAGIMAGE
:
1285 hIcon
= (HPOINTER
)::WinSendMsg(GetHwnd(), WM_QUERYICON
, 0L, 0L);
1287 hIcon
= (HPOINTER
)m_hDefaultIcon
;
1288 mRc
= (MRESULT
)hIcon
;
1289 bProcessed
= mRc
!= 0;
1294 bProcessed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), (WXUINT
)wParam
);
1299 mRc
= wxWindow::OS2WindowProc( uMessage
1304 } // wxFrame::OS2WindowProc