+ if (m_pages.GetCount() < 2)
+ {
+ event.Skip();
+ return;
+ }
+
+ int newPage = -1;
+
+ int forwardKey, backwardKey;
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+ forwardKey = WXK_LEFT;
+ backwardKey = WXK_RIGHT;
+ }
+ else
+ {
+ forwardKey = WXK_RIGHT;
+ backwardKey = WXK_LEFT;
+ }
+
+ if (key == forwardKey)
+ {
+ if (m_pages.GetCount() > 1)
+ {
+ if (GetActivePage() == -1)
+ newPage = 0;
+ else if (GetActivePage() < (int) (m_pages.GetCount() - 1))
+ newPage = GetActivePage() + 1;
+ }
+ }
+ else if (key == backwardKey)
+ {
+ if (m_pages.GetCount() > 1)
+ {
+ if (GetActivePage() == -1)
+ newPage = (int) (m_pages.GetCount() - 1);
+ else if (GetActivePage() > 0)
+ newPage = GetActivePage() - 1;
+ }
+ }
+ else if (key == WXK_HOME)
+ {
+ newPage = 0;
+ }
+ else if (key == WXK_END)
+ {
+ newPage = (int) (m_pages.GetCount() - 1);
+ }
+ else
+ event.Skip();
+
+ if (newPage != -1)
+ {
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
+ e.SetSelection(newPage);
+ e.SetOldSelection(newPage);
+ e.SetEventObject(this);
+ this->GetEventHandler()->ProcessEvent(e);
+ }
+ else
+ event.Skip();
+}
+
+// wxTabFrame is an interesting case. It's important that all child pages
+// of the multi-notebook control are all actually children of that control
+// (and not grandchildren). wxTabFrame facilitates this. There is one
+// instance of wxTabFrame for each tab control inside the multi-notebook.
+// It's important to know that wxTabFrame is not a real window, but it merely
+// used to capture the dimensions/positioning of the internal tab control and
+// it's managed page windows
+
+class wxTabFrame : public wxWindow
+{
+public:
+
+ wxTabFrame()
+ {
+ m_tabs = NULL;
+ m_rect = wxRect(0,0,200,200);
+ m_tab_ctrl_height = 20;
+ }
+
+ ~wxTabFrame()
+ {
+ wxDELETE(m_tabs);
+ }
+
+ void SetTabCtrlHeight(int h)
+ {
+ m_tab_ctrl_height = h;
+ }
+
+protected:
+ void DoSetSize(int x, int y,
+ int width, int height,
+ int WXUNUSED(sizeFlags = wxSIZE_AUTO))
+ {
+ m_rect = wxRect(x, y, width, height);
+ DoSizing();
+ }
+
+ void DoGetClientSize(int* x, int* y) const
+ {
+ *x = m_rect.width;
+ *y = m_rect.height;
+ }
+
+public:
+ bool Show( bool WXUNUSED(show = true) ) { return false; }
+
+ void DoSizing()
+ {
+ if (!m_tabs)
+ return;
+
+ if (m_tabs->IsFrozen() || m_tabs->GetParent()->IsFrozen())
+ return;
+
+ m_tab_rect = wxRect(m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height);
+ if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM)
+ {
+ m_tab_rect = wxRect (m_rect.x, m_rect.y + m_rect.height - m_tab_ctrl_height, m_rect.width, m_tab_ctrl_height);
+ m_tabs->SetSize (m_rect.x, m_rect.y + m_rect.height - m_tab_ctrl_height, m_rect.width, m_tab_ctrl_height);
+ m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tab_ctrl_height));
+ }
+ else //TODO: if (GetFlags() & wxAUI_NB_TOP)
+ {
+ m_tab_rect = wxRect (m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height);
+ m_tabs->SetSize (m_rect.x, m_rect.y, m_rect.width, m_tab_ctrl_height);
+ m_tabs->SetRect (wxRect(0, 0, m_rect.width, m_tab_ctrl_height));
+ }
+ // TODO: else if (GetFlags() & wxAUI_NB_LEFT){}
+ // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
+
+ m_tabs->Refresh();
+ m_tabs->Update();
+
+ wxAuiNotebookPageArray& pages = m_tabs->GetPages();
+ size_t i, page_count = pages.GetCount();
+
+ for (i = 0; i < page_count; ++i)
+ {
+ int height = m_rect.height - m_tab_ctrl_height;
+ if ( height < 0 )
+ {
+ // avoid passing negative height to wxWindow::SetSize(), this
+ // results in assert failures/GTK+ warnings
+ 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);
+ }
+ else //TODO: if (GetFlags() & wxAUI_NB_TOP)
+ {
+ page.window->SetSize(m_rect.x, m_rect.y + m_tab_ctrl_height,
+ m_rect.width, height);
+ }
+ // TODO: else if (GetFlags() & wxAUI_NB_LEFT){}
+ // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
+
+#if wxUSE_MDI
+ if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+ {
+ wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window;
+ wnd->ApplyMDIChildFrameRect();
+ }
+#endif
+ }
+ }
+
+protected:
+ void DoGetSize(int* x, int* y) const