api uniformity between tabart and dockart
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -67,11 +67,11 @@ public:
|
|||||||
virtual void SetMeasuringFont(const wxFont& font) = 0;
|
virtual void SetMeasuringFont(const wxFont& font) = 0;
|
||||||
|
|
||||||
virtual void DrawBackground(
|
virtual void DrawBackground(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& rect) = 0;
|
const wxRect& rect) = 0;
|
||||||
|
|
||||||
virtual void DrawTab(wxDC* dc,
|
virtual void DrawTab(wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
int* x_extent) = 0;
|
int* x_extent) = 0;
|
||||||
|
|
||||||
virtual void DrawButton(
|
virtual void DrawButton(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
int bitmap_id,
|
int bitmap_id,
|
||||||
@@ -91,19 +91,19 @@ public:
|
|||||||
const wxBitmap& bitmap_override,
|
const wxBitmap& bitmap_override,
|
||||||
wxRect* out_rect) = 0;
|
wxRect* out_rect) = 0;
|
||||||
|
|
||||||
virtual int ShowWindowList(
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxArrayString& items,
|
|
||||||
int active_idx) = 0;
|
|
||||||
|
|
||||||
virtual wxSize GetTabSize(
|
virtual wxSize GetTabSize(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
bool active,
|
bool active,
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
int* x_extent) = 0;
|
int* x_extent) = 0;
|
||||||
|
|
||||||
|
virtual int ShowWindowList(
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxArrayString& items,
|
||||||
|
int active_idx) = 0;
|
||||||
|
|
||||||
virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0;
|
virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,11 +122,11 @@ public:
|
|||||||
void SetMeasuringFont(const wxFont& font);
|
void SetMeasuringFont(const wxFont& font);
|
||||||
|
|
||||||
void DrawBackground(
|
void DrawBackground(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& rect);
|
const wxRect& rect);
|
||||||
|
|
||||||
void DrawTab(wxDC* dc,
|
void DrawTab(wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
int* x_extent);
|
int* x_extent);
|
||||||
|
|
||||||
void DrawButton(
|
void DrawButton(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
int bitmap_id,
|
int bitmap_id,
|
||||||
@@ -146,19 +146,19 @@ public:
|
|||||||
const wxBitmap& bitmap_override,
|
const wxBitmap& bitmap_override,
|
||||||
wxRect* out_rect);
|
wxRect* out_rect);
|
||||||
|
|
||||||
int ShowWindowList(
|
|
||||||
wxWindow* wnd,
|
|
||||||
const wxArrayString& items,
|
|
||||||
int active_idx);
|
|
||||||
|
|
||||||
wxSize GetTabSize(
|
wxSize GetTabSize(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
bool active,
|
bool active,
|
||||||
int close_button_state,
|
int close_button_state,
|
||||||
int* x_extent);
|
int* x_extent);
|
||||||
|
|
||||||
|
int ShowWindowList(
|
||||||
|
wxWindow* wnd,
|
||||||
|
const wxArrayString& items,
|
||||||
|
int active_idx);
|
||||||
|
|
||||||
int GetBestTabCtrlSize(wxWindow* wnd);
|
int GetBestTabCtrlSize(wxWindow* wnd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -46,33 +46,33 @@ public:
|
|||||||
void SetColor(int id, const wxColour& color) { SetColour(id, color); }
|
void SetColor(int id, const wxColour& color) { SetColour(id, color); }
|
||||||
|
|
||||||
virtual void DrawSash(wxDC& dc,
|
virtual void DrawSash(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
int orientation,
|
int orientation,
|
||||||
const wxRect& rect) = 0;
|
const wxRect& rect) = 0;
|
||||||
|
|
||||||
virtual void DrawBackground(wxDC& dc,
|
virtual void DrawBackground(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
int orientation,
|
int orientation,
|
||||||
const wxRect& rect) = 0;
|
const wxRect& rect) = 0;
|
||||||
|
|
||||||
virtual void DrawCaption(wxDC& dc,
|
virtual void DrawCaption(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
wxAuiPaneInfo& pane) = 0;
|
wxAuiPaneInfo& pane) = 0;
|
||||||
|
|
||||||
virtual void DrawGripper(wxDC& dc,
|
virtual void DrawGripper(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
wxAuiPaneInfo& pane) = 0;
|
wxAuiPaneInfo& pane) = 0;
|
||||||
|
|
||||||
virtual void DrawBorder(wxDC& dc,
|
virtual void DrawBorder(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
wxAuiPaneInfo& pane) = 0;
|
wxAuiPaneInfo& pane) = 0;
|
||||||
|
|
||||||
virtual void DrawPaneButton(wxDC& dc,
|
virtual void DrawPaneButton(wxDC& dc,
|
||||||
wxWindow *window,
|
wxWindow* window,
|
||||||
int button,
|
int button,
|
||||||
int button_state,
|
int button_state,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
|
@@ -177,18 +177,18 @@ wxAuiDefaultTabArt::~wxAuiDefaultTabArt()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAuiDefaultTabArt::DrawBackground(wxDC* dc,
|
void wxAuiDefaultTabArt::DrawBackground(wxDC& dc,
|
||||||
wxWindow* WXUNUSED(wnd),
|
wxWindow* WXUNUSED(wnd),
|
||||||
const wxRect& rect)
|
const wxRect& rect)
|
||||||
{
|
{
|
||||||
// draw background
|
// draw background
|
||||||
dc->SetBrush(m_bkbrush);
|
dc.SetBrush(m_bkbrush);
|
||||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc->DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2);
|
dc.DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2);
|
||||||
|
|
||||||
// draw base line
|
// draw base line
|
||||||
dc->SetPen(*wxGREY_PEN);
|
dc.SetPen(*wxGREY_PEN);
|
||||||
dc->DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1);
|
dc.DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC* dc,
|
|||||||
// out_rect - actual output rectangle
|
// out_rect - actual output rectangle
|
||||||
// x_extent - the advance x; where the next tab should start
|
// x_extent - the advance x; where the next tab should start
|
||||||
|
|
||||||
void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
|
||||||
wxWindow* wnd,
|
wxWindow* wnd,
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
const wxString& caption_text,
|
const wxString& caption_text,
|
||||||
@@ -220,11 +220,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
if (caption_text.empty())
|
if (caption_text.empty())
|
||||||
caption = wxT("Xj");
|
caption = wxT("Xj");
|
||||||
|
|
||||||
dc->SetFont(m_selected_font);
|
dc.SetFont(m_selected_font);
|
||||||
dc->GetTextExtent(caption, &selected_textx, &selected_texty);
|
dc.GetTextExtent(caption, &selected_textx, &selected_texty);
|
||||||
|
|
||||||
dc->SetFont(m_normal_font);
|
dc.SetFont(m_normal_font);
|
||||||
dc->GetTextExtent(caption, &normal_textx, &normal_texty);
|
dc.GetTextExtent(caption, &normal_textx, &normal_texty);
|
||||||
|
|
||||||
// figure out the size of the tab
|
// figure out the size of the tab
|
||||||
wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
|
wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
|
||||||
@@ -238,17 +238,17 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
dc->SetPen(m_selected_bkpen);
|
dc.SetPen(m_selected_bkpen);
|
||||||
dc->SetBrush(m_selected_bkbrush);
|
dc.SetBrush(m_selected_bkbrush);
|
||||||
dc->SetFont(m_selected_font);
|
dc.SetFont(m_selected_font);
|
||||||
textx = selected_textx;
|
textx = selected_textx;
|
||||||
texty = selected_texty;
|
texty = selected_texty;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc->SetPen(m_normal_bkpen);
|
dc.SetPen(m_normal_bkpen);
|
||||||
dc->SetBrush(m_normal_bkbrush);
|
dc.SetBrush(m_normal_bkbrush);
|
||||||
dc->SetFont(m_normal_font);
|
dc.SetFont(m_normal_font);
|
||||||
textx = normal_textx;
|
textx = normal_textx;
|
||||||
texty = normal_texty;
|
texty = normal_texty;
|
||||||
}
|
}
|
||||||
@@ -272,12 +272,12 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
points[6] = points[0];
|
points[6] = points[0];
|
||||||
|
|
||||||
|
|
||||||
dc->DrawPolygon(6, points);
|
dc.DrawPolygon(6, points);
|
||||||
|
|
||||||
dc->SetPen(*wxGREY_PEN);
|
dc.SetPen(*wxGREY_PEN);
|
||||||
|
|
||||||
//dc->DrawLines(active ? 6 : 7, points);
|
//dc.DrawLines(active ? 6 : 7, points);
|
||||||
dc->DrawLines(7, points);
|
dc.DrawLines(7, points);
|
||||||
|
|
||||||
|
|
||||||
int text_offset;
|
int text_offset;
|
||||||
@@ -295,7 +295,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
|
|
||||||
|
|
||||||
// draw tab text
|
// draw tab text
|
||||||
dc->DrawText(caption,
|
dc.DrawText(caption,
|
||||||
text_offset,
|
text_offset,
|
||||||
(tab_y + tab_height)/2 - (texty/2) + 1);
|
(tab_y + tab_height)/2 - (texty/2) + 1);
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1,
|
tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1,
|
||||||
close_button_width,
|
close_button_width,
|
||||||
tab_height - 1);
|
tab_height - 1);
|
||||||
DrawButtonS(*dc, rect, bmp, *wxWHITE, close_button_state);
|
DrawButtonS(dc, rect, bmp, *wxWHITE, close_button_state);
|
||||||
|
|
||||||
*out_button_rect = rect;
|
*out_button_rect = rect;
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
|
wxSize wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
|
||||||
wxWindow* WXUNUSED(wnd),
|
wxWindow* WXUNUSED(wnd),
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
bool WXUNUSED(active),
|
bool WXUNUSED(active),
|
||||||
@@ -332,8 +332,8 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
|
|||||||
{
|
{
|
||||||
wxCoord measured_textx, measured_texty;
|
wxCoord measured_textx, measured_texty;
|
||||||
|
|
||||||
dc->SetFont(m_measuring_font);
|
dc.SetFont(m_measuring_font);
|
||||||
dc->GetTextExtent(caption, &measured_textx, &measured_texty);
|
dc.GetTextExtent(caption, &measured_textx, &measured_texty);
|
||||||
|
|
||||||
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;
|
||||||
@@ -348,7 +348,7 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
|
|||||||
|
|
||||||
|
|
||||||
void wxAuiDefaultTabArt::DrawButton(
|
void wxAuiDefaultTabArt::DrawButton(
|
||||||
wxDC* dc,
|
wxDC& dc,
|
||||||
wxWindow* WXUNUSED(wnd),
|
wxWindow* WXUNUSED(wnd),
|
||||||
const wxRect& in_rect,
|
const wxRect& in_rect,
|
||||||
int bitmap_id,
|
int bitmap_id,
|
||||||
@@ -415,7 +415,7 @@ void wxAuiDefaultTabArt::DrawButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawButtonS(*dc, rect, bmp, *wxWHITE, button_state);
|
DrawButtonS(dc, rect, bmp, *wxWHITE, button_state);
|
||||||
|
|
||||||
*out_rect = rect;
|
*out_rect = rect;
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd)
|
|||||||
wxClientDC dc(wnd);
|
wxClientDC dc(wnd);
|
||||||
dc.SetFont(m_measuring_font);
|
dc.SetFont(m_measuring_font);
|
||||||
int x_ext = 0;
|
int x_ext = 0;
|
||||||
wxSize s = GetTabSize(&dc,
|
wxSize s = GetTabSize(dc,
|
||||||
wnd,
|
wnd,
|
||||||
wxT("ABCDEFGHIj"),
|
wxT("ABCDEFGHIj"),
|
||||||
true,
|
true,
|
||||||
@@ -852,7 +852,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
|
|
||||||
|
|
||||||
int x_extent = 0;
|
int x_extent = 0;
|
||||||
wxSize size = m_art->GetTabSize(&dc,
|
wxSize size = m_art->GetTabSize(dc,
|
||||||
wnd,
|
wnd,
|
||||||
page.caption,
|
page.caption,
|
||||||
page.active,
|
page.active,
|
||||||
@@ -925,7 +925,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
|
|
||||||
|
|
||||||
// draw background
|
// draw background
|
||||||
m_art->DrawBackground(&dc, wnd, m_rect);
|
m_art->DrawBackground(dc, wnd, m_rect);
|
||||||
|
|
||||||
// draw buttons
|
// draw buttons
|
||||||
int left_buttons_width = 0;
|
int left_buttons_width = 0;
|
||||||
@@ -948,7 +948,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
button_rect.SetY(1);
|
button_rect.SetY(1);
|
||||||
button_rect.SetWidth(offset);
|
button_rect.SetWidth(offset);
|
||||||
|
|
||||||
m_art->DrawButton(&dc,
|
m_art->DrawButton(dc,
|
||||||
wnd,
|
wnd,
|
||||||
button_rect,
|
button_rect,
|
||||||
button.id,
|
button.id,
|
||||||
@@ -978,7 +978,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
|
|
||||||
wxRect button_rect(offset, 1, 1000, m_rect.height);
|
wxRect button_rect(offset, 1, 1000, m_rect.height);
|
||||||
|
|
||||||
m_art->DrawButton(&dc,
|
m_art->DrawButton(dc,
|
||||||
wnd,
|
wnd,
|
||||||
button_rect,
|
button_rect,
|
||||||
button.id,
|
button.id,
|
||||||
@@ -1053,7 +1053,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
|
|
||||||
rect.x = offset;
|
rect.x = offset;
|
||||||
|
|
||||||
m_art->DrawTab(&dc,
|
m_art->DrawTab(dc,
|
||||||
wnd,
|
wnd,
|
||||||
rect,
|
rect,
|
||||||
page.caption,
|
page.caption,
|
||||||
@@ -1088,7 +1088,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rect.x = active_offset;
|
rect.x = active_offset;
|
||||||
m_art->DrawTab(&dc,
|
m_art->DrawTab(dc,
|
||||||
wnd,
|
wnd,
|
||||||
rect,
|
rect,
|
||||||
page.caption,
|
page.caption,
|
||||||
|
Reference in New Issue
Block a user