DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION)
-
+IMPLEMENT_CLASS(wxAuiNotebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxEvent)
-// -- wxDefaultTabArt class implementation --
+// -- wxAuiDefaultTabArt class implementation --
-wxDefaultTabArt::wxDefaultTabArt()
+wxAuiDefaultTabArt::wxAuiDefaultTabArt()
{
m_normal_font = *wxNORMAL_FONT;
m_selected_font = *wxNORMAL_FONT;
m_disabled_right_bmp = BitmapFromBits(right_bits, 16, 16, wxColour(128,128,128));
}
-wxDefaultTabArt::~wxDefaultTabArt()
+wxAuiDefaultTabArt::~wxAuiDefaultTabArt()
{
}
-void wxDefaultTabArt::DrawBackground(wxDC* dc,
+void wxAuiDefaultTabArt::DrawBackground(wxDC* dc,
const wxRect& rect)
{
// draw background
// out_rect - actual output rectangle
// x_extent - the advance x; where the next tab should start
-void wxDefaultTabArt::DrawTab(wxDC* dc,
+void wxAuiDefaultTabArt::DrawTab(wxDC* dc,
const wxRect& in_rect,
const wxString& caption_text,
bool active,
- bool with_close_button,
- wxRect* out_rect,
+ int close_button_state,
+ wxRect* out_tab_rect,
+ wxRect* out_button_rect,
int* x_extent)
{
wxCoord normal_textx, normal_texty;
dc->GetTextExtent(caption, &normal_textx, &normal_texty);
// figure out the size of the tab
- wxSize tab_size = GetTabSize(dc, caption, active, with_close_button, x_extent);
+ wxSize tab_size = GetTabSize(dc, caption, active, close_button_state, x_extent);
wxCoord tab_height = tab_size.y;
wxCoord tab_width = tab_size.x;
int text_offset;
int close_button_width = 0;
- if (with_close_button)
+ if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
{
close_button_width = m_active_close_bmp.GetWidth();
text_offset = tab_x + (tab_height/2) + ((tab_width-close_button_width)/2) - (textx/2);
// draw close button if necessary
- if (with_close_button)
+ if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
{
wxBitmap bmp;
if (active)
else
bmp = m_disabled_close_bmp;
- wxRect rect(tab_x + tab_width - close_button_width - 1, tab_y + 1,
- close_button_width, tab_height - 1);
- DrawButtonS(*dc, rect, bmp, *wxWHITE, wxAUI_BUTTON_STATE_NORMAL);
+ wxRect rect(tab_x + tab_width - close_button_width - 1,
+ tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1,
+ close_button_width,
+ tab_height - 1);
+ DrawButtonS(*dc, rect, bmp, *wxWHITE, close_button_state);
+
+ *out_button_rect = rect;
}
- *out_rect = wxRect(tab_x, tab_y, tab_width, tab_height);
+ *out_tab_rect = wxRect(tab_x, tab_y, tab_width, tab_height);
}
-wxSize wxDefaultTabArt::GetTabSize(wxDC* dc,
+wxSize wxAuiDefaultTabArt::GetTabSize(wxDC* dc,
const wxString& caption,
bool WXUNUSED(active),
- bool with_close_button,
+ int close_button_state,
int* x_extent)
{
wxCoord measured_textx, measured_texty;
wxCoord tab_height = measured_texty + 4;
wxCoord tab_width = measured_textx + tab_height + 5;
- if (with_close_button)
+ if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
tab_width += m_active_close_bmp.GetWidth();
*x_extent = tab_width - (tab_height/2) - 1;
}
-void wxDefaultTabArt::DrawButton(
+void wxAuiDefaultTabArt::DrawButton(
wxDC* dc,
const wxRect& in_rect,
int bitmap_id,
-int wxDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd)
+int wxAuiDefaultTabArt::GetBestTabCtrlSize(wxWindow* wnd)
{
wxClientDC dc(wnd);
dc.SetFont(m_measuring_font);
int x_ext = 0;
- wxSize s = GetTabSize(&dc, wxT("ABCDEFGHIj"), true, false, &x_ext);
+ wxSize s = GetTabSize(&dc, wxT("ABCDEFGHIj"), true, wxAUI_BUTTON_STATE_HIDDEN, &x_ext);
return s.y+3;
}
-void wxDefaultTabArt::SetNormalFont(const wxFont& font)
+void wxAuiDefaultTabArt::SetNormalFont(const wxFont& font)
{
m_normal_font = font;
}
-void wxDefaultTabArt::SetSelectedFont(const wxFont& font)
+void wxAuiDefaultTabArt::SetSelectedFont(const wxFont& font)
{
m_selected_font = font;
}
-void wxDefaultTabArt::SetMeasuringFont(const wxFont& font)
+void wxAuiDefaultTabArt::SetMeasuringFont(const wxFont& font)
{
m_measuring_font = font;
}
{
m_tab_offset = 0;
m_flags = 0;
- m_art = new wxDefaultTabArt;
+ m_art = new wxAuiDefaultTabArt;
AddButton(wxAUI_BUTTON_LEFT, wxLEFT);
AddButton(wxAUI_BUTTON_RIGHT, wxRIGHT);
delete m_art;
}
-void wxAuiTabContainer::SetArtProvider(wxTabArt* art)
+void wxAuiTabContainer::SetArtProvider(wxAuiTabArt* art)
{
delete m_art;
m_art = art;
}
-wxTabArt* wxAuiTabContainer::GetArtProvider()
+wxAuiTabArt* wxAuiTabContainer::GetArtProvider()
{
return m_art;
}
void wxAuiTabContainer::SetFlags(unsigned int flags)
{
m_flags = flags;
+
+ // check for new close button settings
+ RemoveButton(wxAUI_BUTTON_CLOSE);
+ if (flags & wxAUI_NB_CLOSE_BUTTON)
+ {
+ AddButton(wxAUI_BUTTON_CLOSE, wxRIGHT);
+ }
}
unsigned int wxAuiTabContainer::GetFlags() const
m_buttons.Add(button);
}
+void wxAuiTabContainer::RemoveButton(int id)
+{
+ size_t i, button_count = m_buttons.GetCount();
+
+ for (i = 0; i < button_count; ++i)
+ {
+ if (m_buttons.Item(i).id == id)
+ {
+ m_buttons.RemoveAt(i);
+ return;
+ }
+ }
+}
+
+
+
size_t wxAuiTabContainer::GetTabOffset() const
{
return m_tab_offset;
int x_extent = 0;
- wxSize size = m_art->GetTabSize(&dc, page.caption, page.active, close_button, &x_extent);
+ wxSize size = m_art->GetTabSize(&dc,
+ page.caption,
+ page.active,
+ close_button ?
+ wxAUI_BUTTON_STATE_NORMAL :
+ wxAUI_BUTTON_STATE_HIDDEN,
+ &x_extent);
if (i+1 < page_count)
total_width += x_extent;
m_rect.GetHeight());
+
+ // prepare the tab-close-button array
+ while (m_tab_close_buttons.GetCount() < page_count)
+ {
+ wxAuiTabContainerButton tempbtn;
+ tempbtn.id = wxAUI_BUTTON_CLOSE;
+ tempbtn.location = wxCENTER;
+ tempbtn.cur_state = wxAUI_BUTTON_STATE_HIDDEN;
+ m_tab_close_buttons.Add(tempbtn);
+ }
+
+ for (i = 0; i < m_tab_offset; ++i)
+ {
+ // buttons before the tab offset must be set to hidden
+ m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN;
+ }
+
// draw the tabs
for (i = m_tab_offset; i < page_count; ++i)
{
wxAuiNotebookPage& page = m_pages.Item(i);
+ wxAuiTabContainerButton& tab_button = m_tab_close_buttons.Item(i);
// determine if a close button is on this tab
bool close_button = false;
((m_flags & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0 && page.active))
{
close_button = true;
+ if (tab_button.cur_state == wxAUI_BUTTON_STATE_HIDDEN)
+ {
+ tab_button.id = wxAUI_BUTTON_CLOSE;
+ tab_button.cur_state = wxAUI_BUTTON_STATE_NORMAL;
+ tab_button.location = wxCENTER;
+ }
+ }
+ else
+ {
+ tab_button.cur_state = wxAUI_BUTTON_STATE_HIDDEN;
}
rect.x = offset;
rect,
page.caption,
page.active,
- close_button,
+ tab_button.cur_state,
&page.rect,
+ &tab_button.rect,
&x_extent);
if (page.active)
active = i;
active_offset = offset;
}
-
+
offset += x_extent;
}
{
wxAuiNotebookPage& page = m_pages.Item(active);
+ wxAuiTabContainerButton& tab_button = m_tab_close_buttons.Item(active);
+
// determine if a close button is on this tab
bool close_button = false;
if ((m_flags & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0 ||
rect,
page.caption,
page.active,
- close_button,
+ tab_button.cur_state,
&page.rect,
+ &tab_button.rect,
&x_extent);
}
if (!m_rect.Contains(x,y))
return false;
- if (ButtonHitTest(x, y, NULL))
- return false;
+ wxAuiTabContainerButton* btn = NULL;
+ if (ButtonHitTest(x, y, &btn))
+ {
+ if (m_buttons.Index(*btn) != wxNOT_FOUND)
+ return false;
+ }
size_t i, page_count = m_pages.GetCount();
if (!m_rect.Contains(x,y))
return false;
- size_t i, button_count = m_buttons.GetCount();
-
+ size_t i, button_count;
+
+
+ button_count = m_buttons.GetCount();
for (i = 0; i < button_count; ++i)
{
wxAuiTabContainerButton& button = m_buttons.Item(i);
return true;
}
}
-
+
+ button_count = m_tab_close_buttons.GetCount();
+ for (i = 0; i < button_count; ++i)
+ {
+ wxAuiTabContainerButton& button = m_tab_close_buttons.Item(i);
+ if (button.rect.Contains(x,y))
+ {
+ if (hit)
+ *hit = &button;
+ return true;
+ }
+ }
+
return false;
}
// the utility function ShowWnd() is the same as show,
-// except it handles wxTabMDIChildFrame windows as well,
+// except it handles wxAuiMDIChildFrame windows as well,
// as the Show() method on this class is "unplugged"
static void ShowWnd(wxWindow* wnd, bool show)
{
- if (wnd->IsKindOf(CLASSINFO(wxTabMDIChildFrame)))
+ if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
{
- wxTabMDIChildFrame* cf = (wxTabMDIChildFrame*)wnd;
+ wxAuiMDIChildFrame* cf = (wxAuiMDIChildFrame*)wnd;
cf->DoShow(show);
}
else
wxAuiNotebookPage& page = pages.Item(i);
page.window->SetSize(m_rect.x, m_rect.y+tab_height, m_rect.width, m_rect.height-tab_height);
- if (page.window->IsKindOf(CLASSINFO(wxTabMDIChildFrame)))
+ if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
{
- wxTabMDIChildFrame* wnd = (wxTabMDIChildFrame*)page.window;
+ wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window;
wnd->ApplyMDIChildFrameRect();
}
}
-// -- wxAuiMultiNotebook class implementation --
+// -- wxAuiNotebook class implementation --
-BEGIN_EVENT_TABLE(wxAuiMultiNotebook, wxControl)
- //EVT_ERASE_BACKGROUND(wxAuiMultiNotebook::OnEraseBackground)
- //EVT_SIZE(wxAuiMultiNotebook::OnSize)
- //EVT_LEFT_DOWN(wxAuiMultiNotebook::OnLeftDown)
- EVT_CHILD_FOCUS(wxAuiMultiNotebook::OnChildFocus)
+BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl)
+ //EVT_ERASE_BACKGROUND(wxAuiNotebook::OnEraseBackground)
+ //EVT_SIZE(wxAuiNotebook::OnSize)
+ //EVT_LEFT_DOWN(wxAuiNotebook::OnLeftDown)
+ EVT_CHILD_FOCUS(wxAuiNotebook::OnChildFocus)
EVT_COMMAND_RANGE(10000, 10100,
wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING,
- wxAuiMultiNotebook::OnTabClicked)
+ wxAuiNotebook::OnTabClicked)
EVT_COMMAND_RANGE(10000, 10100,
wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG,
- wxAuiMultiNotebook::OnTabBeginDrag)
+ wxAuiNotebook::OnTabBeginDrag)
EVT_COMMAND_RANGE(10000, 10100,
wxEVT_COMMAND_AUINOTEBOOK_END_DRAG,
- wxAuiMultiNotebook::OnTabEndDrag)
+ wxAuiNotebook::OnTabEndDrag)
EVT_COMMAND_RANGE(10000, 10100,
wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION,
- wxAuiMultiNotebook::OnTabDragMotion)
+ wxAuiNotebook::OnTabDragMotion)
EVT_COMMAND_RANGE(10000, 10100,
wxEVT_COMMAND_AUINOTEBOOK_BUTTON,
- wxAuiMultiNotebook::OnTabButton)
+ wxAuiNotebook::OnTabButton)
END_EVENT_TABLE()
-wxAuiMultiNotebook::wxAuiMultiNotebook()
+wxAuiNotebook::wxAuiNotebook()
{
m_curpage = -1;
m_tab_id_counter = 10000;
m_tab_ctrl_height = 20;
}
-wxAuiMultiNotebook::wxAuiMultiNotebook(wxWindow *parent,
+wxAuiNotebook::wxAuiNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
InitNotebook(style);
}
-bool wxAuiMultiNotebook::Create(wxWindow* parent,
+bool wxAuiNotebook::Create(wxWindow* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
// InitNotebook() contains common initialization
// code called by all constructors
-void wxAuiMultiNotebook::InitNotebook(long style)
+void wxAuiNotebook::InitNotebook(long style)
{
m_curpage = -1;
m_tab_id_counter = 10000;
m_mgr.SetManagedWindow(this);
m_mgr.AddPane(m_dummy_wnd,
- wxPaneInfo().Name(wxT("dummy")).Bottom().Show(false));
+ wxAuiPaneInfo().Name(wxT("dummy")).Bottom().Show(false));
m_mgr.Update();
}
-wxAuiMultiNotebook::~wxAuiMultiNotebook()
+wxAuiNotebook::~wxAuiNotebook()
{
m_mgr.UnInit();
}
-void wxAuiMultiNotebook::SetArtProvider(wxTabArt* art)
+void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art)
{
m_tabs.SetArtProvider(art);
}
-wxTabArt* wxAuiMultiNotebook::GetArtProvider()
+wxAuiTabArt* wxAuiNotebook::GetArtProvider()
{
return m_tabs.GetArtProvider();
}
-bool wxAuiMultiNotebook::AddPage(wxWindow* page,
+void wxAuiNotebook::SetWindowStyleFlag(long style)
+{
+ wxControl::SetWindowStyleFlag(style);
+
+ m_flags = (unsigned int)style;
+
+ // if the control is already initialized
+ if (m_mgr.GetManagedWindow() == (wxWindow*)this)
+ {
+ // let all of the tab children know about the new style
+
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ size_t i, pane_count = all_panes.GetCount();
+ for (i = 0; i < pane_count; ++i)
+ {
+ wxAuiPaneInfo& pane = all_panes.Item(i);
+ if (pane.name == wxT("dummy"))
+ continue;
+ wxAuiTabCtrl* tabctrl = ((wxTabFrame*)pane.window)->m_tabs;
+ tabctrl->SetFlags(m_flags);
+ tabctrl->Refresh();
+ tabctrl->Update();
+ }
+ }
+}
+
+
+bool wxAuiNotebook::AddPage(wxWindow* page,
const wxString& caption,
bool select,
const wxBitmap& bitmap)
return InsertPage(GetPageCount(), page, caption, select, bitmap);
}
-bool wxAuiMultiNotebook::InsertPage(size_t page_idx,
+bool wxAuiNotebook::InsertPage(size_t page_idx,
wxWindow* page,
const wxString& caption,
bool select,
if (select)
{
int idx = m_tabs.GetIdxFromWindow(page);
- wxASSERT_MSG(idx != -1, wxT("Invalid Page index returned on wxAuiMultiNotebook::InsertPage()"));
+ wxASSERT_MSG(idx != -1, wxT("Invalid Page index returned on wxAuiNotebook::InsertPage()"));
SetSelection(idx);
}
// DeletePage() removes a tab from the multi-notebook,
// and destroys the window as well
-bool wxAuiMultiNotebook::DeletePage(size_t page_idx)
+bool wxAuiNotebook::DeletePage(size_t page_idx)
{
wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx);
wxWindow* new_active = NULL;
ctrl->RemovePage(wnd);
// actually destroy the window now
- if (wnd->IsKindOf(CLASSINFO(wxTabMDIChildFrame)))
+ if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
{
// delete the child frame with pending delete, as is
// customary with frame windows
// RemovePage() removes a tab from the multi-notebook,
// but does not destroy the window
-bool wxAuiMultiNotebook::RemovePage(size_t page_idx)
+bool wxAuiNotebook::RemovePage(size_t page_idx)
{
// remove the tab from our own catalog
wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx);
}
// SetPageText() changes the tab caption of the specified page
-bool wxAuiMultiNotebook::SetPageText(size_t page_idx, const wxString& text)
+bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text)
{
if (page_idx >= m_tabs.GetPageCount())
return false;
}
// GetSelection() returns the index of the currently active page
-int wxAuiMultiNotebook::GetSelection() const
+int wxAuiNotebook::GetSelection() const
{
return m_curpage;
}
// SetSelection() sets the currently active page
-size_t wxAuiMultiNotebook::SetSelection(size_t new_page)
+size_t wxAuiNotebook::SetSelection(size_t new_page)
{
wxWindow* wnd = m_tabs.GetWindowFromIdx(new_page);
if (!wnd)
// set fonts
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
- wxPaneInfo& pane = all_panes.Item(i);
+ wxAuiPaneInfo& pane = all_panes.Item(i);
if (pane.name == wxT("dummy"))
continue;
wxAuiTabCtrl* tabctrl = ((wxTabFrame*)pane.window)->m_tabs;
// GetPageCount() returns the total number of
// pages managed by the multi-notebook
-size_t wxAuiMultiNotebook::GetPageCount() const
+size_t wxAuiNotebook::GetPageCount() const
{
return m_tabs.GetPageCount();
}
// GetPage() returns the wxWindow pointer of the
// specified page
-wxWindow* wxAuiMultiNotebook::GetPage(size_t page_idx) const
+wxWindow* wxAuiNotebook::GetPage(size_t page_idx) const
{
wxASSERT(page_idx < m_tabs.GetPageCount());
}
// DoSizing() performs all sizing operations in each tab control
-void wxAuiMultiNotebook::DoSizing()
+void wxAuiNotebook::DoSizing()
{
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
// GetActiveTabCtrl() returns the active tab control. It is
// called to determine which control gets new windows being added
-wxAuiTabCtrl* wxAuiMultiNotebook::GetActiveTabCtrl()
+wxAuiTabCtrl* wxAuiNotebook::GetActiveTabCtrl()
{
if (m_curpage >= 0 && m_curpage < (int)m_tabs.GetPageCount())
{
}
// no current page, just find the first tab ctrl
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
wxNO_BORDER);
tabframe->m_tabs->SetFlags(m_flags);
m_mgr.AddPane(tabframe,
- wxPaneInfo().Center().CaptionVisible(false));
+ wxAuiPaneInfo().Center().CaptionVisible(false));
m_mgr.Update();
// FindTab() finds the tab control that currently contains the window as well
// as the index of the window in the tab control. It returns true if the
// window was found, otherwise false.
-bool wxAuiMultiNotebook::FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx)
+bool wxAuiNotebook::FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx)
{
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
}
-void wxAuiMultiNotebook::OnEraseBackground(wxEraseEvent&)
+void wxAuiNotebook::OnEraseBackground(wxEraseEvent&)
{
}
-void wxAuiMultiNotebook::OnSize(wxSizeEvent&)
+void wxAuiNotebook::OnSize(wxSizeEvent&)
{
}
-void wxAuiMultiNotebook::OnTabClicked(wxCommandEvent& command_evt)
+void wxAuiNotebook::OnTabClicked(wxCommandEvent& command_evt)
{
wxAuiNotebookEvent& evt = (wxAuiNotebookEvent&)command_evt;
SetSelection(idx);
}
-void wxAuiMultiNotebook::OnTabBeginDrag(wxCommandEvent&)
+void wxAuiNotebook::OnTabBeginDrag(wxCommandEvent&)
{
m_last_drag_x = 0;
}
-void wxAuiMultiNotebook::OnTabDragMotion(wxCommandEvent& evt)
+void wxAuiNotebook::OnTabDragMotion(wxCommandEvent& evt)
{
wxPoint screen_pt = ::wxGetMousePosition();
wxPoint client_pt = ScreenToClient(screen_pt);
wxAuiTabCtrl* dest_tabs = GetTabCtrlFromPoint(client_pt);
if (dest_tabs == src_tabs)
{
+ if (src_tabs)
+ {
+ src_tabs->SetCursor(wxCursor(wxCURSOR_ARROW));
+ }
+
// always hide the hint for inner-tabctrl drag
m_mgr.HideHint();
+
+ // if tab moving is not allowed, leave
+ if (!(m_flags & wxAUI_NB_TAB_MOVE))
+ {
+ return;
+ }
wxPoint pt = dest_tabs->ScreenToClient(screen_pt);
wxWindow* dest_location_tab;
return;
}
+
+ // if tab moving is not allowed, leave
+ if (!(m_flags & wxAUI_NB_TAB_SPLIT))
+ {
+ return;
+ }
+
+
+ if (src_tabs)
+ {
+ src_tabs->SetCursor(wxCursor(wxCURSOR_SIZING));
+ }
+
+
if (dest_tabs)
{
wxRect hint_rect = dest_tabs->GetRect();
-void wxAuiMultiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
+void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
{
wxAuiNotebookEvent& evt = (wxAuiNotebookEvent&)command_evt;
m_mgr.HideHint();
-
+ // if tab moving is not allowed, leave
+ if (!(m_flags & wxAUI_NB_TAB_SPLIT))
+ {
+ return;
+ }
+
+ // set cursor back to an arrow
+ wxAuiTabCtrl* src_tabs = (wxAuiTabCtrl*)evt.GetEventObject();
+ if (src_tabs)
+ {
+ src_tabs->SetCursor(wxCursor(wxCURSOR_ARROW));
+ }
+
// get the mouse position, which will be used to determine the drop point
wxPoint mouse_screen_pt = ::wxGetMousePosition();
wxPoint mouse_client_pt = ScreenToClient(mouse_screen_pt);
// the src tab control is the control that fired this event
- wxAuiTabCtrl* src_tabs = (wxAuiTabCtrl*)evt.GetEventObject();
wxAuiTabCtrl* dest_tabs = NULL;
new_tabs->m_tabs->SetFlags(m_flags);
m_mgr.AddPane(new_tabs,
- wxPaneInfo().Bottom().CaptionVisible(false),
+ wxAuiPaneInfo().Bottom().CaptionVisible(false),
mouse_client_pt);
m_mgr.Update();
dest_tabs = new_tabs->m_tabs;
SetSelection(m_tabs.GetIdxFromWindow(page_info.window));
}
-wxAuiTabCtrl* wxAuiMultiNotebook::GetTabCtrlFromPoint(const wxPoint& pt)
+
+
+wxAuiTabCtrl* wxAuiNotebook::GetTabCtrlFromPoint(const wxPoint& pt)
{
// if we've just removed the last tab from the source
// tab set, the remove the tab control completely
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
return NULL;
}
-wxWindow* wxAuiMultiNotebook::GetTabFrameFromTabCtrl(wxWindow* tab_ctrl)
+wxWindow* wxAuiNotebook::GetTabFrameFromTabCtrl(wxWindow* tab_ctrl)
{
// if we've just removed the last tab from the source
// tab set, the remove the tab control completely
- wxPaneInfoArray& all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
return NULL;
}
-void wxAuiMultiNotebook::RemoveEmptyTabFrames()
+void wxAuiNotebook::RemoveEmptyTabFrames()
{
// if we've just removed the last tab from the source
// tab set, the remove the tab control completely
- wxPaneInfoArray all_panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray all_panes = m_mgr.GetAllPanes();
size_t i, pane_count = all_panes.GetCount();
for (i = 0; i < pane_count; ++i)
{
// check to see if there is still a center pane;
// if there isn't, make a frame the center pane
- wxPaneInfoArray panes = m_mgr.GetAllPanes();
+ wxAuiPaneInfoArray panes = m_mgr.GetAllPanes();
pane_count = panes.GetCount();
wxWindow* first_good = NULL;
bool center_found = false;
m_mgr.Update();
}
-void wxAuiMultiNotebook::OnChildFocus(wxChildFocusEvent& evt)
+void wxAuiNotebook::OnChildFocus(wxChildFocusEvent& evt)
{
int idx = m_tabs.GetIdxFromWindow(evt.GetWindow());
if (idx != -1 && idx != m_curpage)
}
-void wxAuiMultiNotebook::OnTabButton(wxCommandEvent& command_evt)
+void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt)
{
wxAuiNotebookEvent& evt = (wxAuiNotebookEvent&)command_evt;
wxAuiTabCtrl* tabs = (wxAuiTabCtrl*)evt.GetEventObject();
{
wxWindow* close_wnd = tabs->GetWindowFromIdx(selection);
- if (close_wnd->IsKindOf(CLASSINFO(wxTabMDIChildFrame)))
+ if (close_wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
{
close_wnd->Close();
}