Use wxBitmapBundle in wxDataViewCtrl-related classes

Extend the existing use of wxIcon in wxDataViewIconText,
wxDataViewCheckIconText, the corresponding renderers and
wxDataViewTreeCtrl to wxBitmapBundle.

As with the other classes, the existing setters have been preserved as
they remain almost entirely compatible with the existing code and the
return type of the existing getters was preserved, with new getters
being introduced for returning wxBitmapBundle only where they're really
required.

Update the sample to use wxBitmapBundle with its wxDataViewTreeCtrl.
This commit is contained in:
Vadim Zeitlin
2022-01-23 00:52:45 +00:00
parent 90bbde8777
commit 4073f3b9bf
10 changed files with 173 additions and 174 deletions

View File

@@ -17,17 +17,10 @@
#include "wx/wx.h"
#endif
#include "wx/artprov.h"
#include "wx/dataview.h"
#include "mymodels.h"
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
#include "null.xpm"
#include "wx_small.xpm"
// ----------------------------------------------------------------------------
// MyMusicTreeModel
// ----------------------------------------------------------------------------
@@ -378,20 +371,10 @@ MyListModel::MyListModel(int modelFlags) :
m_iconColValues.assign(NUMBER_REAL_ITEMS,
useMultiLine ? multiLineText : wxString("test"));
m_icon[0] = wxIcon( null_xpm );
const wxSize size = GetIconSizeFromModelFlags(modelFlags);
const int newSize = m_icon[0].GetWidth() * 2;
const bool useTallRows = (modelFlags & MODEL_USE_TALL_ROWS) != 0;
if ( useTallRows )
m_icon[0].CopyFromBitmap(
wxImage(null_xpm).Rescale(newSize, newSize));
if ( !useTallRows || (modelFlags & MODEL_KEEP_LOGO_SMALL) )
m_icon[1] = wxIcon( wx_small_xpm );
else
m_icon[1].CopyFromBitmap(
wxImage(wx_small_xpm).Rescale(newSize, newSize));
m_icon[0] = wxArtProvider::GetBitmapBundle(wxART_QUESTION, wxART_LIST, size);
m_icon[1] = wxArtProvider::GetBitmapBundle(wxART_WX_LOGO, wxART_LIST, size);
}
void MyListModel::Prepend( const wxString &text )