The changes of the previous commit were insufficient, as we could also
use an invalid column index when handling mouse event in an empty grid.
Fix this by checking for the line validity in PosToEdgeOfLine() instead
of adding another ad hoc check to wxGridColLabelWindow itself, as it
seems reasonable for this function to verify that it uses valid indices.
See #18629.
When the grid is empty, XToCol() has no choice but to return invalid
index (because there are no valid ones) when it's called from the
drawing code and passing such indices to GetColPos() results in an
assert, which is fatal inside wxEVT_PAINT handler.
Just short-circuit all this code by not doing anything in the case of
empty grid. This is sloppy, but simpler and more robust than any
alternatives.
Closes#18629.
It is said in the wxDC::DrawText() documentation that current logical function is ignored by this function (e928566f). This should apply also to wxGCDC implementation for the sake of consistency and text drawing should be always done with wxCOPY mode regardless of the current mode set.
This makes more sense for a page of a GtkNotebook, which is always
positioned at (0, 0) relative to its client area, and is also more
compatible with wxMSW.
Closes#18548.
Closes https://github.com/wxWidgets/wxWidgets/pull/1670
macOS 10.12+ implements automatic tabbing in the OS. This adds
entries to the menus and also adds a tab bar. Some applications
might want to disable this, so provide an interface for doing this.
Closes https://github.com/wxWidgets/wxWidgets/pull/1674
Add support for this attribute for text-like cells to the native macOS
version too, to bring it up to parity with the generic and GTK ones.
Closes https://github.com/wxWidgets/wxWidgets/pull/1673
Don't execute uname in Unix version of wxIsPlatform64Bit () to
determine if the current platform is 64-bit capable if the binary is
already a 64bit one.
This is consistent with how MSW implementation behaves and avoids a
pointless invocation when running 64-bit binaries.
As an added benefit, this prevents user harassment by macOS 10.15 if
they launch a wx application from a "protected" location like ~/Desktop
or ~/Downloads - apparently stat()ing CWD is considered evil and
privacy-invading these days.
Don't "override" UpdateBackingFromWindow() method of the base class
unless it really exists, which is only the case for the generic
wxDragImage implementation but not the native MSW one.
See https://github.com/wxWidgets/wxWidgets/pull/1671
The sample could crash after the following sequence of actions:
1. Resize splitter to hide the right/left window.
2. Activate replace menu action.
Fix this by checking if the window being replaced is non-null.
Closes https://github.com/wxWidgets/wxWidgets/pull/1672
Cairo colour patterns support only RGBA colours and therefore it is not
possible to create a colour pattern from wxPen with non-RGB colour
(non-solid colour). As a workaround under wxOSX for solid wxPen with
non-solid colour we can convert it to Cairo surface pattern (stiple)
because under wxOSX non-solid colour is actually represented by a pattern
image.
Cairo colour patterns support only RGBA colours and therefore it is not
possible to create a colour pattern from wxBrush with non-RGB colour
(non-solid colour). However under wxOSX, when we have a solid wxBrush with
non-solid colour, we can convert it to Cairo surface pattern (stiple)
because under wxOSX non-solid colour is actually represented by a pattern
image.
Under wxOSX non-solid wxColour with NSColor backend is represented by
pattern image and it would be useful to have ability to get it e.g. to help
dealing with non-solid wxColours by frameworks not supporting such colours,
like e.g. Cairo.
It turned out that drawing horizontal/vertical lines with optimized function based on ExtTextOut() Win API works as expected only for non-scaled DC. Therefore we can use this optimized way of drawing only for non-rotated and non-scaled DCs.
On not-scaled DCs we can use optimized function to draw also 0-pixel width lines (as a 1-pixel wide lines for compatibility with Win API).
Closes#18612.
Improve colour selection in AUI tab art code: prefer to use the system
colours and only fall back on the replacement ones if the contrast is
too small for the text using system colours to be readable.
Closes#18601.
Select the appropriate text colour depending on the background to ensure
that it remains readable even when using themes/modes using dark
background colours -- which wasn't at all the case before.
Closes#18601.
Partially work around currently unimplemented cache invalidation in
wxMac and do it on the fly if an invalid index is passed to
GetDisplay() to at least avoid crashing, even if this doesn't fully
solve the problem, e.g. we still can use stale information.
Closes#18607.
Don't update the grid appearance when inside a sequence of batch
operations, it will be updated at the end of it anyhow and doing it in
the middle only results in extra flicker.
Since the changes of dda6aa6bdc wxGrid
code could ask the grid table for the data of an invalid cell due to
redrawing the old, and now possibly invalid, current cell from inside
SetCurrentCell() called from wxGrid::Redimension().
Fix this by explicitly resetting the old current cell to an invalid
value when changing it in UpdateCurrentCellOnRedim().
Also avoid calling SetCurrentCell() entirely if the current cell doesn't
change, as this is just completely unnecessary and results in a possible
unexpected wxEVT_GRID_SELECT_CELL event.
See https://github.com/wxWidgets/wxWidgets/pull/1546
The recent change of 19844d27ac fixed this
function for valid values of input/output parameters on input, but broke
it if the parameters had invalid value: in this case, we still need to
fill them even if this attribute doesn't have any specific alignment of
its own.
Account for this case too now, explain the logic of this function in the
comments inside it and extend the unit test to check for this case too.
Now the function should really conform to its documented (and expected,
including by the existing code in various grid renderers) behaviour.
Closes https://github.com/wxWidgets/wxWidgets/pull/1665
The change of 4990515aba resulted in
(disabled by default, but which may be enabled when building
applications using wxWidgets) MSVS 2017 warning C4265 ('class' : class
has virtual functions, but destructor is not virtual), so test for clang
explicitly instead of just testing for non-gcc.
Obtaining bytes per row makes sense only for bitmap image representation
so we have to ensure that the bitmap represenation exists before querying
for its row stride length. NSImage per se cannot provide this information.
Closes#18606.
In order to get access to wxBitmap's pixel data we actually have to work
with CGBitmapContext data and this context is created from NSImage by call
to wxBitmapRefData::EnsureBitmapExists() when we prepare to get access
to the data in wxBitmapRefData::GetRawAccess().
So, when we finish updating bitmap data we should update original NSImage
with actual CGBitmapContext data in wxBitmapRefData::EndRawAccess().
See #18606.
Fix positions of the checkboxes drawn by wxGridCellBoolRenderer and
shown by wxGridCellBoolEditor so that there is no jump when starting or
stopping to edit grid cells with boolean values.
See https://github.com/wxWidgets/wxWidgets/pull/1662
Using wxRendererNative::GetCheckBoxSize() as the size of wxCheckBox just
doesn't work with GTK 3, as the control has additional padding between
its actual contents and the focus rectangle, which means that its actual
size must be greater than the size to be passed to DrawCheckBox() in
order to draw a checkbox of the same size.
However it isn't really necessary to resize wxCheckBox at all, it's
enough for DrawCheckBox() to produce a check mark of the same size as
that shown in a default-sized wxCheckBox and this does work in wxGTK.
So keep the default size of wxCheckBox to make everything work.
This means wxGetGridCheckBoxRect() is not useful any more, so replace it
with wxGetContentRect() which just positions a rectangle of the given
size inside another one (this should probably be moved somewhere else,
as it's more general than wxGrid).