X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22a35096a0a9c3fe4d3d32b8d68a361126ef9677..f1d6804f7c1a398dd0616ccf15cb0f96ea07f5e0:/src/generic/listbkg.cpp diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index b21319248a..a9498bdf3c 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -262,47 +262,29 @@ void wxListbook::SetImageList(wxImageList *imageList) // selection // ---------------------------------------------------------------------------- +void wxListbook::UpdateSelectedPage(size_t newsel) +{ + m_selection = newsel; + GetListView()->Select(newsel); + GetListView()->Focus(newsel); +} + int wxListbook::GetSelection() const { return m_selection; } -int wxListbook::SetSelection(size_t n) +wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const { - wxCHECK_MSG( IS_VALID_PAGE(n), wxNOT_FOUND, - wxT("invalid page index in wxListbook::SetSelection()") ); - - const int oldSel = m_selection; - - if ( int(n) != m_selection ) - { - wxListbookEvent event(wxEVT_COMMAND_LISTBOOK_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; - GetListView()->Select(n); - GetListView()->Focus(n); - - // program allows the page change - event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED); - (void)GetEventHandler()->ProcessEvent(event); - } - } + return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); +} - return oldSel; +void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event) +{ + event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED); } + // ---------------------------------------------------------------------------- // adding/removing the pages // ----------------------------------------------------------------------------