Under wxGTK+2, when wxBitmap has a wxMask but this mask shouldn't be used
in the actual drawing (useMask parameter in wxDC::DrawBitmap() is set to
false), we need to get bitmap data from the buffer with raw (original,
non-masked) data and not from the buffer containing data with mask applied.
Close#18498.
Under wxGTK+2 bitmap data with mask and without it (raw) should be stored
in the separate GdkPixbuf buffers - just like it's done in wxGTK+3. These
two buffers are necessary because only GdkPixbuf with raw bitmap data
(original, non-masked) should be copied when wxBitmapRefData instance is
cloned e.g. in SetMask(). GdkPixbuf with masked data is not copied and is
created on first use in wxBitmap::GetPixbuf().
Closes#18508.
See #18498.
The initial value was not taken into account before because the best
size computed before it was set, i.e. for the empty control, was always
used, as it was never invalidated.
Do invalidate it now if the control is created with non-empty value, in
order to adjust its best, and initial, size appropriately to its
contents.
Closes#18507.
Closes https://github.com/wxWidgets/wxWidgets/pull/1560
Cast the dialog pointer to wxFileDialogBase to avoid failures when using
wxGenericFileDialog, which inherits from wxFileDialogBase, but not from
wxFileDialog itself.
Closes#18506.
Use wxHeaderCtrl-specific GetColumnTitleWidth() function to account for
the native header control margins, otherwise the computed width could be
insufficient for short columns, resulting in their ellipsization.
This makes it possible to get the appropriate column width from outside
the class, as GetColumn() itself is currently protected and so the
existing overload couldn't easily used.
Follow Wine in using 3*SM_CXEDGE as margins on each side.
This also has the advantage of working better in high DPI, as we don't
hardcode the value in pixels any longer.
Add wxGrid::DisableHidingColumns() method which can be used to prevent
wxHeaderCtrl from allowing the user to hide columns interactively, which
is something it allows to do by default, unlike the "built-in" wxGrid
header.
Also add EnableHidingColumns() and CanHideColumns() for consistency with
the other similar methods.
Closes https://github.com/wxWidgets/wxWidgets/pull/1554
wxOSX asserts if a menu item with id of 0 is created, so use 1-based IDs
to avoid this.
Using an explicit constant for the base instead of using 0 implicitly
also arguably makes the code more clear.
Closes https://github.com/wxWidgets/wxWidgets/pull/1555
For bitmap with both alpha channel and mask we have to apply mask on our own because 32 bpp icons don't work properly with mask bitmaps. To do so we will create a temporary bitmap with copy of RGB data and with alpha channel being a superposition of the original alpha values and the mask.
See #18498.
For 32 bpp wxBitmap with both alpha channel and mask we have to apply mask on our own while drawing the bitmap because MaskBlt() API doesn't work properly with 32 bpp RGBA bitmaps. To do so we need to create a temporary bitmap with copy of original RGB data and with alpha channel being a superposition of the original alpha values and the mask.
See #18498.
Avoid touching the model while updating the control due to the items
being deleted from it, as doing this can easily result in dereferencing
pointers to the already deleted objects and crashing.
This is rather ugly, but the original code seems to have been written
with this approach in mind (see preexisting comments in ItemDeleted())
and, to be fair, there doesn't seem any other solution with the existing
API, as it allows (or maybe even requires?) deleting the items _before_
notifying the control about their removal and so not giving it any
opportunity to stop editing the item while it's still alive.
Closes#18337.
Having 2 different overloads might have been useful for Carbon
implementation, but as they do exactly the same thing in the Cocoa
version, leave only one of them -- and don't pass it the item, or items,
being deleted as they're not used anyhow.
No real changes.
Pressing Backspace in controls with custom autocompleter previously
didn't do anything at all, as it didn't work correctly after backspacing
over the just inserted autocompletion, but this was clearly wrong, as it
didn't update the list of available completions even after erasing some
non-autocompleted characters.
Fix this by handling Backspace as any other key and just avoiding
refreshing the control contents needlessly if the completion prefix
didn't change.
Closes#18503.
Avoid calling wxGrid::SetCurrentCell(0, 0) when the grid has no columns
or rows, as it doesn't have any cells then and doing this logically
fails the precondition assert in GetColPos().
Also refactor all 6 different snippets calling SetCurrentCell() in
Redimension() into a single function to simplify the code and make it
more maintainable.
Add a unit test verifying that this works as intended.
Closes https://github.com/wxWidgets/wxWidgets/pull/1546
Sending events from e.g. AssociateModel(NULL) made the GTK version
inconsistent with the other ones, neither of which sent any events in
this case, and could result in a lot of grief in the user code if it
didn't expect the event handler to be called at this moment (e.g. during
the destruction).
Make wxGTK compatible with the other ports and safer by always disabling
the selection changed events before calling gtk_tree_view_set_model().
Note that it's still incompatible with the other ports because they also
preserve the selection even after the change of model, but wxGTK loses
it. Ideally this would be fixed too, but for now live with this as the
lesser evil.
Instead of actually deleting all the items from the control, just
refresh it by resetting the model, as this is what Cleared() does in
both the generic and native macOS versions of wxDataViewCtrl, so calling
it there resulted in very different results from doing it under wxGTK,
where instead of refreshing the control contents it raelly cleared it.
The name of this method is unfortunately confusing, but it seems better
to change its behaviour in wxGTK, even if this doesn't match the name,
rather than change it in the other ports to make them do the same thing,
as this could break some currently working code.
Also, this change results in a welcome code simplification.
This is useful to investigate inconsistencies in its behaviour between
the generic and the native GTK versions that can't be easily checked in
the automatic unit tests.