Add wxWithImages::SetImages() and update wxMSW wxNotebook for it

This new function will allow selecting the bitmap of the most suitable
size and automatically react to DPI scale changes (although this hasn't
been implemented yet) in all controls using image lists.

For now, only wxNotebook in wxMSW has been updated to work with it, the
other classes and ports will be updated to override OnImagesChanged()
instead of SetImageList() later.

Also update the notebook sample to use SetImages() rather than
SetImageList() -- which means that it doesn't show the icons any longer
in non-MSW ports, which haven't been updated yet.
This commit is contained in:
Vadim Zeitlin 2021-10-31 20:54:58 +01:00
parent 55819925dc
commit b0d9465921
8 changed files with 138 additions and 28 deletions

View file

@ -15,6 +15,7 @@
#include "wx/vector.h"
class wxBitmapBundleImpl;
class WXDLLIMPEXP_FWD_CORE wxImageList;
class WXDLLIMPEXP_FWD_CORE wxWindow;
// It should be possible to implement SVG rasterizing without raw bitmap
@ -132,6 +133,11 @@ public:
const wxVector<wxBitmapBundle>& bundles,
const wxSize& sizeDefault);
// Create wxImageList and fill it with the images from the given bundles in
// the sizes appropriate for the DPI scaling used for the specified window.
static wxImageList*
CreateImageList(wxWindow* win, const wxVector<wxBitmapBundle>& bundles);
private:
typedef wxObjectDataPtr<wxBitmapBundleImpl> wxBitmapBundleImplPtr;