This results in rather ugly checkboxes when the rectangle is too small,
and even "critical" GTK warnings with wxGTK 3, but is still arguably
better than drawing outside of the provided rectangle.
Doing this makes the checkbox unusable with the default GTK 3 theme as
the default grid background colour (white) is the same as the colour of
the check mark -- so changing the checkbox background to it makes it
invisible.
Work around this by adding a new SetTransparentPartColour() method that
can be used by wxGrid (and, in the future, user code if we decide that
this is really the best solution to this problem that we can provide) to
make the checkbox blend in with its background without actually changing
its appearance.
No real changes, just extract the same code used in both GTK 2 and GTK 3
implementations of GetCheckBoxSize() and DrawCheckBox() in a helper
class which is now just used from both places.
This makes the code more clear and hopefully easier to maintain in the
future.
Put GTK 3 version first in both functions instead of putting it in the
middle (!) of GTK 2 code in the former one for some reason.
No real changes, the code was just moved around (this commit is best
viewed with "git diff --color-moved").
It doesn't make much sense to pass the size to the function supposed to
compute it, so call wxRendererNative::GetCheckBoxSize() from the
function itself instead of forcing its callers to do it.
No real changes.
Make the alignment used by default in wxGridCellBoolRenderer and
wxGridCellBoolEditor consistent and centre the checkbox vertically in
both of them: previously only the editor tried to do it, but failed,
because the code wrongly overwrote the default alignment as it used
GetAlignment() instead of GetNonDefaultAlignment(), while the renderer
didn't even try.
Remove the code in wxGrid::ShowCellEditControl() which moves grid
editors unnecessarily and also remove workarounds that were required
because of it in the editors SetSize() functions.
This helps to ensure that the editor is placed at the same position the
renderer draws the cell value, so that it doesn't jump around annoyingly
when editing starts (which was especially noticeable for boolean-valued
cells).
Make this header self-sufficient, instead of requiring wx/headerctrl.h
to be included before including it.
Remove the now unnecessary wx/headerctrl.h inclusion from
src/generic/grideditors.cpp.
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.