]> git.saurik.com Git - wxWidgets.git/commitdiff
decouple wxTLW,Frame::ShowFullScreen in wxMSW
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 14 Oct 2001 22:54:06 +0000 (22:54 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 14 Oct 2001 22:54:06 +0000 (22:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/frame.cpp
src/msw/toplevel.cpp

index fc5e2f5a53772070769eced4c0f850d18bf8f5d2..b6519a0f9566f2a1cf03d16fc01b782545ced62b 100644 (file)
@@ -109,14 +109,10 @@ void wxFrameMSW::Init()
 #endif
 
     // Data to save/restore when calling ShowFullScreen
 #endif
 
     // Data to save/restore when calling ShowFullScreen
-    m_fsStyle = 0;
-    m_fsOldWindowStyle = 0;
     m_fsStatusBarFields = 0;
     m_fsStatusBarHeight = 0;
     m_fsToolBarHeight = 0;
 //  m_fsMenu = 0;
     m_fsStatusBarFields = 0;
     m_fsStatusBarHeight = 0;
     m_fsToolBarHeight = 0;
 //  m_fsMenu = 0;
-    m_fsIsMaximized = FALSE;
-    m_fsIsShowing = FALSE;
 
     m_winLastFocused = (wxWindow *)NULL;
 }
 
     m_winLastFocused = (wxWindow *)NULL;
 }
@@ -320,14 +316,11 @@ void wxFrameMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
 // Pass TRUE to show full screen, FALSE to restore.
 bool wxFrameMSW::ShowFullScreen(bool show, long style)
 {
 // Pass TRUE to show full screen, FALSE to restore.
 bool wxFrameMSW::ShowFullScreen(bool show, long style)
 {
+    if ( IsFullScreen() == show ) 
+        return FALSE;
+
     if (show)
     {
     if (show)
     {
-        if (IsFullScreen())
-            return FALSE;
-
-        m_fsIsShowing = TRUE;
-        m_fsStyle = style;
-
 #if wxUSE_TOOLBAR
         wxToolBar *theToolBar = GetToolBar();
         if (theToolBar)
 #if wxUSE_TOOLBAR
         wxToolBar *theToolBar = GetToolBar();
         if (theToolBar)
@@ -363,54 +356,9 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style)
         else
             m_fsStatusBarFields = 0;
 #endif // wxUSE_STATUSBAR
         else
             m_fsStatusBarFields = 0;
 #endif // wxUSE_STATUSBAR
-
-        // zap the frame borders
-
-        // save the 'normal' window style
-        m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE);
-
-        // save the old position, width & height, maximize state
-        m_fsOldSize = GetRect();
-        m_fsIsMaximized = IsMaximized();
-
-        // decide which window style flags to turn off
-        LONG newStyle = m_fsOldWindowStyle;
-        LONG offFlags = 0;
-
-        if (style & wxFULLSCREEN_NOBORDER)
-            offFlags |= WS_BORDER | WS_THICKFRAME;
-        if (style & wxFULLSCREEN_NOCAPTION)
-            offFlags |= (WS_CAPTION | WS_SYSMENU);
-
-        newStyle &= (~offFlags);
-
-        // change our window style to be compatible with full-screen mode
-        ::SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
-
-        // resize to the size of the desktop
-        int width, height;
-
-        RECT rect = wxGetWindowRect(::GetDesktopWindow());
-        width = rect.right - rect.left;
-        height = rect.bottom - rect.top;
-
-        SetSize(width, height);
-
-        // now flush the window style cache and actually go full-screen
-        SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
-
-        wxSizeEvent event(wxSize(width, height), GetId());
-        GetEventHandler()->ProcessEvent(event);
-
-        return TRUE;
     }
     else
     {
     }
     else
     {
-        if (!IsFullScreen())
-            return FALSE;
-
-        m_fsIsShowing = FALSE;
-
 #if wxUSE_TOOLBAR
         wxToolBar *theToolBar = GetToolBar();
 
 #if wxUSE_TOOLBAR
         wxToolBar *theToolBar = GetToolBar();
 
@@ -438,14 +386,9 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style)
         if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
             SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
 #endif
         if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
             SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
 #endif
-
-        Maximize(m_fsIsMaximized);
-        SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle);
-        SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y,
-            m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED);
-
-        return TRUE;
     }
     }
+    
+    return wxFrameBase::ShowFullScreen(show, style);
 }
 
 // Default activation behaviour - set the focus for the first child
 }
 
 // Default activation behaviour - set the focus for the first child
index 2132b624679013dfa028c2f571dfc73ec5cebf80..91d64f0d372217655854322f15d4f1db42a17c3c 100644 (file)
@@ -93,6 +93,12 @@ void wxTopLevelWindowMSW::Init()
 
     // unlike (almost?) all other windows, frames are created hidden
     m_isShown = FALSE;
 
     // unlike (almost?) all other windows, frames are created hidden
     m_isShown = FALSE;
+
+    // Data to save/restore when calling ShowFullScreen
+    m_fsStyle = 0;
+    m_fsOldWindowStyle = 0;
+    m_fsIsMaximized = FALSE;
+    m_fsIsShowing = FALSE;
 }
 
 long wxTopLevelWindowMSW::MSWGetCreateWindowFlags(long *exflags) const
 }
 
 long wxTopLevelWindowMSW::MSWGetCreateWindowFlags(long *exflags) const
@@ -477,6 +483,76 @@ void wxTopLevelWindowMSW::Restore()
     DoShowWindow(SW_RESTORE);
 }
 
     DoShowWindow(SW_RESTORE);
 }
 
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMSW fullscreen
+// ----------------------------------------------------------------------------
+
+bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
+{
+    if (show)
+    {
+        if (IsFullScreen())
+            return FALSE;
+
+        m_fsIsShowing = TRUE;
+        m_fsStyle = style;
+
+        // zap the frame borders
+
+        // save the 'normal' window style
+        m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE);
+
+        // save the old position, width & height, maximize state
+        m_fsOldSize = GetRect();
+        m_fsIsMaximized = IsMaximized();
+
+        // decide which window style flags to turn off
+        LONG newStyle = m_fsOldWindowStyle;
+        LONG offFlags = 0;
+
+        if (style & wxFULLSCREEN_NOBORDER)
+            offFlags |= WS_BORDER | WS_THICKFRAME;
+        if (style & wxFULLSCREEN_NOCAPTION)
+            offFlags |= (WS_CAPTION | WS_SYSMENU);
+
+        newStyle &= (~offFlags);
+
+        // change our window style to be compatible with full-screen mode
+        ::SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle);
+
+        // resize to the size of the desktop
+        int width, height;
+
+        RECT rect = wxGetWindowRect(::GetDesktopWindow());
+        width = rect.right - rect.left;
+        height = rect.bottom - rect.top;
+
+        SetSize(width, height);
+
+        // now flush the window style cache and actually go full-screen
+        SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
+
+        wxSizeEvent event(wxSize(width, height), GetId());
+        GetEventHandler()->ProcessEvent(event);
+
+        return TRUE;
+    }
+    else
+    {
+        if (!IsFullScreen())
+            return FALSE;
+
+        m_fsIsShowing = FALSE;
+
+        Maximize(m_fsIsMaximized);
+        SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle);
+        SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y,
+            m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED);
+
+        return TRUE;
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMSW misc
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMSW misc
 // ----------------------------------------------------------------------------