X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9eddec696f06d65a80e7339b2fae14fcb55f8383..fea909e19e86b8da2d54c530d3a89ee9456c3333:/src/generic/choicbkg.cpp diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index 143115bca6..d74d0b575f 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -30,11 +30,11 @@ #ifndef WX_PRECOMP #include "wx/settings.h" + #include "wx/choice.h" + #include "wx/sizer.h" #endif -#include "wx/choice.h" #include "wx/imaglist.h" -#include "wx/sizer.h" // ---------------------------------------------------------------------------- // various wxWidgets macros @@ -209,39 +209,10 @@ int wxChoicebook::GetSelection() const return m_selection; } -int wxChoicebook::SetSelection(size_t n) +int wxChoicebook::DoSetSelection(size_t n, int flags) { - wxCHECK_MSG( IS_VALID_PAGE(n), wxNOT_FOUND, - wxT("invalid page index in wxChoicebook::SetSelection()") ); - - const int oldSel = m_selection; - - if ( int(n) != m_selection ) - { - wxChoicebookEvent event(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); - event.SetSelection(n); - event.SetOldSelection(m_selection); - event.SetEventObject(this); - if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() ) - { - if ( m_selection != wxNOT_FOUND ) - m_pages[m_selection]->Hide(); - - wxWindow *page = m_pages[n]; - page->SetSize(GetPageRect()); - page->Show(); - - // change m_selection now to ignore the selection change event - m_selection = n; - GetChoiceCtrl()->Select(n); - - // program allows the page change - event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); - (void)GetEventHandler()->ProcessEvent(event); - } - } - - return oldSel; + wxChoicebookEvent event(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); + return wxBookCtrlBase::DoSetSelection(n, flags, event); } // ----------------------------------------------------------------------------