This just uses the existing wxImage ctor from XPM data and wxCursor ctor
from wxImage, but will allow the code creating cursors from XPM to still
work even when wxImage ctor from XPM is made explicit.
Add a trivial test just to check that the new ctor can be used.
Use the same name as in the other ports for the function doing the same
thing, there doesn't seem to be any good reason to name it differently.
Also avoid declaring it when wxUSE_IMAGE==0 as it's not defined in this
case (again, consistently with the other ports).
wxGTK already did it like this, but also only declared ctor not taking
wxImage in this case, while wxMSW and wxMac declared this ctor in any
case, even when wxUSE_IMAGE==0, but didn't define it then.
This doesn't matter much anyhow, as the build with wxUSE_IMAGE==0 is
clearly broken and these changes are not enough to fix it, but be at
least somewhat consistent and:
1. Don't declare methods using a class which is not available at all.
2. Do define methods using wxImage only internally, even if they do
nothing when it's not available.
No real changes.
For monochrome icons height reported by GetObject() is doubled because
icon bitmap contains both AND and XOR masks. To get actual icon height
we need to divide the value by 2.
Closes#19146.
This variable was added back in 3ef22a5b02 (trying to fix race
conditions. double deletions and memory leaks on thread termination...,
2003-09-21), but not used even then, nor ever since, so just remove it.
Not doing it could result in using the now invalid or, worse, reassigned
to some other DLL, TLS slot if the library is initialized again later.
Also add asserts checking that the index is initialized before using it.
wxWidgetCocoaImpl injects implementation of several
NSDraggingDestination protocol methods, but never called their base
implementations, presumably on the assumption that drag and drop is
explicitly supported and not builtin into native NSView-derived
controls.
This prevented native builtin d'n'd in e.g. NSTextView (text can be
copied and inserted by dragging it to the insertion point) from
working. Fixed by always calling base implementation.
Closes https://github.com/wxWidgets/wxWidgets/pull/2320
No real changes, just use the same _PropertySheetDisplayName element as
the standard style sheets use to show a slightly more user-friendly
label in the Property Sheet manager window in MSVS.
If we have to change the client size, it's better to do this before
sending the event whose handler might rely on the size being already
correct.
Co-Authored-By: Paul Cornett <paulcor@users.noreply.github.com>
This fixes a problem similar to that fixed in the previous commit but
for SetMinSize(), which was also ignored if done after calling
wxSizer::Fit() and before showing the window, as the explicitly set min
size was also overwritten by the pending min size computed from the
client size corresponding to the sizer fitting size.
The fix is similar too: just invalidate the pending minimum size if
SetMinSize() is called.
Calls to SetSize() were ignored in wxGTK if they happened after calling
wxSizer::Fit() since the changes of f655a52fba (Allow wxSizer::Fit() to
work properly when called from TLW ctor on GTK3, 2020-04-20) because we
overwrote the explicitly set size with the client size computed earlier
by the sizer.
Don't do this by explicitly forgetting the client size we were going to
set when SetSize() is called.
Closes#19134.
Add wxWindow::WXSetInitialFittingClientSize() instead of handling wxGTK
TLWs specially in the common wxSizer code and override it in wxGTK to
remember that we need to reset the client size once the window is shown.
This commit shouldn't result in any changes in the observed behaviour.
Just extract the code generating wxEVT_SHOW for TLWs in wxGTK in its own
function before modifying it to avoid having to do it in two places.
No real changes, this is a pure refactoring.
This breaks existing unit tests using wxUIActionSimulator that do things
similar to
wxUIActionSimulator sim;
sim.Char('o', wxMOD_CMD);
wxTEST_DIALOG(wxYield(), ... expected "Open" dialog ...);
because the expected dialog would be shown from inside Char(), unlike
with the wxMSW implementation and GTK until the changes of 59ad9f46e6
(Make wxUIActionSimulator works more reliably on GTK/X11, 2020-05-07).
To still make sure there is a delay after the event, sleep, if
necessary, before simulating the next event: this is still enough for wx
test suite to pass, but allows the code like above to work with both
wxMSW and wxGTK.
In fact, doing it like this makes the code simpler and removes the need
to distinguish between press and release events or maintaining the
number of currently simulated-as-depressed buttons or keys, so it also
simplifies things as a side effect.
Also add some comments and rename Default_Delay constant to a more
accurately named MIN_DELAY_BETWEEN_EVENTS.
Closes https://github.com/wxWidgets/wxWidgets/pull/2318
We don't seem to be doing anything wrong, but ASAN detects many such
leaks as soon as we call functions such as gtk_css_style_render_icon()
(used by wxRendererGTK::DrawCheckBox()) and several others.
Briefly explain how to check that wxWidgets is installed correctly.
This is again redundant with the information already present elsewhere,
but it seems worth repeating it here.
Currently this simply links to the existing port-specific installation
instructions, but this should provide a less confusing and more
prominent entry point than the existing topics.
It is surprising that "for (auto& c: s)" doesn't compile, so document
this and propose a replacement.
Do not document the fact that "for (auto c: s)" actually allows to
modify the string via "c" (which is still wxUniCharRef) as this is
probably just going to confuse people more than help.
Events and sizing is more important than Unicode or i18n, so put them
first.
Also "important" doesn't really mean anything, so use a hopefully more
clear section name.
We can use BCM_GETIDEALSIZE message to get the size of the button that
best fits its text and image (if present).
It gives better results for text wxButton with wxBU_EXACTFIT style.
This was added 52cc838b12 (Implement 0-width pen consistently in
wxGraphicsContext, 2021-04-05) but doesn't seem useful and, in fact, was
not used at all in the constructor body, resulting in an unused
parameter warning, so just remove it.
No real changes.
This shortcut is undocumented, but works in rich edit controls and even
in plain ones if they use SHAutoComplete(), so support it in all
controls because this is what people expect.
Since f7247086c2 ("Fix storing wxBitmap data in GdkPixbuf", 2019-09-18),
919a4ec702 ("Fix drawing wxBitmap with mask", 2019-09-18) and other
commits (see #18498, #18508) RGBA wxBitmaps with masks are drawn properly
under wxGTK2 so if source wxImage has both alpha channel and a mask
the target wxBitmap also should have both components.
Since f7247086c2 ("Fix storing wxBitmap data in GdkPixbuf", 2019-09-18),
919a4ec702 ("Fix drawing wxBitmap with mask", 2019-09-18) and other
commits (see #18498, #18508) RGBA wxBitmaps with masks are drawn properly
under wxGTK2 so only wxBitmap raw RGBA data should be transferred to
wxImage RGBA data because mask is stored in the target wxImage separately.