]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix border size computation in wxAuiTabArt.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Oct 2012 21:46:46 +0000 (21:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Oct 2012 21:46:46 +0000 (21:46 +0000)
Space was reserved for the borders even when it wasn't filled, resulting in
visual artefacts. Fix this by virtualizing the function returning the
additional space needed for the borders and only overriding it to return non
zero in wxAuiGtkTabArt.

Closes #14710.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/aui/tabart.h
include/wx/aui/tabartgtk.h
src/aui/auibook.cpp
src/aui/tabart.cpp
src/aui/tabartgtk.cpp

index 12621771a62e45a7d77c88c782026dcb872e1cf6..4a449678ac401d696da3d13ed23de2b7adf2e0ec 100644 (file)
@@ -103,6 +103,9 @@ public:
     virtual int GetBorderWidth(
                          wxWindow* wnd) = 0;
 
+    virtual int GetAdditionalBorderSpace(
+                         wxWindow* wnd) = 0;
+
     virtual int GetBestTabCtrlSize(
                          wxWindow* wnd,
                          const wxAuiNotebookPageArray& pages,
@@ -162,6 +165,9 @@ public:
     int GetBorderWidth(
                  wxWindow* wnd);
 
+    int GetAdditionalBorderSpace(
+                 wxWindow* wnd);
+
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
@@ -258,6 +264,9 @@ public:
     int GetBorderWidth(
                  wxWindow* wnd);
 
+    int GetAdditionalBorderSpace(
+                 wxWindow* wnd);
+
     wxSize GetTabSize(
                  wxDC& dc,
                  wxWindow* wnd,
index b094082d81ea3ce41bdcdc74ef3a1d57adc7192b..37b8587f1cf4d866b12959c34b958d9b8825b203 100644 (file)
@@ -48,6 +48,7 @@ public:
     int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages,
                             const wxSize& required_bmp_size);
     int GetBorderWidth(wxWindow* wnd);
+    int GetAdditionalBorderSpace(wxWindow* wnd);
     virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption,
                               const wxBitmap& bitmap, bool active,
                               int close_button_state, int* x_extent);
index 402724309bbfe8867754ed216531fae171e09992..30691c1c036a1e581a046a2e0c10abb84fbda6b9 100644 (file)
@@ -1544,9 +1544,9 @@ public:
         for (i = 0; i < page_count; ++i)
         {
             wxAuiNotebookPage& page = pages.Item(i);
-            int border_width = m_tabs->GetArtProvider()->GetBorderWidth(page.window);
+            int border_space = m_tabs->GetArtProvider()->GetAdditionalBorderSpace(page.window);
 
-            int height = m_rect.height - m_tabCtrlHeight - border_width;
+            int height = m_rect.height - m_tabCtrlHeight - border_space;
             if ( height < 0 )
             {
                 // avoid passing negative height to wxWindow::SetSize(), this
@@ -1556,16 +1556,16 @@ public:
 
             if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM)
             {
-                page.window->SetSize(m_rect.x + 2 * border_width,
-                                     m_rect.y + 2 *  border_width,
-                                     m_rect.width - 4 * border_width,
+                page.window->SetSize(m_rect.x + border_space,
+                                     m_rect.y + border_space,
+                                     m_rect.width - 2 * border_space,
                                      height);
             }
             else //TODO: if (GetFlags() & wxAUI_NB_TOP)
             {
-                page.window->SetSize(m_rect.x + 2 * border_width,
+                page.window->SetSize(m_rect.x + border_space,
                                      m_rect.y + m_tabCtrlHeight,
-                                     m_rect.width - 4 * border_width,
+                                     m_rect.width - 2 * border_space,
                                      height);
             }
             // TODO: else if (GetFlags() & wxAUI_NB_LEFT){}
index 62c6c5f9ddfa46ccb9678d64e94872dcf66ab7b5..9a30baf76c720906b5b877c742f86a2d3c31fdfa 100644 (file)
@@ -610,6 +610,11 @@ int wxAuiGenericTabArt::GetBorderWidth(wxWindow* wnd)
     return 1;
 }
 
+int wxAuiGenericTabArt::GetAdditionalBorderSpace(wxWindow* WXUNUSED(wnd))
+{
+    return 0;
+}
+
 wxSize wxAuiGenericTabArt::GetTabSize(wxDC& dc,
                                       wxWindow* WXUNUSED(wnd),
                                       const wxString& caption,
@@ -1137,6 +1142,11 @@ int wxAuiSimpleTabArt::GetBorderWidth(wxWindow* wnd)
     return 1;
 }
 
+int wxAuiSimpleTabArt::GetAdditionalBorderSpace(wxWindow* WXUNUSED(wnd))
+{
+    return 0;
+}
+
 wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
                                      wxWindow* WXUNUSED(wnd),
                                      const wxString& caption,
index 28bfaa6aafbf6851f8235ad82826c61a3f38fee3..e57ca3dd3fd79e5e5fb98358e55ce8bf862ab839 100644 (file)
@@ -487,6 +487,11 @@ int wxAuiGtkTabArt::GetBorderWidth(wxWindow* wnd)
                                                            GTK_NOTEBOOK (wxGTKPrivate::GetNotebookWidget())->tab_vborder);
 }
 
+int wxAuiGtkTabArt::GetAdditionalBorderSpace(wxWindow* wnd)
+{
+    return 2 * GetBorderWidth(wnd);
+}
+
 wxSize wxAuiGtkTabArt::GetTabSize(wxDC& dc,
                               wxWindow* wnd,
                               const wxString& caption,