- // calculate the size of the notebook from the size of its page
- virtual wxSize CalcSizeFromPage(const wxSize& sizePage)
- {
- // this was just taken from wxNotebookSizer::CalcMin() and is, of
- // course, totally bogus - just like the original code was
- wxSize sizeTotal = sizePage;
- if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
- sizeTotal.x += 90;
- else
- sizeTotal.y += 40;
-
- return sizeTotal;
- }
-
- // operations
- // ----------
-
- // remove one page from the notebook and delete it
- virtual bool DeletePage(int nPage)
- {
- wxNotebookPage *page = DoRemovePage(nPage);
- if ( !page )
- return FALSE;
-
- delete page;
-
- return TRUE;
- }
-
- // remove one page from the notebook, without deleting it
- virtual bool RemovePage(int nPage) { return DoRemovePage(nPage) != NULL; }
-
- // remove all pages and delete them
- virtual bool DeleteAllPages() { WX_CLEAR_ARRAY(m_pages); return TRUE; }
-
- // adds a new page to the notebook (it will be deleted by the notebook,
- // don't delete it yourself) and make it the current one if bSelect
- virtual bool AddPage(wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect = FALSE,
- int imageId = -1)
- {
- return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
- }
-
- // the same as AddPage(), but adds the page at the specified position
- virtual bool InsertPage(int nPage,
- wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect = FALSE,
- int imageId = -1) = 0;
-
- // set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
- //
- // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
- virtual int SetSelection(int nPage) = 0;
-
- // cycle thru the tabs
- void AdvanceSelection(bool forward = TRUE)
- {
- int nPage = GetNextPage(forward);
- if ( nPage != -1 )
- SetSelection(nPage);
- }