int left_buttons_width = 0;
int right_buttons_width = 0;
- int offset = 0;
-
// draw the buttons on the right side
- offset = m_rect.x + m_rect.width;
+ int offset = m_rect.x + m_rect.width;
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_buttons.Item(button_count - i - 1);
int left_buttons_width = 0;
int right_buttons_width = 0;
- int offset = 0;
-
// calculate size of the buttons on the right side
- offset = m_rect.x + m_rect.width;
+ int offset = m_rect.x + m_rect.width;
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_buttons.Item(button_count - i - 1);
static void ShowWnd(wxWindow* wnd, bool show)
{
#if wxUSE_MDI
- if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+ if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
{
wxAuiMDIChildFrame* cf = (wxAuiMDIChildFrame*)wnd;
cf->DoShow(show);
// even if the tab is already active, because they may
// have multiple tab controls
if ((new_selection != GetActivePage() ||
- GetParent()->IsKindOf(CLASSINFO(wxAuiNotebook))) && !m_hoverButton)
+ wxDynamicCast(GetParent(), wxAuiNotebook)) && !m_hoverButton)
{
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
e.SetSelection(new_selection);
{
m_isDragging = false;
- wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, m_windowId);
- evt.SetSelection(GetIdxFromWindow(m_clickTab));
- evt.SetOldSelection(evt.GetSelection());
- evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, m_windowId);
+ e.SetSelection(GetIdxFromWindow(m_clickTab));
+ e.SetOldSelection(e.GetSelection());
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
return;
}
if (!(m_pressedButton->curState & wxAUI_BUTTON_STATE_DISABLED))
{
- wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
- evt.SetSelection(GetIdxFromWindow(m_clickTab));
- evt.SetInt(m_pressedButton->id);
- evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
+ e.SetSelection(GetIdxFromWindow(m_clickTab));
+ e.SetInt(m_pressedButton->id);
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
}
m_pressedButton = NULL;
}
}
- wxWindow* wnd = NULL;
-
#if wxUSE_TOOLTIPS
- if (evt.Moving() && TabHitTest(evt.m_x, evt.m_y, &wnd))
+ wxWindow* wnd = NULL;
+ if (evt.Moving() && TabHitTest(evt.m_x, evt.m_y, &wnd))
{
wxString tooltip(m_pages[GetIdxFromWindow(wnd)].tooltip);
}
else
UnsetToolTip();
-#endif
-
+#endif // wxUSE_TOOLTIPS
+
if (!evt.LeftIsDown() || m_clickPt == wxDefaultPosition)
return;
if (m_isDragging)
{
- wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, m_windowId);
- evt.SetSelection(GetIdxFromWindow(m_clickTab));
- evt.SetOldSelection(evt.GetSelection());
- evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, m_windowId);
+ e.SetSelection(GetIdxFromWindow(m_clickTab));
+ e.SetOldSelection(e.GetSelection());
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
return;
}
if (abs(pos.x - m_clickPt.x) > drag_x_threshold ||
abs(pos.y - m_clickPt.y) > drag_y_threshold)
{
- wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, m_windowId);
- evt.SetSelection(GetIdxFromWindow(m_clickTab));
- evt.SetOldSelection(evt.GetSelection());
- evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, m_windowId);
+ e.SetSelection(GetIdxFromWindow(m_clickTab));
+ e.SetOldSelection(e.GetSelection());
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
m_isDragging = true;
}
for (i = 0; i < page_count; ++i)
{
- int height = m_rect.height - m_tabCtrlHeight;
+ wxAuiNotebookPage& page = pages.Item(i);
+ int border_space = m_tabs->GetArtProvider()->GetAdditionalBorderSpace(page.window);
+
+ int height = m_rect.height - m_tabCtrlHeight - border_space;
if ( height < 0 )
{
// avoid passing negative height to wxWindow::SetSize(), this
height = 0;
}
- wxAuiNotebookPage& page = pages.Item(i);
if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM)
{
- page.window->SetSize(m_rect.x, m_rect.y, m_rect.width, height);
+ page.window->SetSize(m_rect.x + border_space,
+ m_rect.y + border_space,
+ m_rect.width - 2 * border_space,
+ height);
}
else //TODO: if (GetFlags() & wxAUI_NB_TOP)
{
- page.window->SetSize(m_rect.x, m_rect.y + m_tabCtrlHeight,
- m_rect.width, height);
+ page.window->SetSize(m_rect.x + border_space,
+ m_rect.y + m_tabCtrlHeight,
+ m_rect.width - 2 * border_space,
+ height);
}
// TODO: else if (GetFlags() & wxAUI_NB_LEFT){}
// TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
#if wxUSE_MDI
- if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+ if (wxDynamicCast(page.window, wxAuiMDIChildFrame))
{
wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window;
wnd->ApplyMDIChildFrameRect();
#if wxUSE_MDI
// actually destroy the window now
- if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+ if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
{
// delete the child frame with pending delete, as is
// customary with frame windows
SetSelectionToWindow(wnd);
}
-void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& WXUNUSED(evt))
+void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& evt)
{
+ // select the tab ctrl which received the db click
+ int selection;
+ wxWindow* wnd;
+ wxAuiTabCtrl* ctrl = (wxAuiTabCtrl*)evt.GetEventObject();
+ if ( (ctrl != NULL)
+ && ((selection = ctrl->GetActivePage()) != wxNOT_FOUND)
+ && ((wnd = ctrl->GetWindowFromIdx(selection)) != NULL))
+ {
+ SetSelectionToWindow(wnd);
+ }
+
// notify owner that the tabbar background has been double-clicked
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, m_windowId);
e.SetEventObject(this);
wxWindow* src_tab = dest_tabs->GetWindowFromIdx(src_idx);
dest_tabs->MovePage(src_tab, dest_idx);
+ m_tabs.MovePage(m_tabs.GetPage(src_idx).window, dest_idx);
dest_tabs->SetActivePage((size_t)dest_idx);
dest_tabs->DoShowHide();
dest_tabs->Refresh();
return;
// make sure we are not over the hint window
- if (!tab_ctrl->IsKindOf(CLASSINFO(wxFrame)))
+ if (!wxDynamicCast(tab_ctrl, wxFrame))
{
while (tab_ctrl)
{
- if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
+ if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
break;
tab_ctrl = tab_ctrl->GetParent();
}
while (tab_ctrl)
{
- if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
+ if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
break;
tab_ctrl = tab_ctrl->GetParent();
}
if (insert_idx == -1)
insert_idx = dest_tabs->GetPageCount();
dest_tabs->InsertPage(page_info.window, page_info, insert_idx);
- nb->m_tabs.AddPage(page_info.window, page_info);
+ nb->m_tabs.InsertPage(page_info.window, page_info, insert_idx);
nb->DoSizing();
dest_tabs->DoShowHide();
#if wxUSE_MDI
- if (close_wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+ if (wxDynamicCast(close_wnd, wxAuiMDIChildFrame))
{
close_wnd->Close();
}