fixed bad crasher in wxAuiNotebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1668,10 +1668,13 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
|
|||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
offset += m_art->GetIndentSize();
|
offset += m_art->GetIndentSize();
|
||||||
|
|
||||||
// prepare the tab-close-button array
|
|
||||||
while (m_tab_close_buttons.GetCount() > page_count)
|
|
||||||
m_tab_close_buttons.RemoveAt(m_tab_close_buttons.GetCount()-1);
|
|
||||||
|
|
||||||
|
// prepare the tab-close-button array
|
||||||
|
// make sure tab button entries which aren't used are marked as hidden
|
||||||
|
for (i = page_count; i < m_tab_close_buttons.GetCount(); ++i)
|
||||||
|
m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN;
|
||||||
|
|
||||||
|
// make sure there are enough tab button entries to accommodate all tabs
|
||||||
while (m_tab_close_buttons.GetCount() < page_count)
|
while (m_tab_close_buttons.GetCount() < page_count)
|
||||||
{
|
{
|
||||||
wxAuiTabContainerButton tempbtn;
|
wxAuiTabContainerButton tempbtn;
|
||||||
@@ -1981,11 +1984,16 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
|
|||||||
wxWindow* wnd;
|
wxWindow* wnd;
|
||||||
if (TabHitTest(evt.m_x, evt.m_y, &wnd))
|
if (TabHitTest(evt.m_x, evt.m_y, &wnd))
|
||||||
{
|
{
|
||||||
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
|
int new_selection = GetIdxFromWindow(wnd);
|
||||||
e.SetSelection(GetIdxFromWindow(wnd));
|
|
||||||
e.SetOldSelection(GetActivePage());
|
if (new_selection != GetActivePage())
|
||||||
e.SetEventObject(this);
|
{
|
||||||
GetEventHandler()->ProcessEvent(e);
|
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
|
||||||
|
e.SetSelection(new_selection);
|
||||||
|
e.SetOldSelection(GetActivePage());
|
||||||
|
e.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
m_click_pt.x = evt.m_x;
|
m_click_pt.x = evt.m_x;
|
||||||
m_click_pt.y = evt.m_y;
|
m_click_pt.y = evt.m_y;
|
||||||
@@ -2489,7 +2497,6 @@ bool wxAuiNotebook::DeletePage(size_t page_idx)
|
|||||||
if (!RemovePage(page_idx))
|
if (!RemovePage(page_idx))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// actually destroy the window now
|
// actually destroy the window now
|
||||||
if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
|
if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
|
||||||
{
|
{
|
||||||
@@ -2646,12 +2653,14 @@ size_t wxAuiNotebook::SetSelection(size_t new_page)
|
|||||||
evt.SetEventObject(this);
|
evt.SetEventObject(this);
|
||||||
if (!GetEventHandler()->ProcessEvent(evt) || evt.IsAllowed())
|
if (!GetEventHandler()->ProcessEvent(evt) || evt.IsAllowed())
|
||||||
{
|
{
|
||||||
|
int old_curpage = m_curpage;
|
||||||
|
m_curpage = new_page;
|
||||||
|
|
||||||
// program allows the page change
|
// program allows the page change
|
||||||
evt.SetEventType(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED);
|
evt.SetEventType(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED);
|
||||||
(void)GetEventHandler()->ProcessEvent(evt);
|
(void)GetEventHandler()->ProcessEvent(evt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxAuiTabCtrl* ctrl;
|
wxAuiTabCtrl* ctrl;
|
||||||
int ctrl_idx;
|
int ctrl_idx;
|
||||||
if (FindTab(wnd, &ctrl, &ctrl_idx))
|
if (FindTab(wnd, &ctrl, &ctrl_idx))
|
||||||
@@ -2662,8 +2671,6 @@ size_t wxAuiNotebook::SetSelection(size_t new_page)
|
|||||||
DoSizing();
|
DoSizing();
|
||||||
ctrl->DoShowHide();
|
ctrl->DoShowHide();
|
||||||
|
|
||||||
int old_curpage = m_curpage;
|
|
||||||
m_curpage = new_page;
|
|
||||||
|
|
||||||
|
|
||||||
// set fonts
|
// set fonts
|
||||||
|
Reference in New Issue
Block a user