From 3e97a905185a72c04a7feb67c7885ab4412100ee Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 1 Aug 2008 13:46:46 +0000 Subject: [PATCH] use a single wxBookCtrlEvent class for all wxBookCtrlBase-derived controls (#9667) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/bookctrl.h | 30 ++++++---- include/wx/choicebk.h | 36 +++--------- include/wx/generic/mdig.h | 2 +- include/wx/generic/notebook.h | 2 +- include/wx/gtk/button.h | 4 -- include/wx/listbook.h | 36 +++--------- include/wx/motif/mdi.h | 2 +- include/wx/msw/notebook.h | 2 +- include/wx/notebook.h | 32 ++--------- include/wx/os2/notebook.h | 2 +- include/wx/osx/carbon/notebook.h | 2 +- include/wx/palmos/notebook.h | 2 +- include/wx/toolbook.h | 35 +++--------- include/wx/treebook.h | 35 +++--------- interface/wx/bookctrl.h | 62 +++++++++++++++++++++ interface/wx/choicebk.h | 2 +- interface/wx/event.h | 4 +- interface/wx/notebook.h | 94 +++++--------------------------- interface/wx/treebook.h | 68 ++--------------------- src/cocoa/notebook.mm | 7 +-- src/common/bookctrl.cpp | 3 +- src/common/nbkbase.cpp | 4 +- src/generic/choicbkg.cpp | 7 +-- src/generic/listbkg.cpp | 7 +-- src/generic/mdig.cpp | 2 +- src/generic/notebook.cpp | 7 +-- src/generic/toolbkg.cpp | 7 +-- src/generic/treebkg.cpp | 5 +- src/gtk/notebook.cpp | 6 -- src/gtk1/notebook.cpp | 10 +--- src/motif/mdi.cpp | 2 +- src/msw/notebook.cpp | 9 ++- src/os2/notebook.cpp | 5 +- src/os2/window.cpp | 2 +- src/osx/carbon/notebmac.cpp | 7 +-- src/palmos/notebook.cpp | 7 +-- src/univ/notebook.cpp | 1 - 37 files changed, 184 insertions(+), 366 deletions(-) diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index e864221cad..005ef42c3c 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -26,7 +26,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent; +class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent; // ---------------------------------------------------------------------------- // constants @@ -260,12 +260,12 @@ protected: { wxFAIL_MSG(wxT("Override this function!")); } // create a new "page changing" event - virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const + virtual wxBookCtrlEvent* CreatePageChangingEvent() const { wxFAIL_MSG(wxT("Override this function!")); return NULL; } // modify the event created by CreatePageChangingEvent() to "page changed" // event, usually by just calling SetEventType() on it - virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event)) + virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event)) { wxFAIL_MSG(wxT("Override this function!")); } @@ -341,13 +341,13 @@ private: }; // ---------------------------------------------------------------------------- -// wxBookCtrlBaseEvent: page changing events generated by derived classes +// wxBookCtrlEvent: page changing events generated by book classes // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBookCtrlBaseEvent : public wxNotifyEvent +class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent { public: - wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, int nSel = -1, int nOldSel = -1) : wxNotifyEvent(commandType, winid) { @@ -355,13 +355,15 @@ public: m_nOldSel = nOldSel; } - wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event) + wxBookCtrlEvent(const wxBookCtrlEvent& event) : wxNotifyEvent(event) { m_nSel = event.m_nSel; m_nOldSel = event.m_nOldSel; } + virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); } + // accessors // the currently selected page (-1 if none) int GetSelection() const { return m_nSel; } @@ -373,29 +375,35 @@ public: private: int m_nSel, // currently selected page m_nOldSel; // previously selected page + + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent) }; +typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&); + +#define wxBookCtrlEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxBookCtrlEventFunction, &func) + +// obsolete name, defined for compatibility only +#define wxBookCtrlBaseEvent wxBookCtrlEvent + // make a default book control for given platform #if wxUSE_NOTEBOOK // dedicated to majority of desktops #include "wx/notebook.h" #define wxBookCtrl wxNotebook - #define wxBookCtrlEvent wxNotebookEvent #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED #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" #define wxBookCtrl wxChoicebook - #define wxBookCtrlEvent wxChoicebookEvent #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED #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 diff --git a/include/wx/choicebk.h b/include/wx/choicebk.h index fc6490cf8a..32092c5631 100644 --- a/include/wx/choicebk.h +++ b/include/wx/choicebk.h @@ -97,8 +97,8 @@ protected: GetChoiceCtrl()->Select(newsel); } - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlEvent &event); // event handlers void OnChoiceSelected(wxCommandEvent& event); @@ -118,36 +118,16 @@ private: // choicebook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxChoicebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxChoicebookEvent(const wxChoicebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent) -}; - -typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&); - -#define wxChoicebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func) +// wxChoicebookEvent is obsolete and defined for compatibility only +typedef wxBookCtrlEvent wxChoicebookEvent; +typedef wxBookCtrlEventFunction wxChoicebookEventFunction; +#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func) #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) #endif // wxUSE_CHOICEBOOK diff --git a/include/wx/generic/mdig.h b/include/wx/generic/mdig.h index bc4bb52f2d..bee3506d09 100644 --- a/include/wx/generic/mdig.h +++ b/include/wx/generic/mdig.h @@ -237,7 +237,7 @@ public: protected: void PageChanged(int OldSelection, int newSelection); - void OnPageChanged(wxNotebookEvent& event); + void OnPageChanged(wxBookCtrlEvent& event); void OnSize(wxSizeEvent& event); private: diff --git a/include/wx/generic/notebook.h b/include/wx/generic/notebook.h index 0dec149510..1007d42240 100644 --- a/include/wx/generic/notebook.h +++ b/include/wx/generic/notebook.h @@ -115,7 +115,7 @@ public: // --------- void OnSize(wxSizeEvent& event); void OnInternalIdle(); - void OnSelChange(wxNotebookEvent& event); + void OnSelChange(wxBookCtrlEvent& event); void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); diff --git a/include/wx/gtk/button.h b/include/wx/gtk/button.h index 190805702d..d04870f76e 100644 --- a/include/wx/gtk/button.h +++ b/include/wx/gtk/button.h @@ -44,10 +44,6 @@ public: // implementation // -------------- - // Since this wxButton doesn't derive from wxButtonBase (why?) we need - // to override this here too... - virtual bool ShouldInheritColours() const { return false; } - static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); diff --git a/include/wx/listbook.h b/include/wx/listbook.h index f77b0ca690..57f24203dd 100644 --- a/include/wx/listbook.h +++ b/include/wx/listbook.h @@ -94,8 +94,8 @@ protected: void UpdateSelectedPage(size_t newsel); - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlEvent &event); // get flags for different list control modes long GetListCtrlIconViewFlags() const; @@ -124,36 +124,16 @@ private: // listbook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxListbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxListbookEvent(const wxListbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxListbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent) -}; - -typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&); - -#define wxListbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func) +// wxListbookEvent is obsolete and defined for compatibility only +typedef wxBookCtrlEvent wxListbookEvent; +typedef wxBookCtrlEventFunction wxListbookEventFunction; +#define wxListbookEventHandler(func) wxBookCtrlEventHandler(func) #define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) #endif // wxUSE_LISTBOOK diff --git a/include/wx/motif/mdi.h b/include/wx/motif/mdi.h index 8d8ab5f2ad..fa8e5a736f 100644 --- a/include/wx/motif/mdi.h +++ b/include/wx/motif/mdi.h @@ -225,7 +225,7 @@ public: void OnScroll(wxScrollEvent& event); // Implementation - void OnPageChanged(wxNotebookEvent& event); + void OnPageChanged(wxBookCtrlEvent& event); int FindPage(const wxNotebookPage* page); diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 0509755d5f..969e732145 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -150,7 +150,7 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); - void OnSelChange(wxNotebookEvent& event); + void OnSelChange(wxBookCtrlEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); // base class virtuals diff --git a/include/wx/notebook.h b/include/wx/notebook.h index 5350a11b26..060bf6dc7c 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -118,39 +118,19 @@ protected: // notebook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxNotebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) - : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) - { - } - - wxNotebookEvent(const wxNotebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent) -}; +// wxNotebookEvent is obsolete and defined for compatibility only +typedef wxBookCtrlEvent wxNotebookEvent; +typedef wxBookCtrlEventFunction wxNotebookEventFunction; +#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func) extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED; extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING; -typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); - -#define wxNotebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func) - #define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) // ---------------------------------------------------------------------------- // wxNotebook class itself diff --git a/include/wx/os2/notebook.h b/include/wx/os2/notebook.h index 3c94de27a7..83b964c0bf 100644 --- a/include/wx/os2/notebook.h +++ b/include/wx/os2/notebook.h @@ -155,7 +155,7 @@ public: // --------- // void OnSize(wxSizeEvent& rEvent); - void OnSelChange(wxNotebookEvent& rEvent); + void OnSelChange(wxBookCtrlEvent& rEvent); void OnSetFocus(wxFocusEvent& rEvent); void OnNavigationKey(wxNavigationKeyEvent& rEvent); diff --git a/include/wx/osx/carbon/notebook.h b/include/wx/osx/carbon/notebook.h index 48e13feb3a..49750b8439 100644 --- a/include/wx/osx/carbon/notebook.h +++ b/include/wx/osx/carbon/notebook.h @@ -101,7 +101,7 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); - void OnSelChange(wxNotebookEvent& event); + void OnSelChange(wxBookCtrlEvent& event); void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); diff --git a/include/wx/palmos/notebook.h b/include/wx/palmos/notebook.h index 5a6b32e909..5e85e4259d 100644 --- a/include/wx/palmos/notebook.h +++ b/include/wx/palmos/notebook.h @@ -145,7 +145,7 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); - void OnSelChange(wxNotebookEvent& event); + void OnSelChange(wxBookCtrlEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); // base class virtuals diff --git a/include/wx/toolbook.h b/include/wx/toolbook.h index c6b60383d5..63391c858b 100644 --- a/include/wx/toolbook.h +++ b/include/wx/toolbook.h @@ -111,8 +111,8 @@ protected: void UpdateSelectedPage(size_t newsel); - wxBookCtrlBaseEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlBaseEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const; + void MakeChangedEvent(wxBookCtrlEvent &event); // the currently selected page or wxNOT_FOUND if none int m_selection; @@ -135,36 +135,17 @@ private: // listbook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxToolbookEvent : public wxBookCtrlBaseEvent -{ -public: - wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxToolbookEvent(const wxToolbookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); } - -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent) -}; - -typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&); +// wxToolbookEvent is obsolete and defined for compatibility only +typedef wxBookCtrlEvent wxToolbookEvent; +typedef wxBookCtrlEventFunction wxToolbookEventFunction; +#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func) -#define wxToolbookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func) #define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) #endif // wxUSE_TOOLBOOK diff --git a/include/wx/treebook.h b/include/wx/treebook.h index bd60e6dca1..704c87f234 100644 --- a/include/wx/treebook.h +++ b/include/wx/treebook.h @@ -233,47 +233,28 @@ private: // treebook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreebookEvent : public wxBookCtrlBaseEvent -{ -public: - wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) - { - } - - wxTreebookEvent(const wxTreebookEvent& event) - : wxBookCtrlBaseEvent(event) - { - } - - virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); } +// wxTreebookEvent is obsolete and defined for compatibility only +typedef wxBookCtrlEvent wxTreebookEvent; +typedef wxBookCtrlEventFunction wxTreebookEventFunction; +#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func) -private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent) -}; extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED; extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING; extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED; extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED; -typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&); - -#define wxTreebookEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func) - #define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) #define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn)) #define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ - wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn)) + wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn)) #endif // wxUSE_TREEBOOK diff --git a/interface/wx/bookctrl.h b/interface/wx/bookctrl.h index 3665a5e87c..021750acc4 100644 --- a/interface/wx/bookctrl.h +++ b/interface/wx/bookctrl.h @@ -22,3 +22,65 @@ public: }; + +/** + @class wxBookCtrlEvent + + This class represents the events generated by book controls (wxNotebook, + wxListbook, wxChoicebook, wxTreebook). + The PAGE_CHANGING events are sent before the current page is changed. + It allows the program to examine the current page (which can be retrieved + with wxBookCtrlEvent::GetOldSelection) and to veto the page change by calling + wxNotifyEvent::Veto if, for example, the current values in the controls + of the old page are invalid. + + The PAGE_CHANGED events are sent after the page has been changed and + the program cannot veto it any more, it just informs it about the page + change. + + To summarize, if the program is interested in validating the page values + before allowing the user to change it, it should process the PAGE_CHANGING + event, otherwise PAGE_CHANGED is probably enough. In any case, it is + probably unnecessary to process both events at once. + + @library{wxcore} + @category{events} + + @see wxNotebook, wxListbook, wxChoicebook, wxTreebook +*/ + +class wxBookCtrlEvent : public wxNotifyEvent +{ +public: + /** + Constructor (used internally by wxWidgets only). + */ + wxBookCtrlEvent(wxEventType eventType = wxEVT_NULL, int id = 0, + int sel = wxNOT_FOUND, int oldSel = wxNOT_FOUND); + + /** + Returns the page that was selected before the change, @c wxNOT_FOUND if + none was selected. + */ + int GetOldSelection() const; + + /** + Returns the currently selected page, or @c wxNOT_FOUND if none was + selected. + @note under Windows, GetSelection() will return the same value as + GetOldSelection() when called from @c EVT_NOTEBOOK_PAGE_CHANGING + handler and not the page which is going to be selected. + */ + int GetSelection() const; + + /** + Sets the id of the page selected before the change. + */ + void SetOldSelection(int page); + + /** + Sets the selection member variable. + */ + void SetSelection(int page); +}; + diff --git a/interface/wx/choicebk.h b/interface/wx/choicebk.h index 8aa9001b2c..01e4032035 100644 --- a/interface/wx/choicebk.h +++ b/interface/wx/choicebk.h @@ -36,7 +36,7 @@ Place labels below the page area. @endStyleTable - @beginEventTable{wxChoicebookEvent} + @beginEventTable{wxBookCtrlEvent} @event{EVT_CHOICEBOOK_PAGE_CHANGED(id, func)} The page selection was changed. Processes a wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED event. diff --git a/interface/wx/event.h b/interface/wx/event.h index ce8f4acf06..e2263ece27 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -2385,7 +2385,7 @@ public: @class wxNotifyEvent This class is not used by the event handlers by itself, but is a base class - for other event classes (such as wxNotebookEvent). + for other event classes (such as wxBookCtrlEvent). It (or an object of a derived class) is sent when the controls state is being changed and allows the program to wxNotifyEvent::Veto() this change if it wants @@ -2394,7 +2394,7 @@ public: @library{wxcore} @category{events} - @see wxNotebookEvent + @see wxBookCtrlEvent */ class wxNotifyEvent : public wxCommandEvent { diff --git a/interface/wx/notebook.h b/interface/wx/notebook.h index 1ce4eafcdd..5325aea809 100644 --- a/interface/wx/notebook.h +++ b/interface/wx/notebook.h @@ -1,88 +1,21 @@ ///////////////////////////////////////////////////////////////////////////// // Name: notebook.h -// Purpose: interface of wxNotebookEvent +// Purpose: interface of wxNotebook // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -/** - @class wxNotebookEvent - - This class represents the events generated by a notebook control: currently, - there are two of them. The PAGE_CHANGING event is sent before the current - page is changed. It allows the program to examine the current page (which - can be retrieved with - wxNotebookEvent::GetOldSelection) and to veto the page - change by calling wxNotifyEvent::Veto if, for example, the - current values in the controls of the old page are invalid. - - The second event - PAGE_CHANGED - is sent after the page has been changed and - the program cannot veto it any more, it just informs it about the page change. - - To summarize, if the program is interested in validating the page values - before allowing the user to change it, it should process the PAGE_CHANGING - event, otherwise PAGE_CHANGED is probably enough. In any case, it is probably - unnecessary to process both events at once. - - @library{wxcore} - @category{events} - - @see wxNotebook -*/ -class wxNotebookEvent : public wxNotifyEvent -{ -public: - /** - Constructor (used internally by wxWidgets only). - */ - wxNotebookEvent(wxEventType eventType = wxEVT_NULL, int id = 0, - int sel = -1, - int oldSel = -1); - - /** - Returns the page that was selected before the change, -1 if none was selected. - */ - int GetOldSelection() const; - - /** - Returns the currently selected page, or -1 if none was selected. - @note under Windows, GetSelection() will return the same value as - GetOldSelection() when called from - @c EVT_NOTEBOOK_PAGE_CHANGING handler and not the page which is going to - be selected. Also note that the values of selection and old selection returned - for an event generated in response to a call to - wxNotebook::SetSelection shouldn't be trusted - as they are currently inconsistent under different platforms (but in this case - you presumably don't need them anyhow as you already have the corresponding - information). - */ - int GetSelection() const; - - /** - Sets the id of the page selected before the change. - */ - void SetOldSelection(int page); - - /** - Sets the selection member variable. - */ - void SetSelection(int page); -}; - - - /** @class wxNotebook This class represents a notebook control, which manages multiple windows with associated tabs. - To use the class, create a wxNotebook object and call wxNotebook::AddPage or - wxNotebook::InsertPage, - passing a window to be used as the page. Do not explicitly delete the window - for a page that is currently - managed by wxNotebook. + To use the class, create a wxNotebook object and call wxNotebook::AddPage + or wxNotebook::InsertPage, passing a window to be used as the page. Do not + explicitly delete the window for a page that is currently managed by + wxNotebook. @b wxNotebookPage is a typedef for wxWindow. @@ -109,8 +42,8 @@ public: @library{wxcore} @category{miscwnd} - @see wxBookCtrl(), wxNotebookEvent, wxImageList, - @ref page_samples_notebook "Notebook Sample" + @see wxBookCtrl, wxBookCtrlEvent, wxImageList, + @ref page_samples_notebook "Notebook Sample" */ class wxNotebook : public wxBookCtrl overview { @@ -190,7 +123,7 @@ public: /** Changes the selection for the given page, returning the previous selection. The call to this function does not generate the page changing events. - This is the only difference with SetSelection(). See + This is the only difference with SetSelection(). See @ref overview_eventhandling_prog "User Generated Events" for more infomation. */ @@ -256,10 +189,9 @@ public: /** Returns the currently selected page, or -1 if none was selected. - Note that this method may return either the previously or newly selected page - when called from the @c EVT_NOTEBOOK_PAGE_CHANGED handler depending on - the platform and so - wxNotebookEvent::GetSelection should be + Note that this method may return either the previously or newly + selected page when called from the @c EVT_NOTEBOOK_PAGE_CHANGED handler + depending on the platform and so wxBookCtrlEvent::GetSelection should be used instead in this case. */ virtual int GetSelection() const; @@ -327,9 +259,9 @@ public: /** An event handler function, called when the page selection is changed. - @see wxNotebookEvent + @see wxBookCtrlEvent */ - void OnSelChange(wxNotebookEvent& event); + void OnSelChange(wxBookCtrlEvent& event); /** Deletes the specified page, without deleting the associated window. diff --git a/interface/wx/treebook.h b/interface/wx/treebook.h index a18d2f7482..f29a05521f 100644 --- a/interface/wx/treebook.h +++ b/interface/wx/treebook.h @@ -1,71 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: treebook.h -// Purpose: interface of wxTreebookEvent +// Purpose: interface of wxTreebook // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -/** - @class wxTreebookEvent - - This class represents the events generated by a treebook control: currently, - there are four of them. The EVT_TREEBOOK_PAGE_CHANGING() and - EVT_TREEBOOK_PAGE_CHANGED() - have exactly the same behaviour as - wxNotebookEvent. - - The other two EVT_TREEBOOK_NODE_COLLAPSED() and EVT_TREEBOOK_NODE_EXPANDED() - are triggered when page node in the tree control is collapsed/expanded. The - page index could be retreived by calling GetSelection(). - - @beginEventTable{wxTreebookEvent} - @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)} - The page selection was changed. Processes a @c - wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event. - @event{EVT_TREEBOOK_PAGE_CHANGING(id, func)} - The page selection is about to be changed. Processes a @c - wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event. This event can be @ref - wxNotifyEvent::Veto() "vetoed". - @event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)} - The page node is going to be collapsed. Processes a @c - wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event. - @event{EVT_TREEBOOK_NODE_EXPANDED(id, func)} - The page node is going to be expanded. Processes a @c - wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event. - @endEventTable - - @library{wxcore} - @category{events} - - @see wxTreebook, wxNotebookEvent -*/ -class wxTreebookEvent : public wxNotifyEvent -{ -public: - /** - @see wxNotebookEvent - */ - wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, - int nSel = wxNOT_FOUND, - int nOldSel = wxNOT_FOUND); - - /** - Returns the page that was selected before the change, @c wxNOT_FOUND if - none was selected. - */ - int GetOldSelection() const; - - /** - Returns the currently selected page, or @c wxNOT_FOUND if none was - selected. - - @see wxNotebookEvent::GetSelection() - */ - int GetSelection() const; -}; - - - /** @class wxTreebook @@ -81,7 +21,7 @@ public: AddPage() and AddSubPage() to sequentially populate your tree by adding at every step a page or a subpage to the end of the tree. - @beginEventTable{wxTreebookEvent} + @beginEventTable{wxBookCtrlEvent} @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)} The page selection was changed. Processes a @c wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event. @@ -100,7 +40,7 @@ public: @library{wxcore} @category{miscwnd} - @see wxTreebookEvent, wxNotebook, wxTreeCtrl, wxImageList, + @see wxBookCtrl, wxBookCtrlEvent, wxNotebook, wxTreeCtrl, wxImageList, @ref overview_bookctrl, @ref page_samples_notebook */ class wxTreebook : public wxBookCtrlBase @@ -230,7 +170,7 @@ public: @note This method may return either the previously or newly selected page when called from the EVT_TREEBOOK_PAGE_CHANGED() handler - depending on the platform and so wxTreebookEvent::GetSelection() + depending on the platform and so wxBookCtrlEvent::GetSelection() should be used instead in this case. */ int GetSelection() const; diff --git a/src/cocoa/notebook.mm b/src/cocoa/notebook.mm index 6462b07222..5e9bab2a0d 100644 --- a/src/cocoa/notebook.mm +++ b/src/cocoa/notebook.mm @@ -125,11 +125,10 @@ WX_DECLARE_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem) WX_IMPLEMENT_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem) // ======================================================================== -// wxNotebookEvent +// wxBookCtrlEvent // ======================================================================== DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING) -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ======================================================================== // wxNotebook @@ -315,7 +314,7 @@ int wxNotebook::GetSelection() const void wxNotebook::CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabViewItem) { // FIXME: oldSel probably == newSel - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(), + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(), [GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); @@ -323,7 +322,7 @@ void wxNotebook::CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tab bool wxNotebook::CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabViewItem) { - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(), + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(), [GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection()); event.SetEventObject(this); return !HandleWindowEvent(event) || event.IsAllowed(); diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index 3b822dcaa5..d45ff84f7d 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -455,7 +455,7 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) if ( n != (size_t)oldSel ) { - wxBookCtrlBaseEvent *event = CreatePageChangingEvent(); + wxBookCtrlEvent *event = CreatePageChangingEvent(); bool allowed = false; if ( flags & SetSelection_SendEvent ) @@ -493,5 +493,6 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) return oldSel; } +IMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent) #endif // wxUSE_BOOKCTRL diff --git a/src/common/nbkbase.cpp b/src/common/nbkbase.cpp index ec391bb57f..b0466a3eef 100644 --- a/src/common/nbkbase.cpp +++ b/src/common/nbkbase.cpp @@ -65,7 +65,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const bool wxNotebookBase::SendPageChangingEvent(int nPage) { - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId()); + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId()); event.SetSelection(nPage); event.SetOldSelection(GetSelection()); event.SetEventObject(this); @@ -74,7 +74,7 @@ bool wxNotebookBase::SendPageChangingEvent(int nPage) void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew) { - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId()); + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId()); event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew); event.SetOldSelection(nPageOld); event.SetEventObject(this); diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index ccc51e049d..aa24856ec2 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -48,7 +48,6 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent) const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType(); @@ -205,12 +204,12 @@ int wxChoicebook::GetSelection() const return m_selection; } -wxBookCtrlBaseEvent* wxChoicebook::CreatePageChangingEvent() const +wxBookCtrlEvent* wxChoicebook::CreatePageChangingEvent() const { - return new wxChoicebookEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); + return new wxBookCtrlEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); } -void wxChoicebook::MakeChangedEvent(wxBookCtrlBaseEvent &event) +void wxChoicebook::MakeChangedEvent(wxBookCtrlEvent &event) { event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); } diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 487b6494a2..d7cf2df1db 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -54,7 +54,6 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent) const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType(); @@ -370,12 +369,12 @@ int wxListbook::GetSelection() const return m_selection; } -wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const +wxBookCtrlEvent* wxListbook::CreatePageChangingEvent() const { - return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); + return new wxBookCtrlEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); } -void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) +void wxListbook::MakeChangedEvent(wxBookCtrlEvent &event) { event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED); } diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index d97213d797..a64b5e77b1 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -775,7 +775,7 @@ void wxGenericMDIClientWindow::PageChanged(int OldSelection, int newSelection) } } -void wxGenericMDIClientWindow::OnPageChanged(wxNotebookEvent& event) +void wxGenericMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event) { PageChanged(event.GetOldSelection(), event.GetSelection()); diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp index 3b0b6d2382..8fd494e9e9 100644 --- a/src/generic/notebook.cpp +++ b/src/generic/notebook.cpp @@ -62,7 +62,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) // ============================================================================ // implementation @@ -545,7 +544,7 @@ bool wxNotebook::RefreshLayout(bool force) return true; } -void wxNotebook::OnSelChange(wxNotebookEvent& event) +void wxNotebook::OnSelChange(wxBookCtrlEvent& event) { // is it our tab control? if ( event.GetEventObject() == this ) @@ -713,7 +712,7 @@ void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId) if (!m_notebook) return; - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId()); + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId()); // Translate from wxTabView's ids (which aren't position-dependent) // to wxNotebook's (which are). @@ -736,7 +735,7 @@ bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId) if (m_notebook) { - wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId()); + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId()); // Translate from wxTabView's ids (which aren't position-dependent) // to wxNotebook's (which are). diff --git a/src/generic/toolbkg.cpp b/src/generic/toolbkg.cpp index 1693b3cfe2..969960b988 100644 --- a/src/generic/toolbkg.cpp +++ b/src/generic/toolbkg.cpp @@ -44,7 +44,6 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxToolbookEvent, wxNotifyEvent) const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxNewEventType(); @@ -247,12 +246,12 @@ int wxToolbook::GetSelection() const return m_selection; } -wxBookCtrlBaseEvent* wxToolbook::CreatePageChangingEvent() const +wxBookCtrlEvent* wxToolbook::CreatePageChangingEvent() const { - return new wxToolbookEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId); + return new wxBookCtrlEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId); } -void wxToolbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) +void wxToolbook::MakeChangedEvent(wxBookCtrlEvent &event) { event.SetEventType(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED); } diff --git a/src/generic/treebkg.cpp b/src/generic/treebkg.cpp index 6c13516a3d..4984fa306c 100644 --- a/src/generic/treebkg.cpp +++ b/src/generic/treebkg.cpp @@ -46,7 +46,6 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent) const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxNewEventType(); @@ -579,7 +578,7 @@ int wxTreebook::DoSetSelection(size_t pagePos, int flags) wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(), wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!")); - wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId); + wxBookCtrlEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId); const int oldSel = m_selection; wxTreeCtrl *tree = GetTreeCtrl(); bool allowed = false; @@ -717,7 +716,7 @@ void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event) int pagePos = DoInternalFindPageById(nodeId); wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") ); - wxTreebookEvent ev(GetTreeCtrl()->IsExpanded(nodeId) + wxBookCtrlEvent ev(GetTreeCtrl()->IsExpanded(nodeId) ? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED : wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, m_windowId); diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 7ac1cb4666..338a0ed5ef 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -675,10 +675,4 @@ wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return GetDefaultAttributesFromGTKWidget(gtk_notebook_new); } -//----------------------------------------------------------------------------- -// wxNotebookEvent -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) - #endif diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 37fa1fd8e5..4b81047c5f 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -112,7 +112,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), notebook->m_skipNextPageChangeEvent = false; // make wxNotebook::GetSelection() return the correct (i.e. consistent - // with wxNotebookEvent::GetSelection()) value even though the page is + // with wxBookCtrlEvent::GetSelection()) value even though the page is // not really changed in GTK+ notebook->m_selection = page; } @@ -126,7 +126,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), else // change allowed { // make wxNotebook::GetSelection() return the correct (i.e. consistent - // with wxNotebookEvent::GetSelection()) value even though the page is + // with wxBookCtrlEvent::GetSelection()) value even though the page is // not really changed in GTK+ notebook->m_selection = page; @@ -865,10 +865,4 @@ wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return GetDefaultAttributesFromGTKWidget(gtk_notebook_new); } -//----------------------------------------------------------------------------- -// wxNotebookEvent -//----------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) - #endif diff --git a/src/motif/mdi.cpp b/src/motif/mdi.cpp index 998bc5d107..b0975e621e 100644 --- a/src/motif/mdi.cpp +++ b/src/motif/mdi.cpp @@ -682,7 +682,7 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event) event.Skip(); } -void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event) +void wxMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event) { // Notify child that it has been activated if (event.GetOldSelection() != -1) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 5c9cd14cd2..e58dcd3b42 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -187,8 +187,8 @@ template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theLis } wxBEGIN_PROPERTIES_TABLE(wxNotebook) - wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent ) - wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent ) + wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxBookCtrlEvent ) + wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxBookCtrlEvent ) wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style @@ -216,7 +216,6 @@ wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject ) #endif -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ============================================================================ // implementation @@ -1091,7 +1090,7 @@ void wxNotebook::OnSize(wxSizeEvent& event) event.Skip(); } -void wxNotebook::OnSelChange(wxNotebookEvent& event) +void wxNotebook::OnSelChange(wxBookCtrlEvent& event) { // is it our tab control? if ( event.GetEventObject() == this ) @@ -1423,7 +1422,7 @@ bool wxNotebook::MSWOnScroll(int orientation, WXWORD nSBCode, bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) { - wxNotebookEvent event(wxEVT_NULL, m_windowId); + wxBookCtrlEvent event(wxEVT_NULL, m_windowId); NMHDR* hdr = (NMHDR *)lParam; switch ( hdr->code ) { diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index b68b16028e..81e3a98538 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -64,7 +64,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ============================================================================ // implementation @@ -216,7 +215,7 @@ int wxNotebook::SetSelection( size_t nPage ) if (nPage != (size_t)m_nSelection) { - wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING + wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING ,m_windowId ); @@ -683,7 +682,7 @@ void wxNotebook::OnSize( } // end of wxNotebook::OnSize void wxNotebook::OnSelChange ( - wxNotebookEvent& rEvent + wxBookCtrlEvent& rEvent ) { // diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 444a0756c2..74490afd45 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -2548,7 +2548,7 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg, (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L)) { wxWindowOS2* pWin = wxFindWinFromHandle(pPage->hwndBook); - wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED + wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED ,(int)SHORT1FROMMP(wParam) ,(int)pPage->ulPageIdNew ,(int)pPage->ulPageIdCur diff --git a/src/osx/carbon/notebmac.cpp b/src/osx/carbon/notebmac.cpp index 5a5504d8f6..232d01d258 100644 --- a/src/osx/carbon/notebmac.cpp +++ b/src/osx/carbon/notebmac.cpp @@ -43,7 +43,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) // common part of all ctors @@ -458,7 +457,7 @@ void wxNotebook::OnSize(wxSizeEvent& event) event.Skip(); } -void wxNotebook::OnSelChange(wxNotebookEvent& event) +void wxNotebook::OnSelChange(wxBookCtrlEvent& event) { // is it our tab control? if ( event.GetEventObject() == this ) @@ -593,7 +592,7 @@ wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR SInt32 newSel = m_peer->GetValue() - 1 ; if ( newSel != m_nSelection ) { - wxNotebookEvent changing( + wxBookCtrlEvent changing( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId, newSel , m_nSelection ); changing.SetEventObject( this ); @@ -601,7 +600,7 @@ wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR if ( changing.IsAllowed() ) { - wxNotebookEvent event( + wxBookCtrlEvent event( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId, newSel, m_nSelection ); event.SetEventObject( this ); diff --git a/src/palmos/notebook.cpp b/src/palmos/notebook.cpp index bca31c6f86..37063ae141 100644 --- a/src/palmos/notebook.cpp +++ b/src/palmos/notebook.cpp @@ -98,8 +98,8 @@ template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theLis } wxBEGIN_PROPERTIES_TABLE(wxNotebook) - wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent ) - wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent ) + wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxBookCtrlEvent ) + wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxBookCtrlEvent ) wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style @@ -127,7 +127,6 @@ wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject ) #endif -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ============================================================================ // implementation @@ -288,7 +287,7 @@ void wxNotebook::OnSize(wxSizeEvent& event) { } -void wxNotebook::OnSelChange(wxNotebookEvent& event) +void wxNotebook::OnSelChange(wxBookCtrlEvent& event) { } diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index a1c7d867f2..e6210f2927 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -115,7 +115,6 @@ END_EVENT_TABLE() // ============================================================================ IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase) -IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) // ---------------------------------------------------------------------------- // wxNotebook creation -- 2.45.2