Fix compile errors for wxNO_RTTI with some controls disabled

Fix compilation errors when wxNO_RTTI and wxUSE_UIACTIONSIMULATOR are
on, but one or more of wxUSE_COMBOBOX, wxUSE_CHOICE and wxUSE_LISTBOX
are off.

See #23611.

(cherry picked from commit 609b7e253551c17857c4303df1e9b0252cfeeccc)
This commit is contained in:
matyalatte 2023-06-05 23:48:17 +09:00 committed by Vadim Zeitlin
parent 23655a2ec1
commit 4d491d7712

View File

@ -191,12 +191,20 @@ bool wxUIActionSimulator::Select(const wxString& text)
#ifdef wxNO_RTTI
wxItemContainer* container = NULL;
#if wxUSE_COMBOBOX
if ( wxComboBox* combo = wxDynamicCast(focus, wxComboBox) )
container = combo;
else if ( wxChoice* choice = wxDynamicCast(focus, wxChoice) )
#endif // wxUSE_COMBOBOX
#if wxUSE_CHOICE
wxChoice* choice;
if ( !container && (choice = wxDynamicCast(focus, wxChoice)) )
container = choice;
else if ( wxListBox* listbox = wxDynamicCast(focus, wxListBox) )
#endif // wxUSE_CHOICE
#if wxUSE_LISTBOX
wxListBox* listbox;
if ( !container && (listbox = wxDynamicCast(focus, wxListBox)) )
container = listbox;
#endif // wxUSE_LISTBOX
#else // !wxNO_RTTI
wxItemContainer* const container = dynamic_cast<wxItemContainer*>(focus);
#endif // wxNO_RTTI/!wxNO_RTTI