Add ability to get the size of the checkbox without any margins by
passing wxCONTROL_CELL flag: this can be useful when the checkbox is
part of some "cell", e.g. wxGrid one, and doesn't need any extra margins
around it.
Currently wxCONTROL_CELL is only really used by wxGTK2 implementation.
This method of wxGtkStyleContext uses a GTK function only available
since 3.20, and so can't be implemented for the earlier versions, hence
don't even define it in this case.
Note that the caller still needs to test for the run-time version.
The changes of 173f035bc2 resulted in
unknown warning group '-Wcast-function-type', ignored [-Wunknown-warning-option]
diagnostics from clang (even clang-10) and, presumably, also from
versions of gcc earlier than 8, which added this option, so use the
special wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() macro added in
ed01fede2e just for this instead.
No real changes.
Size should include border and padding. Margin values seem to be for a checkbox with text
label, so don't include margin. Check mark should be drawn inside border and padding.
Don't return RGB values if colour is not solid
and hence cannot be represented with these values.
Non-solid colour should be reported as an unknown
RGB value, e.g. '??????'.
Closes#18596.
Just use hardcoded 2px overlap between the text control and the spin
buttons, as it doesn't seem to depend on the DPI and works in both LTR
and RTL modes, unlike the existing code, which claimed to work but
actually didn't.
Closes https://github.com/wxWidgets/wxWidgets/pull/1660
Replace a few occurrences of
type var
= value;
with
type var =
value;
which is used much more widely in wx sources for consistency.
Also get rid of a couple of such lines, when it could be done easily.
No real changes.
Sockets returned by wxSocket::Accept() are non-blocking by default and
the only way to use them safely in worker threads is by switching them
to the blocking mode by calling SetFlags(wxSOCKET_BLOCK).
However this didn't work correctly since at least 2.8 days, as turning
wxSOCKET_BLOCK on didn't unregister the socket from the event loop, with
which it had been registered on creation. Fix this by doing this now,
which ensures that the main thread doesn't get any notifications about
the socket if it's used, in a blocking way, in a worker thread.
Note that making the new socket blocking after accpeting is still pretty
inefficient and pre-creating the socket as blocking and using
AcceptWith() is still preferable, but at least it does work now.
Closes#12886.
In addition to unblocking and registering the socket, also support using
this function to make the socket blocking and unregistering it from the
event loop, if its flags include wxSOCKET_BLOCK.
This was already half-done by wxMSW, which took wxSOCKET_BLOCK presence
into account in its implementation, but not by the Unix implementation.
Now do it under all platforms, as this will be useful for switching a
previously non-blocking socket to blocking mode.
Finally, rename the function to better reflect what it really does.
See #12886.
It should still be possible to use DoEnableEvents() to disable events
for blocking sockets and this can be useful if a previously non-blocking
socket became blocking due to a SetFlags(wxSOCKET_BLOCK) call, so adjust
the fix of e18c8fd29a (see #17031) to
avoid calling EnableEvents() for blocking sockets instead of ignoring
them in DoEnableEvents() itself.
Also add an assert checking that we never try enabling events for
blocking sockets as this still doesn't make sense and so shouldn't
happen.
No real changes yet, but this is necessary for the upcoming commits.
See #12886.
Fix bug with not being able to update wxTaskBarIcon under MSW after a
DPI scale change or [dis]connection of another monitor using different
DPI: this resulted in "TaskbarCreated" message being sent by the system,
which we handled by trying to create the taskbar icon again. However in
this case, recreating it failed, presumably because it still existed, as
modifying the existing icon still worked.
Change the handle of "TaskbarCreated" to try both adding and updating
the icon, as it seems that we can't be sure whether we still have it or
not when we get this message.
Refactor the existing code to specify the operation to perform when
calling the new DoSetIcon(). This actually makes things slightly simpler
for it, as it doesn't need to update m_iconAdded inside it any more.
Closes#18588.
This breaks Mac build by default and shouldn't be done. In fact, Cairo
should be used only optionally under MSW and Mac, where it's not always
needed, so add a new configure option to request it.
There is absolutely no good reason to do it and it resulted in
silently truncating all the string formatted using "%s" to their first
65535 characters when using our wxPrintf() implementation.
Closes#18586.
The code in the example showing how to create a new event class
confusingly used several names for the event type.
Fix this and also prefix the name of the new event type with "EVT_" to
match wxWidgets convention for naming event types.
Also explicitly mark the parts that are not needed if only Bind() is
used for event handling.
Closes https://github.com/wxWidgets/wxWidgets/pull/1586
A just created control shouldn't be considered modified, so reset its
modified state in Create().
And add a unit test checking that IsModified() really behaves as
expected.
Closes https://github.com/wxWidgets/wxWidgets/pull/1652
We don't need it any more, just define individual tests as independent
test cases.
This required using some other pointer instead of "this" in one of the
tests, but it doesn't really matter which pointer we use there anyhow.
No real changes.