Use GetBitmapBundle(), via a helper GetPageBitmapBundle() function which
is going to be useful elsewhere too, rather than GetImageList(), as the
latter only works if the images were set using SetImageList(), while the
new version does the right thing both in this case and when the images
were set using SetImages().
Return the image list set via {Set,Assign}ImageList() if SetImages()
hadn't been called to make this function return the correct image list
in any case, both when using the old wxImageList API and the new one
using wxBitmapBundle.
This commit is best viewed ignoring whitespace-only changes.
It should be possible to call this function on wxWithImages objects
contained in derived classes too.
This commit is best viewed with --color-moved git option.
Still no real changes, but this makes the code simpler and more robust
and prepares the way for adding wxListCtrl methods taking vectors of
bitmap bundles.
This replaces the previously added UpdateImageListIfNecessary() as we
almost always needed the image list after calling that function anyhow,
so it makes more sense to return the image list from it -- which also
required renaming it.
No real changes.
Put the code common to all wxListCtrl implementations in the common base
class instead of duplicating it in wxMSW, wxQt and generic versions.
No real changes yet, this is a pure refactoring which prepares for the
upcoming changes.
This function can be used in the ports that don't require wxImageList
(i.e. anything but wxMSW) to use wxBitmapBundle if it's available,
rather than passing by wxImageList.
Override OnImagesChanged() to call UpdateImageListIfNecessary() even in
wxGenericTreeCtrl for now, although in the future it would really make
sense to stop using wxImageList in its implementation and just use
wxBitmapBundle directly instead.
wxMSW is the only one which really needs an image list, as it's required
by the native control.
Also update the sample, even though it doesn't look very nice because
its icons are only available in a single size, so we have to always
scale them.
This function is not really wxBookCtrl-specific and can be used with
other classes as well, so allow reusing it in them.
No real changes, this is just a refactoring.
Replace direct use of wxImageList with the use of wxWithImages, which
will make adding support for using wxBitmapBundle later simpler.
In fact, this already somewhat simplifies the code by removing the need
to manually take care of m_ownsImageListXXX flags.
Just pretend that the images themselves have changed, this should be
enough to recreate wxImageList from the bundle using the new scale
factor in UpdateImageListIfNecessary().
Such thread names can be shown by some debuggers, and depending on
the OS and compiler versions used, they can be visible in process
lists and crash dumps.
Co-authored-by: PB <PBforDev@gmail.com>
No real changes, but don't complicate the constants definitions
needlessly just to avoid changing the numeric value of WXK_LAUNCH_APP
constants as nobody should rely on them anyhow.
Not doing it simplifies things and allows to condense the mapping from
GDK keys to wx ones.
X11 defines Xf86Launch[0-9a-f], which are then also defined as
GDK_KEY_Launch[0-9A-F].
Unfortunately, keys which are not mapped are just plain ignored and the
application is then not able to receive these keyboard events at all.
The original PR https://github.com/wxWidgets/wxWidgets/pull/157 mapped
only LaunchA/B to WXK_LAUNCH_APP1/2, this patch adds the whole range of
keys and keeps LAUNCH_A/B as aliases for WXK_LAUNCH_APP1/2
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.
Move the code for determining the size preferred by a bunch of bitmap
bundles from wxToolBar to wxBitmapBundle itself to allow reusing it from
other classes.
No real changes, this is just a refactoring.
This commit is best viewed with --color-moved git option.
These functions allow avoiding using wxImageList explicitly in a couple
of places.
No real changes, this just prepares for adding new API not based on
wxImageList.
Define CopyFromIcon() directly in wxBitmapBase for the non-MSW ports, as
it was implemented exactly in the same way in all ports using this class
anyhow.
This means this function is not virtual any longer, but this shouldn't
be a problem as it was never supposed to be overridden in application
code and this couldn't be done with wxMSW, where it never was virtual in
the first place, anyhow.
No real changes, just a simplification.
We must call SetInitialSize() in Create() in order to take the size
argument passed to ctor/Create() into account -- it was completely
ignored previously.
But calling SetBitmap() must not change the initial size, as it can also
be done later, so just change the current size there instead (which is
consistent with wxMSW version and original behaviour, so keep it like
this, even though it's not totally clear if all ports do it).
Remove the now unused wxGenericStaticBitmap::GetBitmapSize().
Instead of defining them, slightly differently, in all the non-MSW
ports, define them once in wxStaticBitmapBase.
No real changes, this is just a simplification.
It's a handle, so make it a WXHANDLE rather than WXLPARAM and avoid
casting the handle when calling it (there is still a cast when calling
::SendMessage() inside this function, but this is unavoidable and this
cast was already there anyhow).
No real changes.
Use different members for storing wxBitmap and wxIcon instead of using a
single pointer for storing a heap-allocated copy of either of them
because this is simpler, more efficient due to avoiding unnecessary
conversions and RTTI, and will be simpler to generalize to using
wxBitmapBundle instead of wxBitmap in the upcoming commits.
As a side effect, don't assert in GetIcon() or GetBitmap() if there is
no valid icon or bitmap, as this is inconsistent with the other ports
and wasn't even consistent between these functions in wxMSW itself.
There should be no other changes in behaviour.
This function was used exactly once and it's simpler and more clear to
just inline it into Free() where it was called.
No real changes, this is just a small simplification.
This will make it possible to change them later without breaking ABI,
which is probably worth paying the price of a function call (assuming
the compiler could de-virtualize this call and inline it before).
No real changes.
We need to be able to change the scale factor of the bitmaps returned by
wxBitmapBundle::GetBitmap(), so add a function allowing to do this.
Also add wxHAS_BITMAP_SCALE_FACTOR allowing to check whether this
function actually does something non-trivial and explain in the docs
that GetScaleFactor() always returns 1 on the platforms where this
symbol is not defined.