X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d6fcbcc7088e9c104b3dc5b4704a07f728d55ae..9a7b7798282622e445efc3318b6c85ff0bed9af8:/src/generic/choicbkg.cpp?ds=inline diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index d74d0b575f..50ab914d84 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -54,10 +54,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent) const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType(); #endif -const int wxID_CHOICEBOOKCHOICE = wxNewId(); BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) - EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected) + EVT_CHOICE(wxID_ANY, wxChoicebook::OnChoiceSelected) END_EVENT_TABLE() // ============================================================================ @@ -98,7 +97,7 @@ wxChoicebook::Create(wxWindow *parent, m_bookctrl = new wxChoice ( this, - wxID_CHOICEBOOKCHOICE, + wxID_ANY, wxDefaultPosition, wxDefaultSize ); @@ -122,7 +121,6 @@ wxChoicebook::Create(wxWindow *parent, wxSize wxChoicebook::GetControllerSize() const { const wxSize sizeClient = GetClientSize(), - // sizeChoice = m_bookctrl->GetBestFittingSize(); sizeChoice = m_controlSizer->CalcMin(); wxSize size; @@ -209,10 +207,14 @@ int wxChoicebook::GetSelection() const return m_selection; } -int wxChoicebook::DoSetSelection(size_t n, int flags) +wxBookCtrlBaseEvent* wxChoicebook::CreatePageChangingEvent() const { - wxChoicebookEvent event(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); - return wxBookCtrlBase::DoSetSelection(n, flags, event); + return new wxChoicebookEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); +} + +void wxChoicebook::MakeChangedEvent(wxBookCtrlBaseEvent &event) +{ + event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); } // ---------------------------------------------------------------------------- @@ -254,7 +256,6 @@ wxChoicebook::InsertPage(size_t n, if ( selNew != wxNOT_FOUND ) SetSelection(selNew); - InvalidateBestSize(); return true; } @@ -300,6 +301,12 @@ bool wxChoicebook::DeleteAllPages() void wxChoicebook::OnChoiceSelected(wxCommandEvent& eventChoice) { + if ( eventChoice.GetEventObject() != m_bookctrl ) + { + eventChoice.Skip(); + return; + } + const int selNew = eventChoice.GetSelection(); if ( selNew == m_selection )