From: Vadim Zeitlin Date: Tue, 23 Nov 2004 12:53:34 +0000 (+0000) Subject: don't show the status bar after restoring normal view after full screen if it had... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b01a88e05073b9a86c406d368be8ebb340ba9215 don't show the status bar after restoring normal view after full screen if it had been hidden all along (bug 1071354); code cleanup: removed unused variables, reduced #ifdefs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 17fae5715a..7decd43e5c 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -142,11 +142,6 @@ protected: static bool m_useNativeStatusBar; #endif // wxUSE_STATUSBAR - // Data to save/restore when calling ShowFullScreen - int m_fsStatusBarFields; // 0 for no status bar - int m_fsStatusBarHeight; - int m_fsToolBarHeight; - private: #if wxUSE_TOOLTIPS WXHWND m_hwndToolTip; diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index edc5c5c22c..6a1c68a3ec 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -173,11 +173,6 @@ void wxFrame::Init() m_hwndToolTip = 0; #endif - // Data to save/restore when calling ShowFullScreen - m_fsStatusBarFields = 0; - m_fsStatusBarHeight = 0; - m_fsToolBarHeight = 0; - m_wasMinimized = false; } @@ -439,92 +434,75 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // Pass true to show full screen, false to restore. bool wxFrame::ShowFullScreen(bool show, long style) { + // TODO-CE: add support for CE +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if ( IsFullScreen() == show ) return false; if (show) { + // zap the toolbar, menubar, and statusbar if needed + // + // TODO: hide commandbar for WINCE_WITH_COMMANDBAR #if wxUSE_TOOLBAR - -#if defined(WINCE_WITH_COMMANDBAR) - // TODO: hide commandbar -#else wxToolBar *theToolBar = GetToolBar(); - if (theToolBar) - theToolBar->GetSize(NULL, &m_fsToolBarHeight); - - // zap the toolbar, menubar, and statusbar if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { - theToolBar->SetSize(wxDefaultCoord,0); - theToolBar->Show(false); + if ( theToolBar->IsShown() ) + { + theToolBar->SetSize(wxDefaultCoord,0); + theToolBar->Show(false); + } + else // prevent it from being restored later + { + style &= ~wxFULLSCREEN_NOTOOLBAR; + } } -#endif // __WXWINCE__ #endif // wxUSE_TOOLBAR -#if defined(__WXMICROWIN__) -#elif defined(__WXWINCE__) - // TODO: make it work for WinCE -#else if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); -#endif #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); - if (theStatusBar) - theStatusBar->GetSize(NULL, &m_fsStatusBarHeight); // Save the number of fields in the statusbar if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { - //m_fsStatusBarFields = theStatusBar->GetFieldsCount(); - //SetStatusBar((wxStatusBar*) NULL); - //delete theStatusBar; - theStatusBar->Show(false); + if ( theStatusBar->IsShown() ) + theStatusBar->Show(false); + else + style &= ~wxFULLSCREEN_NOSTATUSBAR; } - else - m_fsStatusBarFields = 0; #endif // wxUSE_STATUSBAR } - else + else // restore to normal { + // restore the toolbar, menubar, and statusbar if we had hid them #if wxUSE_TOOLBAR -#if defined(WINCE_WITHOUT_COMMANDBAR) - // TODO: show commandbar -#else wxToolBar *theToolBar = GetToolBar(); - // restore the toolbar, menubar, and statusbar - if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR)) + if ((m_fsStyle & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { - theToolBar->SetSize(wxDefaultCoord, m_fsToolBarHeight); theToolBar->Show(true); } -#endif // __WXWINCE__ #endif // wxUSE_TOOLBAR + if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && m_hMenu) + ::SetMenu(GetHwnd(), (HMENU)m_hMenu); + #if wxUSE_STATUSBAR - if ( m_fsStyle & wxFULLSCREEN_NOSTATUSBAR ) + wxStatusBar *theStatusBar = GetStatusBar(); + + if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { - //CreateStatusBar(m_fsStatusBarFields); - if (GetStatusBar()) - { - GetStatusBar()->Show(true); - PositionStatusBar(); - } + theStatusBar->Show(true); + PositionStatusBar(); } #endif // wxUSE_STATUSBAR - -#if defined(__WXMICROWIN__) -#elif defined(__WXWINCE__) - // TODO: make it work for WinCE -#else - if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) - SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); -#endif } +#endif // !defined(__WXMICROWIN__) && !defined(__WXWINCE__) return wxFrameBase::ShowFullScreen(show, style); }