X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..12b5f4b4d2d8a07962da7ba3b78c8c1ec2634a67:/src/common/nbkbase.cpp diff --git a/src/common/nbkbase.cpp b/src/common/nbkbase.cpp index 4e7e5f19cd..dd6608e733 100644 --- a/src/common/nbkbase.cpp +++ b/src/common/nbkbase.cpp @@ -35,6 +35,9 @@ // implementation // ============================================================================ +wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent ) +wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent ) + // ---------------------------------------------------------------------------- // geometry // ---------------------------------------------------------------------------- @@ -45,7 +48,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const // default because not all ports implement this wxSize sizeTotal = sizePage; - if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) ) + if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) ) { sizeTotal.x += 90; sizeTotal.y += 10; @@ -59,5 +62,26 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const return sizeTotal; } -#endif // wxUSE_NOTEBOOK +// ---------------------------------------------------------------------------- +// events +// ---------------------------------------------------------------------------- +bool wxNotebookBase::SendPageChangingEvent(int nPage) +{ + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId()); + event.SetSelection(nPage); + event.SetOldSelection(GetSelection()); + event.SetEventObject(this); + return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed(); +} + +void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew) +{ + wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId()); + event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew); + event.SetOldSelection(nPageOld); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); +} + +#endif // wxUSE_NOTEBOOK