+// Pass TRUE to show full screen, FALSE to restore.
+bool wxFrame::ShowFullScreen(
+ bool bShow
+, long lStyle
+)
+{
+ if (bShow)
+ {
+ if (IsFullScreen())
+ return FALSE;
+
+ m_bFsIsShowing = TRUE;
+ m_lFsStyle = lStyle;
+
+#if wxUSE_TOOLBAR
+ wxToolBar* pTheToolBar = GetToolBar();
+#endif //wxUSE_TOOLBAR
+
+#if wxUSE_STATUSBAR
+ wxStatusBar* pTheStatusBar = GetStatusBar();
+#endif //wxUSE_STATUSBAR
+
+ int nDummyWidth;
+
+#if wxUSE_TOOLBAR
+ if (pTheToolBar)
+ pTheToolBar->GetSize(&nDummyWidth, &m_nFsToolBarHeight);
+#endif //wxUSE_TOOLBAR
+
+#if wxUSE_STATUSBAR
+ if (pTheStatusBar)
+ pTheStatusBar->GetSize(&nDummyWidth, &m_nFsStatusBarHeight);
+#endif //wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
+ //
+ // Zap the toolbar, menubar, and statusbar
+ //
+ if ((lStyle & wxFULLSCREEN_NOTOOLBAR) && pTheToolBar)
+ {
+ pTheToolBar->SetSize(-1,0);
+ pTheToolBar->Show(FALSE);
+ }
+#endif //wxUSE_TOOLBAR
+
+ if (lStyle & wxFULLSCREEN_NOMENUBAR)
+ {
+ ::WinSetParent(m_hMenu, m_hFrame, FALSE);
+ ::WinSetOwner(m_hMenu, m_hFrame);
+ ::WinSendMsg((HWND)m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
+ }
+
+#if wxUSE_STATUSBAR
+ //
+ // Save the number of fields in the statusbar
+ //
+ if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar)
+ {
+ m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount();
+ SetStatusBar((wxStatusBar*) NULL);
+ delete pTheStatusBar;
+ }
+ else
+ m_nFsStatusBarFields = 0;
+#endif //wxUSE_STATUSBAR
+
+ //
+ // Zap the frame borders
+ //
+
+ //
+ // Save the 'normal' window style
+ //
+ m_lFsOldWindowStyle = ::WinQueryWindowULong(m_hFrame, QWL_STYLE);
+
+ //
+ // Save the old position, width & height, maximize state
+ //
+ m_vFsOldSize = GetRect();
+ m_bFsIsMaximized = IsMaximized();
+
+ //
+ // Decide which window style flags to turn off
+ //
+ LONG lNewStyle = m_lFsOldWindowStyle;
+ LONG lOffFlags = 0;
+
+ if (lStyle & wxFULLSCREEN_NOBORDER)
+ lOffFlags |= FCF_BORDER;
+ if (lStyle & wxFULLSCREEN_NOCAPTION)
+ lOffFlags |= (FCF_TASKLIST | FCF_SYSMENU);
+
+ lNewStyle &= (~lOffFlags);
+
+ //
+ // Change our window style to be compatible with full-screen mode
+ //
+ ::WinSetWindowULong((HWND)m_hFrame, QWL_STYLE, (ULONG)lNewStyle);
+
+ //
+ // Resize to the size of the desktop
+ int nWidth;
+ int nHeight;
+
+ RECTL vRect;
+
+ ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
+ nWidth = vRect.xRight - vRect.xLeft;
+ //
+ // Rmember OS/2 is backwards!
+ //
+ nHeight = vRect.yTop - vRect.yBottom;
+
+ SetSize( nWidth
+ ,nHeight
+ );
+
+ //
+ // Now flush the window style cache and actually go full-screen
+ //
+ ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
+ ,HWND_TOP
+ ,0
+ ,0
+ ,nWidth
+ ,nHeight
+ ,SWP_SIZE | SWP_SHOW
+ );
+
+ wxSizeEvent vEvent( wxSize( nWidth
+ ,nHeight
+ )
+ ,GetId()
+ );
+
+ GetEventHandler()->ProcessEvent(vEvent);
+ return TRUE;
+ }
+ else
+ {
+ if (!IsFullScreen())
+ return FALSE;
+
+ m_bFsIsShowing = FALSE;
+
+#if wxUSE_TOOLBAR
+ wxToolBar* pTheToolBar = GetToolBar();
+
+ //
+ // Restore the toolbar, menubar, and statusbar
+ //
+ if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR))
+ {
+ pTheToolBar->SetSize(-1, m_nFsToolBarHeight);
+ pTheToolBar->Show(TRUE);
+ }
+#endif //wxUSE_TOOLBAR
+
+#if wxUSE_STATUSBAR
+ if ((m_lFsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_nFsStatusBarFields > 0))
+ {
+ CreateStatusBar(m_nFsStatusBarFields);
+// PositionStatusBar();
+ }
+#endif //wxUSE_STATUSBAR
+
+ if ((m_lFsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
+ {
+ ::WinSetParent(m_hMenu, m_hFrame, FALSE);
+ ::WinSetOwner(m_hMenu, m_hFrame);
+ ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
+ }
+ Maximize(m_bFsIsMaximized);
+
+ ::WinSetWindowULong( m_hFrame
+ ,QWL_STYLE
+ ,(ULONG)m_lFsOldWindowStyle
+ );
+ ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
+ ,HWND_TOP
+ ,m_vFsOldSize.x
+ ,m_vFsOldSize.y
+ ,m_vFsOldSize.width
+ ,m_vFsOldSize.height
+ ,SWP_SIZE | SWP_SHOW
+ );
+ return TRUE;
+ }
+} // end of wxFrame::ShowFullScreen
+