Don't duplicate same code for small icon, list and report modes

Handle all of them in a single condition instead of using three
different ones.

No real changes.
This commit is contained in:
Vadim Zeitlin 2022-10-25 23:47:38 +02:00
parent 6dd4e73ea3
commit c94399121f

View file

@ -3303,19 +3303,11 @@ void wxListMainWindow::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
void wxListMainWindow::DrawImage( int index, wxDC *dc, int x, int y )
{
if ( HasFlag(wxLC_ICON) && (m_normal_images))
if ( HasFlag(wxLC_ICON) && m_normal_images )
{
wxDrawImageBitmap(this, *m_normal_images, index, *dc, x, y);
}
else if ( HasFlag(wxLC_SMALL_ICON) && (m_small_images))
{
wxDrawImageBitmap(this, *m_small_images, index, *dc, x, y);
}
else if ( HasFlag(wxLC_LIST) && (m_small_images))
{
wxDrawImageBitmap(this, *m_small_images, index, *dc, x, y);
}
else if ( InReportView() && (m_small_images))
else if ( HasFlag(wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) && m_small_images )
{
wxDrawImageBitmap(this, *m_small_images, index, *dc, x, y);
}
@ -3327,15 +3319,7 @@ void wxListMainWindow::GetImageSize( int index, int &width, int &height ) const
{
m_normal_images->GetImageLogicalSize(this, index, width, height);
}
else if ( HasFlag(wxLC_SMALL_ICON) && m_small_images )
{
m_small_images->GetImageLogicalSize(this, index, width, height);
}
else if ( HasFlag(wxLC_LIST) && m_small_images )
{
m_small_images->GetImageLogicalSize(this, index, width, height);
}
else if ( InReportView() && m_small_images )
else if ( HasFlag(wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) && m_small_images )
{
m_small_images->GetImageLogicalSize(this, index, width, height);
}