implemented wxAUI_NB_WINDOWLIST_BUTTON and wxAUI_NB_SCROLL_BUTTONS in wxAuiNotebook

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42960 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams 2006-11-02 20:27:38 +00:00
parent 9a5c9a0cde
commit 01372b8f09
4 changed files with 239 additions and 53 deletions

View File

@ -37,7 +37,7 @@ enum wxAuiNotebookOption
wxAUI_NB_TAB_SPLIT = 1 << 4, wxAUI_NB_TAB_SPLIT = 1 << 4,
wxAUI_NB_TAB_MOVE = 1 << 5, wxAUI_NB_TAB_MOVE = 1 << 5,
wxAUI_NB_SCROLL_BUTTONS = 1 << 6, wxAUI_NB_SCROLL_BUTTONS = 1 << 6,
wxAUI_NB_PAGELIST_BUTTON = 1 << 7, wxAUI_NB_WINDOWLIST_BUTTON = 1 << 7,
wxAUI_NB_CLOSE_BUTTON = 1 << 8, wxAUI_NB_CLOSE_BUTTON = 1 << 8,
wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 9, wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 9,
wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 10, wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 10,
@ -68,9 +68,11 @@ public:
virtual void DrawBackground( virtual void DrawBackground(
wxDC* dc, wxDC* dc,
wxWindow* wnd,
const wxRect& rect) = 0; const wxRect& rect) = 0;
virtual void DrawTab(wxDC* dc, virtual void DrawTab(wxDC* dc,
wxWindow* wnd,
const wxRect& in_rect, const wxRect& in_rect,
const wxString& caption, const wxString& caption,
bool active, bool active,
@ -81,21 +83,28 @@ public:
virtual void DrawButton( virtual void DrawButton(
wxDC* dc, wxDC* dc,
wxWindow* wnd,
const wxRect& in_rect, const wxRect& in_rect,
int bitmap_id, int bitmap_id,
int button_state, int button_state,
int orientation, int orientation,
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,
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 GetBestTabCtrlSize(wxWindow* wnd) = 0; virtual int GetBestTabCtrlSize(wxWindow* wnd) = 0;
}; };
@ -107,15 +116,18 @@ public:
wxAuiDefaultTabArt(); wxAuiDefaultTabArt();
virtual ~wxAuiDefaultTabArt(); virtual ~wxAuiDefaultTabArt();
void SetWindow(wxWindow* wnd);
void SetNormalFont(const wxFont& font); void SetNormalFont(const wxFont& font);
void SetSelectedFont(const wxFont& font); void SetSelectedFont(const wxFont& font);
void SetMeasuringFont(const wxFont& font); void SetMeasuringFont(const wxFont& font);
void DrawBackground( void DrawBackground(
wxDC* dc, wxDC* dc,
wxWindow* wnd,
const wxRect& rect); const wxRect& rect);
void DrawTab(wxDC* dc, void DrawTab(wxDC* dc,
wxWindow* wnd,
const wxRect& in_rect, const wxRect& in_rect,
const wxString& caption, const wxString& caption,
bool active, bool active,
@ -126,6 +138,7 @@ public:
void DrawButton( void DrawButton(
wxDC* dc, wxDC* dc,
wxWindow* wnd,
const wxRect& in_rect, const wxRect& in_rect,
int bitmap_id, int bitmap_id,
int button_state, int button_state,
@ -133,14 +146,20 @@ 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,
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 GetBestTabCtrlSize(wxWindow* wnd); int GetBestTabCtrlSize(wxWindow* wnd);
private: private:
@ -158,6 +177,8 @@ private:
wxBitmap m_disabled_left_bmp; wxBitmap m_disabled_left_bmp;
wxBitmap m_active_right_bmp; wxBitmap m_active_right_bmp;
wxBitmap m_disabled_right_bmp; wxBitmap m_disabled_right_bmp;
wxBitmap m_active_windowlist_bmp;
wxBitmap m_disabled_windowlist_bmp;
}; };
@ -274,9 +295,9 @@ public:
protected: protected:
virtual void Render(wxDC* dc); virtual void Render(wxDC* dc, wxWindow* wnd);
private: protected:
wxAuiTabArt* m_art; wxAuiTabArt* m_art;
wxAuiNotebookPageArray m_pages; wxAuiNotebookPageArray m_pages;

View File

@ -99,10 +99,11 @@ enum wxAuiButtonId
wxAUI_BUTTON_MINIMIZE = 103, wxAUI_BUTTON_MINIMIZE = 103,
wxAUI_BUTTON_PIN = 104, wxAUI_BUTTON_PIN = 104,
wxAUI_BUTTON_OPTIONS = 105, wxAUI_BUTTON_OPTIONS = 105,
wxAUI_BUTTON_LEFT = 106, wxAUI_BUTTON_WINDOWLIST = 106,
wxAUI_BUTTON_RIGHT = 107, wxAUI_BUTTON_LEFT = 107,
wxAUI_BUTTON_UP = 108, wxAUI_BUTTON_RIGHT = 108,
wxAUI_BUTTON_DOWN = 109, wxAUI_BUTTON_UP = 109,
wxAUI_BUTTON_DOWN = 110,
wxAUI_BUTTON_CUSTOM1 = 201, wxAUI_BUTTON_CUSTOM1 = 201,
wxAUI_BUTTON_CUSTOM2 = 202, wxAUI_BUTTON_CUSTOM2 = 202,
wxAUI_BUTTON_CUSTOM3 = 203 wxAUI_BUTTON_CUSTOM3 = 203

View File

@ -90,6 +90,8 @@ class MyFrame : public wxFrame
ID_NotebookCloseButtonActive, ID_NotebookCloseButtonActive,
ID_NotebookAllowTabMove, ID_NotebookAllowTabMove,
ID_NotebookAllowTabSplit, ID_NotebookAllowTabSplit,
ID_NotebookWindowList,
ID_NotebookScrollButtons,
ID_FirstPerspective = ID_CreatePerspective+1000 ID_FirstPerspective = ID_CreatePerspective+1000
}; };
@ -574,6 +576,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_NotebookCloseButtonActive, MyFrame::OnNotebookFlag) EVT_MENU(ID_NotebookCloseButtonActive, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookAllowTabMove, MyFrame::OnNotebookFlag) EVT_MENU(ID_NotebookAllowTabMove, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookAllowTabSplit, MyFrame::OnNotebookFlag) EVT_MENU(ID_NotebookAllowTabSplit, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookScrollButtons, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookWindowList, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NoGradient, MyFrame::OnGradient) EVT_MENU(ID_NoGradient, MyFrame::OnGradient)
EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient) EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient)
EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient) EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient)
@ -592,6 +596,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_UPDATE_UI(ID_NotebookCloseButtonActive, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_NotebookCloseButtonActive, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_NotebookAllowTabMove, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_NotebookAllowTabMove, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_NotebookAllowTabSplit, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_NotebookAllowTabSplit, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_NotebookScrollButtons, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_NotebookWindowList, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_AllowFloating, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_AllowFloating, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_TransparentHint, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_TransparentHint, MyFrame::OnUpdateUI)
EVT_UPDATE_UI(ID_VenetianBlindsHint, MyFrame::OnUpdateUI) EVT_UPDATE_UI(ID_VenetianBlindsHint, MyFrame::OnUpdateUI)
@ -672,6 +678,8 @@ MyFrame::MyFrame(wxWindow* parent,
notebook_menu->AppendSeparator(); notebook_menu->AppendSeparator();
notebook_menu->AppendCheckItem(ID_NotebookAllowTabMove, _("Allow Tab Move")); notebook_menu->AppendCheckItem(ID_NotebookAllowTabMove, _("Allow Tab Move"));
notebook_menu->AppendCheckItem(ID_NotebookAllowTabSplit, _("Allow Notebook Split")); notebook_menu->AppendCheckItem(ID_NotebookAllowTabSplit, _("Allow Notebook Split"));
notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible"));
m_perspectives_menu = new wxMenu; m_perspectives_menu = new wxMenu;
m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective")); m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective"));
@ -1034,11 +1042,18 @@ void MyFrame::OnNotebookFlag(wxCommandEvent& event)
{ {
m_notebook_style ^= wxAUI_NB_TAB_MOVE; m_notebook_style ^= wxAUI_NB_TAB_MOVE;
} }
else if (id == ID_NotebookAllowTabSplit)
if (id == ID_NotebookAllowTabSplit)
{ {
m_notebook_style ^= wxAUI_NB_TAB_SPLIT; m_notebook_style ^= wxAUI_NB_TAB_SPLIT;
} }
else if (id == ID_NotebookWindowList)
{
m_notebook_style ^= wxAUI_NB_WINDOWLIST_BUTTON;
}
else if (id == ID_NotebookScrollButtons)
{
m_notebook_style ^= wxAUI_NB_SCROLL_BUTTONS;
}
@ -1119,6 +1134,12 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
case ID_NotebookAllowTabMove: case ID_NotebookAllowTabMove:
event.Check((m_notebook_style & wxAUI_NB_TAB_MOVE) != 0); event.Check((m_notebook_style & wxAUI_NB_TAB_MOVE) != 0);
break; break;
case ID_NotebookScrollButtons:
event.Check((m_notebook_style & wxAUI_NB_SCROLL_BUTTONS) != 0);
break;
case ID_NotebookWindowList:
event.Check((m_notebook_style & wxAUI_NB_WINDOWLIST_BUTTON) != 0);
break;
} }
} }

View File

@ -152,6 +152,12 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt()
0x1f, 0xfe, 0x1f, 0xfc, 0x1f, 0xfe, 0x1f, 0xff, 0x9f, 0xff, 0xdf, 0xff, 0x1f, 0xfe, 0x1f, 0xfc, 0x1f, 0xfe, 0x1f, 0xff, 0x9f, 0xff, 0xdf, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static unsigned char list_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x0f, 0xf8, 0xff, 0xff, 0x0f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfe, 0x7f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
m_active_close_bmp = BitmapFromBits(close_bits, 16, 16, *wxBLACK); m_active_close_bmp = BitmapFromBits(close_bits, 16, 16, *wxBLACK);
m_disabled_close_bmp = BitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); m_disabled_close_bmp = BitmapFromBits(close_bits, 16, 16, wxColour(128,128,128));
@ -160,6 +166,10 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt()
m_active_right_bmp = BitmapFromBits(right_bits, 16, 16, *wxBLACK); m_active_right_bmp = BitmapFromBits(right_bits, 16, 16, *wxBLACK);
m_disabled_right_bmp = BitmapFromBits(right_bits, 16, 16, wxColour(128,128,128)); m_disabled_right_bmp = BitmapFromBits(right_bits, 16, 16, wxColour(128,128,128));
m_active_windowlist_bmp = BitmapFromBits(list_bits, 16, 16, *wxBLACK);
m_disabled_windowlist_bmp = BitmapFromBits(list_bits, 16, 16, wxColour(128,128,128));
} }
wxAuiDefaultTabArt::~wxAuiDefaultTabArt() wxAuiDefaultTabArt::~wxAuiDefaultTabArt()
@ -167,7 +177,8 @@ wxAuiDefaultTabArt::~wxAuiDefaultTabArt()
} }
void wxAuiDefaultTabArt::DrawBackground(wxDC* dc, void wxAuiDefaultTabArt::DrawBackground(wxDC* dc,
const wxRect& rect) wxWindow* WXUNUSED(wnd),
const wxRect& rect)
{ {
// draw background // draw background
dc->SetBrush(m_bkbrush); dc->SetBrush(m_bkbrush);
@ -190,13 +201,14 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC* dc,
// 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,
const wxRect& in_rect, wxWindow* wnd,
const wxString& caption_text, const wxRect& in_rect,
bool active, const wxString& caption_text,
int close_button_state, bool active,
wxRect* out_tab_rect, int close_button_state,
wxRect* out_button_rect, wxRect* out_tab_rect,
int* x_extent) wxRect* out_button_rect,
int* x_extent)
{ {
wxCoord normal_textx, normal_texty; wxCoord normal_textx, normal_texty;
wxCoord selected_textx, selected_texty; wxCoord selected_textx, selected_texty;
@ -214,7 +226,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
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, caption, active, close_button_state, x_extent); wxSize tab_size = GetTabSize(dc, wnd, caption, active, close_button_state, x_extent);
wxCoord tab_height = tab_size.y; wxCoord tab_height = tab_size.y;
wxCoord tab_width = tab_size.x; wxCoord tab_width = tab_size.x;
@ -311,10 +323,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc, wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
const wxString& caption, wxWindow* WXUNUSED(wnd),
bool WXUNUSED(active), const wxString& caption,
int close_button_state, bool WXUNUSED(active),
int* x_extent) int close_button_state,
int* x_extent)
{ {
wxCoord measured_textx, measured_texty; wxCoord measured_textx, measured_texty;
@ -334,13 +347,14 @@ wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
void wxAuiDefaultTabArt::DrawButton( void wxAuiDefaultTabArt::DrawButton(
wxDC* dc, wxDC* dc,
const wxRect& in_rect, wxWindow* WXUNUSED(wnd),
int bitmap_id, const wxRect& in_rect,
int button_state, int bitmap_id,
int orientation, int button_state,
const wxBitmap& bitmap_override, int orientation,
wxRect* out_rect) const wxBitmap& bitmap_override,
wxRect* out_rect)
{ {
wxBitmap bmp; wxBitmap bmp;
wxRect rect; wxRect rect;
@ -371,6 +385,12 @@ void wxAuiDefaultTabArt::DrawButton(
else else
bmp = m_active_right_bmp; bmp = m_active_right_bmp;
break; break;
case wxAUI_BUTTON_WINDOWLIST:
if (button_state & wxAUI_BUTTON_STATE_DISABLED)
bmp = m_disabled_windowlist_bmp;
else
bmp = m_active_windowlist_bmp;
break;
} }
} }
@ -401,12 +421,90 @@ void wxAuiDefaultTabArt::DrawButton(
// -- GUI helper classes and functions --
class wxAuiCommandCapture : public wxEvtHandler
{
public:
wxAuiCommandCapture() { m_last_id = 0; }
int GetCommandId() const { return m_last_id; }
bool ProcessEvent(wxEvent& evt)
{
if (evt.GetEventType() == wxEVT_COMMAND_MENU_SELECTED)
{
m_last_id = evt.GetId();
return true;
}
if (GetNextHandler())
return GetNextHandler()->ProcessEvent(evt);
return false;
}
private:
int m_last_id;
};
int wxAuiDefaultTabArt::ShowWindowList(wxWindow* wnd,
const wxArrayString& items,
int active_idx)
{
wxMenu menuPopup;
size_t i, count = items.GetCount();
for (i = 0; i < count; ++i)
{
menuPopup.AppendCheckItem(1000+i, items.Item(i));
}
if (active_idx != -1)
{
menuPopup.Check(1000+active_idx, true);
}
// find out where to put the popup menu of window
// items. Subtract 100 for now to center the menu
// a bit, until a better mechanism can be implemented
wxPoint pt = ::wxGetMousePosition();
pt = wnd->ScreenToClient(pt);
if (pt.x < 100)
pt.x = 0;
else
pt.x -= 100;
// find out the screen coordinate at the bottom of the tab ctrl
wxRect cli_rect = wnd->GetClientRect();
pt.y = cli_rect.y + cli_rect.height;
wxAuiCommandCapture* cc = new wxAuiCommandCapture;
wnd->PushEventHandler(cc);
wnd->PopupMenu(&menuPopup, pt);
int command = cc->GetCommandId();
wnd->PopEventHandler(true);
if (command >= 1000)
return command-1000;
return -1;
}
int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd) 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, wxT("ABCDEFGHIj"), true, wxAUI_BUTTON_STATE_HIDDEN, &x_ext); wxSize s = GetTabSize(&dc,
wnd,
wxT("ABCDEFGHIj"),
true,
wxAUI_BUTTON_STATE_HIDDEN,
&x_ext);
return s.y+3; return s.y+3;
} }
@ -450,7 +548,8 @@ wxAuiTabContainer::wxAuiTabContainer()
m_art = new wxAuiDefaultTabArt; m_art = new wxAuiDefaultTabArt;
AddButton(wxAUI_BUTTON_LEFT, wxLEFT); AddButton(wxAUI_BUTTON_LEFT, wxLEFT);
AddButton(wxAUI_BUTTON_RIGHT, wxRIGHT); AddButton(wxAUI_BUTTON_RIGHT, wxRIGHT);
AddButton(wxAUI_BUTTON_WINDOWLIST, wxRIGHT);
AddButton(wxAUI_BUTTON_CLOSE, wxRIGHT); AddButton(wxAUI_BUTTON_CLOSE, wxRIGHT);
} }
@ -475,7 +574,23 @@ void wxAuiTabContainer::SetFlags(unsigned int flags)
m_flags = flags; m_flags = flags;
// check for new close button settings // check for new close button settings
RemoveButton(wxAUI_BUTTON_LEFT);
RemoveButton(wxAUI_BUTTON_RIGHT);
RemoveButton(wxAUI_BUTTON_WINDOWLIST);
RemoveButton(wxAUI_BUTTON_CLOSE); RemoveButton(wxAUI_BUTTON_CLOSE);
if (flags & wxAUI_NB_SCROLL_BUTTONS)
{
AddButton(wxAUI_BUTTON_LEFT, wxLEFT);
AddButton(wxAUI_BUTTON_RIGHT, wxRIGHT);
}
if (flags & wxAUI_NB_WINDOWLIST_BUTTON)
{
AddButton(wxAUI_BUTTON_WINDOWLIST, wxRIGHT);
}
if (flags & wxAUI_NB_CLOSE_BUTTON) if (flags & wxAUI_NB_CLOSE_BUTTON)
{ {
AddButton(wxAUI_BUTTON_CLOSE, wxRIGHT); AddButton(wxAUI_BUTTON_CLOSE, wxRIGHT);
@ -705,7 +820,7 @@ void wxAuiTabContainer::SetTabOffset(size_t offset)
// Render() renders the tab catalog to the specified DC // Render() renders the tab catalog to the specified DC
// It is a virtual function and can be overridden to // It is a virtual function and can be overridden to
// provide custom drawing capabilities // provide custom drawing capabilities
void wxAuiTabContainer::Render(wxDC* raw_dc) void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
{ {
wxMemoryDC dc; wxMemoryDC dc;
wxBitmap bmp; wxBitmap bmp;
@ -737,6 +852,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
int x_extent = 0; int x_extent = 0;
wxSize size = m_art->GetTabSize(&dc, wxSize size = m_art->GetTabSize(&dc,
wnd,
page.caption, page.caption,
page.active, page.active,
close_button ? close_button ?
@ -808,7 +924,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
// draw background // draw background
m_art->DrawBackground(&dc, m_rect); m_art->DrawBackground(&dc, wnd, m_rect);
// draw buttons // draw buttons
int left_buttons_width = 0; int left_buttons_width = 0;
@ -832,6 +948,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
button_rect.SetWidth(offset); button_rect.SetWidth(offset);
m_art->DrawButton(&dc, m_art->DrawButton(&dc,
wnd,
button_rect, button_rect,
button.id, button.id,
button.cur_state, button.cur_state,
@ -861,6 +978,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
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,
button_rect, button_rect,
button.id, button.id,
button.cur_state, button.cur_state,
@ -934,14 +1052,15 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
rect.x = offset; rect.x = offset;
m_art->DrawTab(&dc, m_art->DrawTab(&dc,
rect, wnd,
page.caption, rect,
page.active, page.caption,
tab_button.cur_state, page.active,
&page.rect, tab_button.cur_state,
&tab_button.rect, &page.rect,
&x_extent); &tab_button.rect,
&x_extent);
if (page.active) if (page.active)
{ {
@ -969,13 +1088,14 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
rect.x = active_offset; rect.x = active_offset;
m_art->DrawTab(&dc, m_art->DrawTab(&dc,
rect, wnd,
page.caption, rect,
page.active, page.caption,
tab_button.cur_state, page.active,
&page.rect, tab_button.cur_state,
&tab_button.rect, &page.rect,
&x_extent); &tab_button.rect,
&x_extent);
} }
dc.DestroyClippingRegion(); dc.DestroyClippingRegion();
@ -1143,7 +1263,7 @@ void wxAuiTabCtrl::OnPaint(wxPaintEvent&)
dc.SetFont(GetFont()); dc.SetFont(GetFont());
if (GetPageCount() > 0) if (GetPageCount() > 0)
Render(&dc); Render(&dc, this);
} }
void wxAuiTabCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) void wxAuiTabCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt))
@ -1320,6 +1440,28 @@ void wxAuiTabCtrl::OnButton(wxAuiNotebookEvent& event)
Refresh(); Refresh();
Update(); Update();
} }
}
else if (button == wxAUI_BUTTON_WINDOWLIST)
{
wxArrayString as;
size_t i, page_count = m_pages.GetCount();
for (i = 0; i < page_count; ++i)
{
wxAuiNotebookPage& page = m_pages.Item(i);
as.Add(page.caption);
}
int idx = GetArtProvider()->ShowWindowList(this, as, GetActivePage());
if (idx != -1)
{
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
e.SetSelection(idx);
e.SetOldSelection(GetActivePage());
e.SetEventObject(this);
GetEventHandler()->ProcessEvent(e);
}
} }
else else
{ {
@ -1385,7 +1527,8 @@ public:
for (i = 0; i < page_count; ++i) for (i = 0; i < page_count; ++i)
{ {
wxAuiNotebookPage& page = pages.Item(i); wxAuiNotebookPage& page = pages.Item(i);
page.window->SetSize(m_rect.x, m_rect.y+tab_height, m_rect.width, m_rect.height-tab_height); page.window->SetSize(m_rect.x, m_rect.y+tab_height,
m_rect.width, m_rect.height-tab_height);
if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame))) if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
{ {