virtual void SetColour(const wxColour& colour) = 0;
virtual void SetActiveColour(const wxColour& colour) = 0;
+ virtual void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect) = 0;
+
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
virtual int GetIndentSize() = 0;
+ virtual int GetBorderWidth(
+ wxWindow* wnd) = 0;
+
virtual int GetBestTabCtrlSize(
wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
void SetColour(const wxColour& colour);
void SetActiveColour(const wxColour& colour);
+ void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
int GetIndentSize();
+ int GetBorderWidth(
+ wxWindow* wnd);
+
wxSize GetTabSize(
wxDC& dc,
wxWindow* wnd,
void SetColour(const wxColour& colour);
void SetActiveColour(const wxColour& colour);
+ void DrawBorder(
+ wxDC& dc,
+ wxWindow* wnd,
+ const wxRect& rect);
+
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
int GetIndentSize();
+ int GetBorderWidth(
+ wxWindow* wnd);
+
wxSize GetTabSize(
wxDC& dc,
wxWindow* wnd,
wxAuiGtkTabArt();
virtual wxAuiTabArt* Clone();
+ virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect);
virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect);
virtual void DrawTab(wxDC& dc,
wxWindow* wnd,
int button_state, int orientation, wxRect* out_rect);
int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages,
const wxSize& required_bmp_size);
+ int GetBorderWidth(wxWindow* wnd);
virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption,
const wxBitmap& bitmap, bool active,
int close_button_state, int* x_extent);
for (i = 0; i < page_count; ++i)
{
- int height = m_rect.height - m_tabCtrlHeight;
+ wxAuiNotebookPage& page = pages.Item(i);
+ int border_width = m_tabs->GetArtProvider()->GetBorderWidth(page.window);
+
+ int height = m_rect.height - m_tabCtrlHeight - border_width;
if ( height < 0 )
{
// avoid passing negative height to wxWindow::SetSize(), this
height = 0;
}
- wxAuiNotebookPage& page = pages.Item(i);
if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM)
{
- page.window->SetSize(m_rect.x, m_rect.y, m_rect.width, height);
+ page.window->SetSize(m_rect.x + 2 * border_width,
+ m_rect.y + 2 * border_width,
+ m_rect.width - 4 * border_width,
+ height);
}
else //TODO: if (GetFlags() & wxAUI_NB_TOP)
{
- page.window->SetSize(m_rect.x, m_rect.y + m_tabCtrlHeight,
- m_rect.width, height);
+ page.window->SetSize(m_rect.x + 2 * border_width,
+ m_rect.y + m_tabCtrlHeight,
+ m_rect.width - 4 * border_width,
+ height);
}
// TODO: else if (GetFlags() & wxAUI_NB_LEFT){}
// TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
#include "wx/aui/framemanager.h"
#include "wx/aui/dockart.h"
+#include "wx/aui/auibook.h"
+#include "wx/aui/tabart.h"
#ifndef WX_PRECOMP
#include "wx/settings.h"
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
-void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow *WXUNUSED(window), const wxRect& _rect,
+void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow* window, const wxRect& _rect,
wxAuiPaneInfo& pane)
{
dc.SetPen(m_borderPen);
}
else
{
- for (i = 0; i < border_width; ++i)
+ // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk)
+ wxAuiTabArt* art = 0;
+ wxAuiNotebook* nb = wxDynamicCast(window, wxAuiNotebook);
+ if (nb)
+ art = nb->GetArtProvider();
+
+ if (art)
+ art->DrawBorder(dc, window, rect);
+ else
{
- dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
- rect.Deflate(1);
+ for (i = 0; i < border_width; ++i)
+ {
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
+ rect.Deflate(1);
+ }
}
}
}
#include "wx/renderer.h"
#include "wx/aui/auibook.h"
+#include "wx/aui/framemanager.h"
+#include "wx/aui/dockart.h"
#ifdef __WXMAC__
#include "wx/osx/private.h"
}
+void wxAuiGenericTabArt::DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect)
+{
+ int i, border_width = GetBorderWidth(wnd);
+
+ wxRect theRect(rect);
+ for (i = 0; i < border_width; ++i)
+ {
+ dc.DrawRectangle(theRect.x, theRect.y, theRect.width, theRect.height);
+ theRect.Deflate(1);
+ }
+}
+
void wxAuiGenericTabArt::DrawBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
return 5;
}
+int wxAuiGenericTabArt::GetBorderWidth(wxWindow* wnd)
+{
+ wxAuiManager* mgr = wxAuiManager::GetManager(wnd);
+ if (mgr)
+ {
+ wxAuiDockArt* art = mgr->GetArtProvider();
+ if (art)
+ return art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE);
+ }
+ return 1;
+}
+
wxSize wxAuiGenericTabArt::GetTabSize(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxString& caption,
m_selectedBkPen = wxPen(colour);
}
+void wxAuiSimpleTabArt::DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect)
+{
+ int i, border_width = GetBorderWidth(wnd);
+
+ wxRect theRect(rect);
+ for (i = 0; i < border_width; ++i)
+ {
+ dc.DrawRectangle(theRect.x, theRect.y, theRect.width, theRect.height);
+ theRect.Deflate(1);
+ }
+}
+
void wxAuiSimpleTabArt::DrawBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& rect)
return 0;
}
+int wxAuiSimpleTabArt::GetBorderWidth(wxWindow* wnd)
+{
+ wxAuiManager* mgr = wxAuiManager::GetManager(wnd);
+ if (mgr)
+ {
+ wxAuiDockArt* art = mgr->GetArtProvider();
+ if (art)
+ return art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE);
+ }
+ return 1;
+}
+
wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxString& caption,
rect.x, rect.y, rect.width, rect.height);
}
+void wxAuiGtkTabArt::DrawBorder(wxDC& WXUNUSED(dc), wxWindow* wnd, const wxRect& rect)
+{
+ int generic_border_width = wxAuiGenericTabArt::GetBorderWidth(wnd);
+
+ if (!wnd) return;
+ if (!wnd->m_wxwindow) return;
+ if (!gtk_widget_is_drawable(wnd->m_wxwindow)) return;
+
+ GtkStyle *style_notebook = gtk_widget_get_style(wxGTKPrivate::GetNotebookWidget());
+
+ gtk_paint_box(style_notebook, wnd->GTKGetDrawingWindow(), GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ NULL, wnd->m_wxwindow,
+ const_cast<char*>("notebook"),
+ rect.x + generic_border_width + 1, rect.y + generic_border_width + 1,
+ rect.width - (generic_border_width + 1), rect.height - (generic_border_width + 1));
+}
+
void ButtonStateAndShadow(int button_state, GtkStateType &state, GtkShadowType &shadow)
{
return tab_height;
}
+int wxAuiGtkTabArt::GetBorderWidth(wxWindow* wnd)
+{
+ return wxAuiGenericTabArt::GetBorderWidth(wnd) + wxMax(GTK_NOTEBOOK (wxGTKPrivate::GetNotebookWidget())->tab_hborder,
+ GTK_NOTEBOOK (wxGTKPrivate::GetNotebookWidget())->tab_vborder);
+}
+
wxSize wxAuiGtkTabArt::GetTabSize(wxDC& dc,
wxWindow* wnd,
const wxString& caption,