Get rid of unnecessary static casts

This commit is contained in:
Artur Wieczorek
2021-01-16 22:41:32 +01:00
parent ef9cd70b21
commit 9fe7e0a78e
2 changed files with 9 additions and 10 deletions

View File

@@ -2071,12 +2071,13 @@ wxTextCtrl* wxPropertyGrid::GetEditorTextCtrl() const
if ( !wnd )
return NULL;
if ( wxDynamicCast(wnd, wxTextCtrl) )
return wxStaticCast(wnd, wxTextCtrl);
wxTextCtrl* tc = wxDynamicCast(wnd, wxTextCtrl);
if ( tc )
return tc;
if ( wxDynamicCast(wnd, wxOwnerDrawnComboBox) )
wxOwnerDrawnComboBox* cb = wxDynamicCast(wnd, wxOwnerDrawnComboBox);
if ( cb )
{
wxOwnerDrawnComboBox* cb = wxStaticCast(wnd, wxOwnerDrawnComboBox);
return cb->GetTextCtrl();
}

View File

@@ -3130,11 +3130,10 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
wxStatusBar* wxPropertyGrid::GetStatusBar()
{
wxWindow* topWnd = ::wxGetTopLevelParent(this);
if ( wxDynamicCast(topWnd, wxFrame) )
wxFrame* frame = wxDynamicCast(topWnd, wxFrame);
if ( frame )
{
wxFrame* pFrame = wxStaticCast(topWnd, wxFrame);
if ( pFrame )
return pFrame->GetStatusBar();
return frame->GetStatusBar();
}
return NULL;
}
@@ -4456,7 +4455,6 @@ bool wxPropertyGrid::SelectProperty( wxPGPropArg id, bool focus )
bool wxPropertyGrid::DoCollapse( wxPGProperty* p, bool sendEvents )
{
wxPGProperty* pwc = wxStaticCast(p, wxPGProperty);
wxPGProperty* selected = GetSelection();
// If active editor was inside collapsed section, then disable it
@@ -4469,7 +4467,7 @@ bool wxPropertyGrid::DoCollapse( wxPGProperty* p, bool sendEvents )
bool prevDontCenterSplitter = m_pState->m_dontCenterSplitter;
m_pState->m_dontCenterSplitter = true;
bool res = m_pState->DoCollapse(pwc);
bool res = m_pState->DoCollapse(p);
if ( res )
{