]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/auibook.cpp
Sizing fixes for generic control.
[wxWidgets.git] / src / aui / auibook.cpp
index e99cbd7822d8ec2107bbc8e9e41b7a21b403ab39..0df4995c4fc167b2b9f2c7305b47695516ef1abb 100644 (file)
@@ -42,7 +42,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION)
 
 
-
+IMPLEMENT_CLASS(wxAuiNotebook, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxEvent)
 
 
@@ -103,9 +103,9 @@ static void DrawButtonS(wxDC& dc,
 
 
 
-// -- wxDefaultTabArt class implementation --
+// -- wxAuiDefaultTabArt class implementation --
 
-wxDefaultTabArt::wxDefaultTabArt()
+wxAuiDefaultTabArt::wxAuiDefaultTabArt()
 {
     m_normal_font = *wxNORMAL_FONT;
     m_selected_font = *wxNORMAL_FONT;
@@ -162,11 +162,11 @@ wxDefaultTabArt::wxDefaultTabArt()
     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
@@ -189,12 +189,13 @@ void wxDefaultTabArt::DrawBackground(wxDC* dc,
 // 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;
@@ -213,7 +214,7 @@ void wxDefaultTabArt::DrawTab(wxDC* dc,
     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;
@@ -269,7 +270,7 @@ void wxDefaultTabArt::DrawTab(wxDC* dc,
     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);
@@ -287,7 +288,7 @@ void wxDefaultTabArt::DrawTab(wxDC* dc,
 
 
     // draw close button if necessary
-    if (with_close_button)
+    if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
     {
         wxBitmap bmp;
         if (active)
@@ -295,20 +296,24 @@ void wxDefaultTabArt::DrawTab(wxDC* dc,
              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;
@@ -319,7 +324,7 @@ wxSize wxDefaultTabArt::GetTabSize(wxDC* dc,
     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;
@@ -328,7 +333,7 @@ wxSize wxDefaultTabArt::GetTabSize(wxDC* dc,
 }
 
 
-void wxDefaultTabArt::DrawButton(
+void wxAuiDefaultTabArt::DrawButton(
                  wxDC* dc,
                  const wxRect& in_rect,
                  int bitmap_id,
@@ -396,26 +401,26 @@ void wxDefaultTabArt::DrawButton(
 
 
 
-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;
 }
@@ -442,7 +447,7 @@ wxAuiTabContainer::wxAuiTabContainer()
 {
     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);      
@@ -454,13 +459,13 @@ wxAuiTabContainer::~wxAuiTabContainer()
     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;
 }
@@ -468,6 +473,13 @@ wxTabArt* wxAuiTabContainer::GetArtProvider()
 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
@@ -664,6 +676,22 @@ void wxAuiTabContainer::AddButton(int id,
     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;
@@ -708,7 +736,13 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
         
     
         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;
@@ -846,6 +880,23 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
                  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
 
@@ -861,6 +912,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
     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;
@@ -868,6 +920,16 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
             ((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;
@@ -876,8 +938,9 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
                 rect,
                 page.caption,
                 page.active,
-                close_button,
+                tab_button.cur_state,
                 &page.rect,
+                &tab_button.rect,
                 &x_extent);
 
         if (page.active)
@@ -885,7 +948,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
             active = i;
             active_offset = offset;
         }
-
+        
         offset += x_extent;
     }
 
@@ -894,6 +957,8 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
     {
         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 ||
@@ -907,8 +972,9 @@ void wxAuiTabContainer::Render(wxDC* raw_dc)
                 rect,
                 page.caption,
                 page.active,
-                close_button,
+                tab_button.cur_state,
                 &page.rect,
+                &tab_button.rect,
                 &x_extent);
     }
 
@@ -928,8 +994,12 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const
     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();
 
@@ -955,8 +1025,10 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y,
     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);
@@ -967,20 +1039,32 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y,
             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
@@ -1303,9 +1387,9 @@ public:
             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();
             }
         }
@@ -1336,31 +1420,31 @@ public:
 
 
 
-// -- 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;
@@ -1368,7 +1452,7 @@ wxAuiMultiNotebook::wxAuiMultiNotebook()
     m_tab_ctrl_height = 20;
 }
 
-wxAuiMultiNotebook::wxAuiMultiNotebook(wxWindow *parent,
+wxAuiNotebook::wxAuiNotebook(wxWindow *parent,
                              wxWindowID id,
                              const wxPoint& pos,
                              const wxSize& size,
@@ -1377,7 +1461,7 @@ wxAuiMultiNotebook::wxAuiMultiNotebook(wxWindow *parent,
     InitNotebook(style);
 }
 
-bool wxAuiMultiNotebook::Create(wxWindow* parent,
+bool wxAuiNotebook::Create(wxWindow* parent,
                            wxWindowID id,
                            const wxPoint& pos,
                            const wxSize& size,
@@ -1393,7 +1477,7 @@ bool wxAuiMultiNotebook::Create(wxWindow* parent,
 
 // 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;
@@ -1415,27 +1499,54 @@ void wxAuiMultiNotebook::InitNotebook(long style)
     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)
@@ -1443,7 +1554,7 @@ bool wxAuiMultiNotebook::AddPage(wxWindow* page,
     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,
@@ -1474,7 +1585,7 @@ bool wxAuiMultiNotebook::InsertPage(size_t page_idx,
     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);
     }
@@ -1485,7 +1596,7 @@ bool wxAuiMultiNotebook::InsertPage(size_t page_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;
@@ -1529,7 +1640,7 @@ bool wxAuiMultiNotebook::DeletePage(size_t page_idx)
     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
@@ -1557,7 +1668,7 @@ bool wxAuiMultiNotebook::DeletePage(size_t page_idx)
 
 // 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);
@@ -1577,7 +1688,7 @@ bool wxAuiMultiNotebook::RemovePage(size_t 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;
@@ -1601,13 +1712,13 @@ bool wxAuiMultiNotebook::SetPageText(size_t page_idx, const wxString& text)
 }
 
 // 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)
@@ -1640,11 +1751,11 @@ size_t wxAuiMultiNotebook::SetSelection(size_t new_page)
 
 
             // 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;
@@ -1666,14 +1777,14 @@ size_t wxAuiMultiNotebook::SetSelection(size_t new_page)
 
 // 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());
 
@@ -1681,9 +1792,9 @@ wxWindow* wxAuiMultiNotebook::GetPage(size_t page_idx) const
 }
 
 // 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)
     {
@@ -1697,7 +1808,7 @@ void wxAuiMultiNotebook::DoSizing()
 
 // 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())
     {
@@ -1713,7 +1824,7 @@ wxAuiTabCtrl* wxAuiMultiNotebook::GetActiveTabCtrl()
     }
 
     // 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)
     {
@@ -1734,7 +1845,7 @@ wxAuiTabCtrl* wxAuiMultiNotebook::GetActiveTabCtrl()
                                         wxNO_BORDER);
     tabframe->m_tabs->SetFlags(m_flags);
     m_mgr.AddPane(tabframe,
-                  wxPaneInfo().Center().CaptionVisible(false));
+                  wxAuiPaneInfo().Center().CaptionVisible(false));
 
     m_mgr.Update();
 
@@ -1744,9 +1855,9 @@ wxAuiTabCtrl* wxAuiMultiNotebook::GetActiveTabCtrl()
 // 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)
     {
@@ -1768,15 +1879,15 @@ bool wxAuiMultiNotebook::FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx)
 }
 
 
-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;
 
@@ -1792,12 +1903,12 @@ void wxAuiMultiNotebook::OnTabClicked(wxCommandEvent& 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);
@@ -1808,8 +1919,19 @@ void wxAuiMultiNotebook::OnTabDragMotion(wxCommandEvent& evt)
     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;
@@ -1842,6 +1964,20 @@ void wxAuiMultiNotebook::OnTabDragMotion(wxCommandEvent& evt)
         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();
@@ -1856,20 +1992,31 @@ void wxAuiMultiNotebook::OnTabDragMotion(wxCommandEvent& evt)
 
 
 
-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;
 
 
@@ -1906,7 +2053,7 @@ void wxAuiMultiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
         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;
@@ -1944,11 +2091,13 @@ void wxAuiMultiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
     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)
     {
@@ -1963,11 +2112,11 @@ wxAuiTabCtrl* wxAuiMultiNotebook::GetTabCtrlFromPoint(const wxPoint& pt)
     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)
     {
@@ -1984,11 +2133,11 @@ wxWindow* wxAuiMultiNotebook::GetTabFrameFromTabCtrl(wxWindow* tab_ctrl)
     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)
     {
@@ -2013,7 +2162,7 @@ void wxAuiMultiNotebook::RemoveEmptyTabFrames()
 
     // 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;
@@ -2035,7 +2184,7 @@ void wxAuiMultiNotebook::RemoveEmptyTabFrames()
     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)
@@ -2045,7 +2194,7 @@ void wxAuiMultiNotebook::OnChildFocus(wxChildFocusEvent& evt)
 }
 
 
-void wxAuiMultiNotebook::OnTabButton(wxCommandEvent& command_evt)
+void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt)
 {
     wxAuiNotebookEvent& evt = (wxAuiNotebookEvent&)command_evt;
     wxAuiTabCtrl* tabs = (wxAuiTabCtrl*)evt.GetEventObject();
@@ -2060,7 +2209,7 @@ void wxAuiMultiNotebook::OnTabButton(wxCommandEvent& command_evt)
         {
             wxWindow* close_wnd = tabs->GetWindowFromIdx(selection);
 
-            if (close_wnd->IsKindOf(CLASSINFO(wxTabMDIChildFrame)))
+            if (close_wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
             {
                 close_wnd->Close();
             }