X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90f9b8ef0c83c09f80c2f60ad65407ba16f11a3c..25eb10d2e119b278be3ff51b3c96c297cc3ac6ef:/include/wx/bookctrl.h diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 4cea68ba31..85d769d71a 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -26,6 +26,21 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); class WXDLLEXPORT wxImageList; +class WXDLLEXPORT wxBookCtrlBaseEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxBookCtrl hit results +enum +{ + wxBK_HITTEST_NOWHERE = 1, // not on tab + wxBK_HITTEST_ONICON = 2, // on icon + wxBK_HITTEST_ONLABEL = 4, // on label + wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL, + wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page +}; // ---------------------------------------------------------------------------- // wxBookCtrlBase @@ -180,6 +195,9 @@ public: // NB: this function will generate PAGE_CHANGING/ED events virtual int SetSelection(size_t n) = 0; + // acts as SetSelection but does not generate events + virtual int ChangeSelection(size_t n) = 0; + // cycle thru the pages void AdvanceSelection(bool forward = true) @@ -199,7 +217,27 @@ public: return wxNOT_FOUND; } + + // we do have multiple pages + virtual bool HasMultiplePages() const { return true; } + protected: + // typically, wxBookCtrl-derived classes will use DoSetSelection() function + // to implement SetSelection() and ChangeSelection() functions. + // these flags make DoSetSelection() more readable + enum + { + SetSelection_SendEvent = 1 + }; + + // if using DoSetSelection() for implementing [Set|Change]Selection, + // then override UpdateSelectedPage() and MakeChangedEvent() + virtual int DoSetSelection(size_t nPage, int flags, wxBookCtrlBaseEvent &event); + virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) + { wxFAIL_MSG(wxT("Override this function!")); } + virtual void MakeChangedEvent(wxBookCtrlBaseEvent &WXUNUSED(event)) + { wxFAIL_MSG(wxT("Override this function!")); } + // Should we accept NULL page pointers in Add/InsertPage()? // // Default is no but derived classes may override it if they can treat NULL @@ -314,6 +352,7 @@ private: #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func) #else // dedicated to Smartphones #include "wx/choicebk.h" @@ -323,6 +362,7 @@ private: #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) + #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func) #endif #if WXWIN_COMPATIBILITY_2_6