drawing improvements; empty caption w/ tab drawing looks better
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40259 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -313,7 +313,7 @@ void wxAuiTabContainer::AddButton(int id, const wxBitmap& bmp)
|
|||||||
|
|
||||||
void wxAuiTabContainer::DrawTab(wxDC* dc,
|
void wxAuiTabContainer::DrawTab(wxDC* dc,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption,
|
const wxString& _caption,
|
||||||
bool active,
|
bool active,
|
||||||
wxRect* out_rect,
|
wxRect* out_rect,
|
||||||
int* x_extent)
|
int* x_extent)
|
||||||
@@ -324,6 +324,11 @@ void wxAuiTabContainer::DrawTab(wxDC* dc,
|
|||||||
wxCoord textx, texty;
|
wxCoord textx, texty;
|
||||||
|
|
||||||
|
|
||||||
|
// if the caption is empty, measure some temporary text
|
||||||
|
wxString caption = _caption;
|
||||||
|
if (_caption.IsEmpty())
|
||||||
|
caption = wxT("Xj");
|
||||||
|
|
||||||
// measure text
|
// measure text
|
||||||
dc->SetFont(m_measuring_font);
|
dc->SetFont(m_measuring_font);
|
||||||
dc->GetTextExtent(caption, &measured_textx, &measured_texty);
|
dc->GetTextExtent(caption, &measured_textx, &measured_texty);
|
||||||
@@ -334,6 +339,7 @@ void wxAuiTabContainer::DrawTab(wxDC* dc,
|
|||||||
dc->SetFont(m_normal_font);
|
dc->SetFont(m_normal_font);
|
||||||
dc->GetTextExtent(caption, &normal_textx, &normal_texty);
|
dc->GetTextExtent(caption, &normal_textx, &normal_texty);
|
||||||
|
|
||||||
|
caption = _caption;
|
||||||
|
|
||||||
wxCoord tab_height = measured_texty + 4;
|
wxCoord tab_height = measured_texty + 4;
|
||||||
wxCoord tab_width = measured_textx + tab_height + 5;
|
wxCoord tab_width = measured_textx + tab_height + 5;
|
||||||
@@ -824,6 +830,7 @@ public:
|
|||||||
m_tabs->SetSize(m_rect.x, m_rect.y, m_rect.width, tab_height);
|
m_tabs->SetSize(m_rect.x, m_rect.y, m_rect.width, tab_height);
|
||||||
m_tabs->SetRect(wxRect(0, 0, m_rect.width, tab_height));
|
m_tabs->SetRect(wxRect(0, 0, m_rect.width, tab_height));
|
||||||
m_tabs->Refresh();
|
m_tabs->Refresh();
|
||||||
|
m_tabs->Update();
|
||||||
|
|
||||||
wxAuiNotebookPageArray& pages = m_tabs->GetPages();
|
wxAuiNotebookPageArray& pages = m_tabs->GetPages();
|
||||||
size_t i, page_count = pages.GetCount();
|
size_t i, page_count = pages.GetCount();
|
||||||
|
Reference in New Issue
Block a user