+void wxDefaultTabArt::DrawBackground(
+ wxDC* dc,
+ const wxRect& rect)
+{
+ // draw background
+ dc->SetBrush(m_bkbrush);
+ dc->SetPen(*wxTRANSPARENT_PEN);
+ dc->DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2);
+
+ // draw base line
+ dc->SetPen(*wxGREY_PEN);
+ dc->DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1);
+}
+
+// DrawTab() draws an individual tab.
+//
+// dc - output dc
+// in_rect - rectangle the tab should be confined to
+// caption - tab's caption
+// active - whether or not the tab is active
+// out_rect - actual output rectangle
+// x_extent - the advance x; where the next tab should start
+
+void wxDefaultTabArt::DrawTab(wxDC* dc,
+ const wxRect& in_rect,
+ const wxString& caption_text,
+ bool active,
+ wxRect* out_rect,
+ int* x_extent)
+{
+ wxCoord normal_textx, normal_texty;
+ wxCoord selected_textx, selected_texty;
+ wxCoord measured_textx, measured_texty;
+ wxCoord textx, texty;
+
+
+ // if the caption is empty, measure some temporary text
+ wxString caption = caption_text;
+ if (caption_text.empty())
+ caption = wxT("Xj");
+
+ // measure text
+ dc->SetFont(m_measuring_font);
+ dc->GetTextExtent(caption, &measured_textx, &measured_texty);
+
+ dc->SetFont(m_selected_font);
+ dc->GetTextExtent(caption, &selected_textx, &selected_texty);
+
+ dc->SetFont(m_normal_font);
+ dc->GetTextExtent(caption, &normal_textx, &normal_texty);
+
+ caption = caption_text;
+
+ wxCoord tab_height = measured_texty + 4;
+ wxCoord tab_width = measured_textx + tab_height + 5;
+ wxCoord tab_x = in_rect.x;
+ wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
+
+
+ // select pen, brush and font for the tab to be drawn
+
+ if (active)
+ {
+ dc->SetPen(m_selected_bkpen);
+ dc->SetBrush(m_selected_bkbrush);
+ dc->SetFont(m_selected_font);
+ textx = selected_textx;
+ texty = selected_texty;
+ }
+ else
+ {
+ dc->SetPen(m_normal_bkpen);
+ dc->SetBrush(m_normal_bkbrush);
+ dc->SetFont(m_normal_font);
+ textx = normal_textx;
+ texty = normal_texty;
+ }
+
+
+ // -- draw line --
+
+ wxPoint points[7];
+ points[0].x = tab_x;
+ points[0].y = tab_y + tab_height - 1;
+ points[1].x = tab_x + tab_height - 3;
+ points[1].y = tab_y + 2;
+ points[2].x = tab_x + tab_height + 3;
+ points[2].y = tab_y;
+ points[3].x = tab_x + tab_width - 2;
+ points[3].y = tab_y;
+ points[4].x = tab_x + tab_width;
+ points[4].y = tab_y + 2;
+ points[5].x = tab_x + tab_width;
+ points[5].y = tab_y + tab_height - 1;
+ points[6] = points[0];
+
+
+ dc->DrawPolygon(6, points);
+
+ dc->SetPen(*wxGREY_PEN);
+
+ //dc->DrawLines(active ? 6 : 7, points);
+ dc->DrawLines(7, points);
+
+ // -- draw text --
+
+ dc->DrawText(caption,
+ tab_x + (tab_height/3) + (tab_width/2) - (textx/2),
+ tab_y + tab_height - texty - 2);
+
+ *out_rect = wxRect(tab_x, tab_y, tab_width, tab_height);
+ *x_extent = tab_width - (tab_height/2) - 1;
+}
+
+
+void wxDefaultTabArt::SetNormalFont(const wxFont& font)
+{
+ m_normal_font = font;
+}
+
+void wxDefaultTabArt::SetSelectedFont(const wxFont& font)
+{
+ m_selected_font = font;
+}
+
+void wxDefaultTabArt::SetMeasuringFont(const wxFont& font)
+{
+ m_measuring_font = font;
+}
+
+
+
+
+
+
+// -- wxAuiTabContainer class implementation --
+
+
+// wxAuiTabContainer is a class which contains information about each
+// tab. It also can render an entire tab control to a specified DC.
+// It's not a window class itself, because this code will be used by
+// the wxFrameMananger, where it is disadvantageous to have separate
+// windows for each tab control in the case of "docked tabs"
+
+// A derived class, wxAuiTabCtrl, is an actual wxWindow-derived window
+// which can be used as a tab control in the normal sense.
+
+
+wxAuiTabContainer::wxAuiTabContainer()
+{
+ m_art = new wxDefaultTabArt;
+}
+