The code to handle events split into separate functions dedicated to handle the events of specific type is more readable than the code concentrated in one function handling all kinds of events.
Because changing the number of columns may change their total width from value greater than current client size to the value less than this size or vice versa we need to know this total width prior to determining wxProperyGrid scrolled view in order to account this actual width in the calculations.
The ScintillaWX::ModifyScrollBars method is used to ensure that the
horizontal and vertical scrollbars are constantly up to date. It
computes the needed max and page size for the scrollbars based on a
combination of input data and internal state variables, compares the
needed values with the scrollbar’s current max and page size, and
updates the scrollbars if there is a difference.
Because of the current logic used, the method will try to update the
scroll bars in two cases where no updates are necessary. First, if a
scrollbar is not visible (or if word wrapping is on for the horizontal
scrollbar), ModifyScrollBars currently tries to set the max to 0.
However on some platforms, such as windows, this call can fail and
result in the max actually being set to 1. Consequently subsequent calls
to ModifyScrollBars will assume the value should be 0 but detect the
scrollbar’s max as 1 and try to update the value again. To avoid this,
instead set the scrollbar’s page size to 1 more than the max.
The second case is only for the horizontal scrollbar. Currently, the
function updates the scrollbar whenever the position is not 0. There
doesn’t seem to be any reason for this check, and so it has simply been
removed.
Closes https://github.com/wxWidgets/wxWidgets/pull/1327
Don't use ExtFloodFill() to extend the custom background colour to the
edges as this results in weird problems due to an apparent bug in nVidia
drivers, see #18387.
Instead, just extend the rectangle passed to FillRect(), which doesn't
look quite as good under Windows 10, but is pretty close, and shouldn't
suffer from the nVidia bug while also slightly improving appearance
under Windows 7.
Closes https://github.com/wxWidgets/wxWidgets/pull/1319
If the kind of the bitmap/icon used by the control didn't change (which
will be most often the case, as using both an icon and a bitmap with the
same control is vanishingly rare), there is no need to update the window
style.
No real changes, this is just a micro-optimization.
DeleteCurrentHandleIfNeeded() is already called from Free() which is
unconditionally called at the beginning of the function, so there is no
need to call it again.
This is just a micro-optimization: there is no need to call
InvalidateBestSize() if the size of the bitmap doesn't actually change
(as will most often be the case when this method is called after the
control creation).
wxStaticBitmap tried to automatically resize itself to its new size, but
did it wrongly (since what looks like ever, or at least since the first
version in the VCS, which is 2bda0e1738,
from 21 years ago) because it assumed that the size of wxStaticBitmap
window is the same as the size of the bitmap it is showing, which is not
the case when it uses border style such as wxBORDER_RAISED.
Fix this by resizing it to the current size adjusted by the difference
between the old and new bitmap sizes. Alternative approach would be to
just use SetSize(GetBestSize()), as the other ports do, but keep the
changes to the minimum for now.
Closes#18398.
Calling Flush() is supposed to make everything drawn so far immediately
visible, which means propagating it to the wxImage being drawn on in the
case of image-based graphics context, but wxMacCoreGraphicsImageContext
didn't do it, unlike Cairo and GDI+ version.
Fix this by overriding Flush() in it to explicitly update m_image.
Closes https://github.com/wxWidgets/wxWidgets/pull/1321
Call FormatMessage with the IGNORE_INSERTS flag. Without the flag,
the FormatMessage() call will fail when the error message contains
inserts (such as %1), as we are not providing any arguments.
Various Windows system error messages contain inserts; e.g. error 193.
See also: https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
So far it was implemented as property which could take int values 0/1 so it was acting essentially as a Boolean property. Implementing it explicitly as a Boolean one will make it more intuitive. Legacy code setting 0/1 int values shouldn't be affected because conversion from int to bool is implicit.
All wxPG_FILE_xxx attributes are used only in wxFileProperty to set respective internal data members and don't have to be stored in the property's attribute store.
By moving the code to display file selector dialog from wxPGFileDialogAdapter to wxFileProperty we can encapsulate the operation of showing the dialog because all required parameters are stored in the corresponding data members and there is no need to use call generic GetAttribute() function to retrieve them. This also helps in making wxFileProperty attributes built-ones in the future.
This attribute is used only internally in wxFileProperty so it can be considered as a built-in attribute which value can be stored in the local data member and not in the property's attribute store.
Don't call wxDataViewColumn::GetWidth() in OnPaint() for columns that
are hidden: they won't be drawn and their width won't affect anything.
The call looks deceptively simple, but may invoke best width
recalculation that can be very expensive on large models.