+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, m_windowId);
+ e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
+ e.SetEventObject(this);
+ if (GetEventHandler()->ProcessEvent(e))
+ return;
+ if (!e.IsAllowed())
+ return;
+
+ // check if we are supposed to close on middle-up
+ if ((m_flags & wxAUI_NB_MIDDLE_CLICK_CLOSE) == 0)
+ return;
+
+ // simulate the user pressing the close button on the tab
+ evt.SetInt(wxAUI_BUTTON_CLOSE);
+ OnTabButton(evt);
+}
+
+void wxAuiNotebook::OnTabRightDown(wxCommandEvent& evt)
+{
+ // patch event through to owner
+ wxAuiTabCtrl* tabs = (wxAuiTabCtrl*)evt.GetEventObject();
+ wxWindow* wnd = tabs->GetWindowFromIdx(evt.GetSelection());
+
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, m_windowId);
+ e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
+}
+
+void wxAuiNotebook::OnTabRightUp(wxCommandEvent& evt)
+{
+ // patch event through to owner
+ wxAuiTabCtrl* tabs = (wxAuiTabCtrl*)evt.GetEventObject();
+ wxWindow* wnd = tabs->GetWindowFromIdx(evt.GetSelection());
+
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, m_windowId);
+ e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
+ e.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(e);
+}
+
+// Sets the normal font
+void wxAuiNotebook::SetNormalFont(const wxFont& font)
+{
+ m_normal_font = font;
+ GetArtProvider()->SetNormalFont(font);
+}
+
+// Sets the selected tab font
+void wxAuiNotebook::SetSelectedFont(const wxFont& font)
+{
+ m_selected_font = font;
+ GetArtProvider()->SetSelectedFont(font);
+}
+
+// Sets the measuring font
+void wxAuiNotebook::SetMeasuringFont(const wxFont& font)
+{
+ GetArtProvider()->SetMeasuringFont(font);
+}
+
+// Sets the tab font
+bool wxAuiNotebook::SetFont(const wxFont& font)
+{
+ wxControl::SetFont(font);
+
+ wxFont normalFont(font);
+ wxFont selectedFont(normalFont);
+ selectedFont.SetWeight(wxBOLD);
+
+ SetNormalFont(normalFont);
+ SetSelectedFont(selectedFont);
+ SetMeasuringFont(selectedFont);
+
+ return true;
+}
+
+// Gets the tab control height
+int wxAuiNotebook::GetTabCtrlHeight() const
+{
+ return m_tab_ctrl_height;
+}
+
+// Gets the height of the notebook for a given page height
+int wxAuiNotebook::GetHeightForPageHeight(int pageHeight)
+{
+ UpdateTabCtrlHeight();
+
+ int tabCtrlHeight = GetTabCtrlHeight();
+ int decorHeight = 2;
+ return tabCtrlHeight + pageHeight + decorHeight;
+}
+
+// Advances the selection, generation page selection events
+void wxAuiNotebook::AdvanceSelection(bool forward)
+{
+ if (GetPageCount() <= 1)
+ return;
+
+ int currentSelection = GetSelection();
+
+ if (forward)
+ {
+ if (currentSelection == (int) (GetPageCount() - 1))
+ return;
+ else if (currentSelection == -1)
+ currentSelection = 0;
+ else
+ currentSelection ++;
+ }
+ else
+ {
+ if (currentSelection <= 0)
+ return;
+ else
+ currentSelection --;
+ }
+
+ SetSelection(currentSelection);
+}
+
+// Shows the window menu
+bool wxAuiNotebook::ShowWindowMenu()
+{
+ wxAuiTabCtrl* tabCtrl = GetActiveTabCtrl();
+
+ int idx = tabCtrl->GetArtProvider()->ShowDropDown(tabCtrl, tabCtrl->GetPages(), tabCtrl->GetActivePage());
+
+ if (idx != -1)
+ {
+ wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, tabCtrl->GetId());
+ e.SetSelection(idx);
+ e.SetOldSelection(tabCtrl->GetActivePage());
+ e.SetEventObject(tabCtrl);
+ GetEventHandler()->ProcessEvent(e);
+
+ return true;
+ }
+ else
+ return false;
+}