X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0d57be459406c2830f6abc9d99ae99166c6d133b..99c67c777b7d7a6f0ea74823bff7b9c40379b5fa:/include/wx/motif/notebook.h diff --git a/include/wx/motif/notebook.h b/include/wx/motif/notebook.h index e4c93c3eea..279084b9d8 100644 --- a/include/wx/motif/notebook.h +++ b/include/wx/motif/notebook.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: notebook.h -// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) // Author: Julian Smart // Modified by: // RCS-ID: $Id$ @@ -21,6 +21,7 @@ #include "wx/dynarray.h" #include "wx/event.h" #include "wx/control.h" +#include "wx/generic/tabg.h" // ---------------------------------------------------------------------------- // types @@ -48,6 +49,9 @@ public: int GetSelection() const { return m_nSel; } int GetOldSelection() const { return m_nOldSel; } + void SetSelection(int sel) { m_nSel = sel; } + void SetOldSelection(int oldSel) { m_nOldSel = oldSel; } + private: int m_nSel, // currently selected page m_nOldSel; // previously selected page @@ -59,9 +63,23 @@ private: // wxNotebook // ---------------------------------------------------------------------------- -// @@@ this class should really derive from wxTabCtrl, but the interface is not -// exactly the same, so I can't do it right now and instead we reimplement -// part of wxTabCtrl here +class WXDLLEXPORT wxNotebook; + +// This reuses wxTabView to draw the tabs. +class WXDLLEXPORT wxNotebookTabView: public wxTabView +{ +DECLARE_DYNAMIC_CLASS(wxNotebookTabView) +public: + wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); + ~wxNotebookTabView(void); + + // Called when a tab is activated + virtual void OnTabActivate(int activateId, int deactivateId); + +protected: + wxNotebook* m_notebook; +}; + class wxNotebook : public wxControl { public: @@ -91,6 +109,9 @@ public: // get number of pages in the dialog int GetPageCount() const; + // Find the position of the wxNotebookPage, -1 if not found. + int FindPagePosition(wxNotebookPage* page) const; + // 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 @@ -130,8 +151,12 @@ public: // operations // ---------- - // remove one page from the notebook + // remove one page from the notebook, and delete the page. bool DeletePage(int nPage); + bool DeletePage(wxNotebookPage* page); + // remove one page from the notebook, without deleting the page. + bool RemovePage(int nPage); + bool RemovePage(wxNotebookPage* page); // remove all pages bool DeleteAllPages(); // adds a new page to the notebook (it will be deleted ny the notebook, @@ -152,6 +177,7 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); + void OnIdle(wxIdleEvent& event); void OnSelChange(wxNotebookEvent& event); void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); @@ -163,9 +189,22 @@ public: virtual bool DoPhase(int nPhase); // Implementation - virtual void ChangeFont(); + + // wxNotebook on Motif uses a generic wxTabView to implement itself. + inline wxTabView *GetTabView() const { return m_tabView; } + inline void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + + virtual void ChangeFont(bool keepOriginalSize = TRUE); virtual void ChangeBackgroundColour(); virtual void ChangeForegroundColour(); + virtual wxRect GetAvailableClientSize(); + + // Implementation: calculate the layout of the view rect + // and resize the children if required + bool RefreshLayout(bool force = TRUE); protected: // common part of all ctors @@ -179,6 +218,8 @@ protected: int m_nSelection; // the current selection (-1 if none) + wxTabView* m_tabView; + DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_EVENT_TABLE() };