Passing non-const data is inconvenient and error-prone, as data can't be
used again after it was modified by Nano SVG, which resulted in the
button using SVG bitmap not working any longer in the toolbar sample
after recreating the toolbar.
So make it easier to do the right thing, while still keeping the
overload taking non-const data for the situations when avoiding an extra
copy is worth it.
Add nanosvg submodule and use it in the generic implementation of this
function.
This is incomplete yet and, notably, doesn't cache the rasterized
images, but already shows that using SVG images works (at least in the
toolbar sample).
This actually reverts the sample to the version in master, which used
wxBitmap::Get{Width,Height}(), but just replaces "w" and "h" variables
with a single "sizeBitmap" one.
Also stop hard-coding (100, 100) position for it, there is no real need
for it and it's better to let the window be positioned automatically.
No real changes.
This first version provides only a generic implementation of
wxBitmapBundle using a collection of bitmaps and only supports using it
in wxToolBar in wxMSW and wxGTK.
More methods of creating wxBitmapBundle will be provided later and more
functions taking wxBitmap will be changed to take wxBitmapBundle later
too and, of course, all the other ports will be updated to use the new
API too.
Instead of just saying that Bind() is better, provide some points
illustrating why is it better.
Notable mention that Connect() can only be used with methods of the
classes publicly inheriting from wxEvtHandler, unlike Bind().
Closes#19266.
Range may be -1 when wxSHOW_SB_ALWAYS is used, see
wxScrollHelper::DoAdjustScrollbar(), so check for it to avoid spurious
asserts in this case.
Closes https://github.com/wxWidgets/wxWidgets/pull/2540
When touch events were enabled, normal mouse move and click events were
not generated any longer. Fix this by doing the following two things:
First, emulate the LeftDown, LeftUp, and Motion events, that are no
longer triggered when using the "touch-event".
In addition, remove GDK_BUTTON1_MASK in the press callback, that is
never set when using a mouse, but that is set for some reason by GTK
when using a touchscreen.
See https://github.com/wxWidgets/wxWidgets/pull/2539Closes#19265.
Signed-off-by: Thierry Bultel <tbultel@free.fr>
wxObjectDataPtr::operator=() didn't handle self-assignment correctly,
i.e. could delete the object when doing "x = x".
Fix this by incrementing the reference count before decrementing it on
possibly the same object to ensure that it never reaches 0.
This function is currently used for relatively small icons in
wxArtProvider and wxSearchCtrl, so it shouldn't be a problem to use
wxIMAGE_QUALITY_HIGH from performance point of view and if it ever does
become a problem, the application could easily use wxImage::Rescale()
with a different option directly instead.
Define a single function and use it in both wxArtProvider and (the
generic implementation of) wxSearchCtrl instead of repeating the same
code elsewhere.
Note that another, but slightly different, version of RescaleBitmap()
still remains in wxPropertyGrid.
Deprecate undocumented wxArtProvider::RescaleBitmap() which is
completely useless now.
No real changes, this is just a refactoring.
Use native scrolling under MSW, just as we already did under X11,
instead of our own version which doesn't work correctly when scrolling
using the mouse wheel.
See https://github.com/wxWidgets/wxWidgets/pull/2525
Unlike the existing wxHAS_IMAGES_IN_RESOURCES constant defined only
under MSW, the new one is also defined under Mac and could be defined
for the other platforms/ports later (e.g. wxQt could probably support it
too).
It's unfortunate that two very similar constants are needed, but it
doesn't seem wise to change the meaning of the existing constant, as
this would change how the commonly used wxICON() and wxBITMAP() macros
behave and would break all our own samples that use them for their frame
icon but don't embed this icon into the bundle resources under Mac.
Do change the toolbar sample to use the new constant however, as this
one does include the bitmaps it uses in its bundle under Mac.
On macOS >= 11 wxListBox has a new layout because underlying
NSTableView has a new style with padding so we need to move
the point to be tested to another position.
In wxComboBox::SetString() implementation for wxMac the item is
first removed from the list so its selection is invalidated.
We have to retain it so we need to re-select just inserted item.
OpenVMS build was broken by 303d899cc0 (Make STL-based wxList more
compatible with the default one, 2021-09-02), try to blindly fix it by
casting the element to the same type it had had before.
Check that Find() of a list declared using WX_DECLARE_LIST_3 (as
wxWindowList is) can be passed a pointer to the base class object and
still compiles and works correctly.