]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed maximization handling
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 7 Oct 2001 09:46:49 +0000 (09:46 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 7 Oct 2001 09:46:49 +0000 (09:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/toplevel.cpp
src/univ/topluniv.cpp

index 16af545e6887f1c710ff4c3b8b230b6275871c5d..5829d32f97977a90841ede5f57fea39502e4383f 100644 (file)
@@ -142,18 +142,19 @@ void wxTopLevelWindowMGL::Maximize(bool maximize)
     {
         int x, y, w, h;
         
+        m_isMaximized = TRUE;
+
         GetPosition(&m_savedFrame.x, &m_savedFrame.y);
         GetSize(&m_savedFrame.width, &m_savedFrame.height);
 
         wxClientDisplayRect(&x, &y, &w, &h);
         SetSize(x, y, w, h);
-        m_isMaximized = TRUE;
     }
     else if ( !maximize && m_isMaximized )
     {
+        m_isMaximized = FALSE;
         SetSize(m_savedFrame.x, m_savedFrame.y, 
                 m_savedFrame.width, m_savedFrame.height);
-        m_isMaximized = FALSE;
     }
 }
 
index aa67c1fafe18e273097f2f4257576c2b00d6601c..f17795f54709a2d42f068cf298b5315d38bd7d31 100644 (file)
@@ -148,7 +148,12 @@ long wxTopLevelWindow::GetDecorationsStyle() const
         if ( m_windowStyle & wxMINIMIZE_BOX )
             style |= wxTOPLEVEL_BUTTON_ICONIZE;
         if ( m_windowStyle & wxMAXIMIZE_BOX )
-            style |= wxTOPLEVEL_BUTTON_MAXIMIZE;
+        {
+            if ( IsMaximized() )
+                style |= wxTOPLEVEL_BUTTON_RESTORE;
+            else
+                style |= wxTOPLEVEL_BUTTON_MAXIMIZE;
+        }
 #if wxUSE_HELP
         if ( m_exStyle & (wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP))
             style |= wxTOPLEVEL_BUTTON_HELP;
@@ -268,25 +273,27 @@ long wxTopLevelWindow::HitTest(const wxPoint& pt) const
 void wxTopLevelWindow::SetIcon(const wxIcon& icon)
 {
     wxTopLevelWindowNative::SetIcon(icon);
-    if ( !m_renderer ) return;
 
-    wxSize size = m_renderer->GetFrameIconSize();
-
-    if ( !icon.Ok() || size.x == -1  )
-        m_titlebarIcon = icon;
-    else
+    if ( ms_drawDecorations && m_renderer )
     {
-        wxBitmap bmp1;
-        bmp1.CopyFromIcon(icon);
-        if ( !bmp1.Ok() )
-            m_titlebarIcon = wxNullIcon;
-        else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
+        wxSize size = m_renderer->GetFrameIconSize();
+
+        if ( !icon.Ok() || size.x == -1  )
             m_titlebarIcon = icon;
         else
         {
-            wxImage img = bmp1.ConvertToImage();
-            img.Rescale(size.x, size.y);
-            m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
+            wxBitmap bmp1;
+            bmp1.CopyFromIcon(icon);
+            if ( !bmp1.Ok() )
+                m_titlebarIcon = wxNullIcon;
+            else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
+                m_titlebarIcon = icon;
+            else
+            {
+                wxImage img = bmp1.ConvertToImage();
+                img.Rescale(size.x, size.y);
+                m_titlebarIcon.CopyFromBitmap(wxBitmap(img));
+            }
         }
     }
 }