]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/topluniv.cpp
simplify code to return from the end of the function
[wxWidgets.git] / src / univ / topluniv.cpp
index fa5ecced1126bc772c32d3a6946dbb0ab28816e1..f6dbfa3c497631cbe862f171fdc1d8bf8856b098 100644 (file)
@@ -113,8 +113,7 @@ bool wxTopLevelWindow::Create(wxWindow *parent,
         styleOrig = style;
         exstyleOrig = GetExtraStyle();
         style &= ~(wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX |
-                   wxSYSTEM_MENU | wxRESIZE_BORDER | wxFRAME_TOOL_WINDOW |
-                   wxRESIZE_BORDER);
+                   wxSYSTEM_MENU | wxFRAME_TOOL_WINDOW | wxRESIZE_BORDER);
         style |= wxBORDER_NONE;
         SetExtraStyle(exstyleOrig & ~wxWS_EX_CONTEXTHELP);
     }
@@ -155,14 +154,15 @@ bool wxTopLevelWindow::ShowFullScreen(bool show, long style)
     return wxTopLevelWindowNative::ShowFullScreen(show, style);
 }
 
-/* static */ wxTopLevelWindow::UseNativeDecorationsByDefault(bool native)
+/* static */
+void wxTopLevelWindow::UseNativeDecorationsByDefault(bool native)
 {
     ms_drawDecorations = !native;
 }
 
 void wxTopLevelWindow::UseNativeDecorations(bool native)
 {
-    wxASSERT_MSG( !m_windowStyle, _T("must be called before Create()") );
+    wxASSERT_MSG( !m_windowStyle, wxT("must be called before Create()") );
 
     m_usingNativeDecorations = native;
 }
@@ -183,7 +183,9 @@ long wxTopLevelWindow::GetDecorationsStyle() const
             ms_canIconize = wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME);
         }
 
-        style |= wxTOPLEVEL_TITLEBAR | wxTOPLEVEL_BUTTON_CLOSE;
+        style |= wxTOPLEVEL_TITLEBAR;
+        if ( m_windowStyle & wxCLOSE_BOX )
+            style |= wxTOPLEVEL_BUTTON_CLOSE;
         if ( (m_windowStyle & wxMINIMIZE_BOX) && ms_canIconize )
             style |= wxTOPLEVEL_BUTTON_ICONIZE;
         if ( m_windowStyle & wxMAXIMIZE_BOX )
@@ -200,12 +202,12 @@ long wxTopLevelWindow::GetDecorationsStyle() const
     }
     if ( (m_windowStyle & (wxSIMPLE_BORDER | wxNO_BORDER)) == 0 )
         style |= wxTOPLEVEL_BORDER;
-    if ( m_windowStyle & (wxRESIZE_BORDER | wxRESIZE_BORDER) )
+    if ( m_windowStyle & wxRESIZE_BORDER )
         style |= wxTOPLEVEL_RESIZEABLE;
 
     if ( IsMaximized() )
         style |= wxTOPLEVEL_MAXIMIZED;
-    if ( GetIcon().Ok() )
+    if ( GetIcon().IsOk() )
         style |= wxTOPLEVEL_ICON;
     if ( m_isActive )
         style |= wxTOPLEVEL_ACTIVE;
@@ -302,26 +304,15 @@ long wxTopLevelWindow::HitTest(const wxPoint& pt) const
     return m_renderer->HitTestFrame(rect, pt+GetClientAreaOrigin(), GetDecorationsStyle());
 }
 
-int wxTopLevelWindow::GetMinWidth() const
+wxSize wxTopLevelWindow::GetMinSize() const
 {
+    wxSize size = wxTopLevelWindowNative::GetMinSize();
     if ( !m_usingNativeDecorations )
     {
-        return wxMax(wxTopLevelWindowNative::GetMinWidth(),
-                     m_renderer->GetFrameMinSize(GetDecorationsStyle()).x);
+        size.IncTo(m_renderer->GetFrameMinSize(GetDecorationsStyle()));
     }
-    else
-        return wxTopLevelWindowNative::GetMinWidth();
-}
 
-int wxTopLevelWindow::GetMinHeight() const
-{
-    if ( !m_usingNativeDecorations )
-    {
-        return wxMax(wxTopLevelWindowNative::GetMinHeight(),
-                     m_renderer->GetFrameMinSize(GetDecorationsStyle()).y);
-    }
-    else
-        return wxTopLevelWindowNative::GetMinHeight();
+    return size;
 }
 
 // ----------------------------------------------------------------------------
@@ -337,13 +328,13 @@ void wxTopLevelWindow::SetIcons(const wxIconBundle& icons)
         wxSize size = m_renderer->GetFrameIconSize();
         const wxIcon& icon = icons.GetIcon( size );
 
-        if ( !icon.Ok() || size.x == wxDefaultCoord  )
+        if ( !icon.IsOk() || size.x == wxDefaultCoord  )
             m_titlebarIcon = icon;
         else
         {
             wxBitmap bmp1;
             bmp1.CopyFromIcon(icon);
-            if ( !bmp1.Ok() )
+            if ( !bmp1.IsOk() )
                 m_titlebarIcon = wxNullIcon;
             else if ( bmp1.GetWidth() == size.x && bmp1.GetHeight() == size.y )
                 m_titlebarIcon = icon;