Avoid unnecessary wxDynamicCast in wxOSX code

There is no need to check if the control is a wxComboBox if it turns out
to already be a wxTextCtrl.

No real changes, just a micro-optimization and simplification.
This commit is contained in:
Vadim Zeitlin
2020-12-06 00:27:55 +01:00
parent 19f9f6af57
commit 2a8e229238

View File

@@ -2440,14 +2440,12 @@ void wxWidgetCocoaImpl::controlTextDidChange()
if ( wxpeer ) if ( wxpeer )
{ {
// since native rtti doesn't have to be enabled and wx' rtti is not aware of the mixin wxTextEntry, workaround is needed // since native rtti doesn't have to be enabled and wx' rtti is not aware of the mixin wxTextEntry, workaround is needed
wxTextCtrl *tc = wxDynamicCast( wxpeer , wxTextCtrl ); if ( wxTextCtrl *tc = wxDynamicCast( wxpeer , wxTextCtrl ) )
wxComboBox *cb = wxDynamicCast( wxpeer , wxComboBox );
if ( tc )
{ {
tc->MarkDirty(); tc->MarkDirty();
tc->SendTextUpdatedEventIfAllowed(); tc->SendTextUpdatedEventIfAllowed();
} }
else if ( cb ) else if ( wxComboBox *cb = wxDynamicCast( wxpeer , wxComboBox ) )
cb->SendTextUpdatedEventIfAllowed(); cb->SendTextUpdatedEventIfAllowed();
else else
{ {