The change in the value can be greater than 1 when the arrows are held
pressed, contrary to what the logic of determining the wraparound added
in 086793ceef supposed.
Replace this with a check of whether we switch from the min value
directly to the max one or vice versa, which mostly works and avoids
asserts, even if it can still fail and produces wrong events when the
arrows are held pressed for long enough to increase the delta to the
range of the control, in which case we just can't distinguish between
wraparound and passing from min to max (or vice versa) in a single step,
which means that we have no way to determine the right event to send.
But producing a wrong event is better than asserting, so this still
counts as an improvement.
Closes https://github.com/wxWidgets/wxWidgets/pull/1764
See #17957.
Closes#18695.
This variable was written to and read from different threads without any
synchronization, which resulted in tons of TSAN warnings -- in addition
to being incorrect, of course.
Fix this by using C++11 atomic type for it if available and just not
doing anything otherwise, as there doesn't seem to be any simple
workaround for this problem without an atomic 64 bit type that our own
wx/atomic.h doesn't currently provide.
Make the left arrow collapse the item if it's currently expanded before
falling back to its previous behaviour of going to the item parent and
the right arrow to go to the first child if the item is already
expanded.
This is compatible with the native MSW control behaviour, but mostly
just more useful and convenient.
Closes#18684.
Don't deselect all the other items when an item is collapsed or expanded
in wxGenericTreeCtrl with wxTR_MULTIPLE style, this was completely
unexpected and seems to have been accidentally introduced back in
35cf1ec63cCloses#18680.
Don't call GetSelections() unnecessarily if we're not going to use its
result in any case because either Shift or Command/Control key was
pressed when the mouse button was released.
See #18680.
This test remained since 902725eefe but
should have been simply removed back then, as we return if the item is
null due to a test above.
No real changes.
Set LVCFMT_IMAGE, meaning that the column just uses an image from the
image list, instead of LVCFMT_COL_HAS_IMAGES, meaning that the column
contains the image from the image list and do not set LVCF_IMAGE when
resetting the image, as this still reserved space for the (invalid)
image, resulting in an extra blank area in the column header.
Closes https://github.com/wxWidgets/wxWidgets/pull/1739Closes#18617.
GetTextObject() might return null, e.g. it does it for read-only
wxBitmapComboBox, so EnableTextChangedEvents() must account for this
possibility, as it's not really possible to avoid calling it in this
case, as it's called indirectly from e.g. SetSelection().
Check that the entry is valid before enabling or disabling events for it
to avoid several GLib assertion failures every time when e.g.
wxBitmapComboBox::SetValue() is called.
Closes https://github.com/wxWidgets/wxWidgets/pull/1756
Somehow emulating the column resizing doesn't work there, even though it
works perfectly reliably locally. This might be due to some display
optimization options used in this environment, but it's difficult to
debug what's going on there, so just disable the test when running under
AppVeyor for now.
Update the column width immediately, as it's being dragged, instead of
drawing a temporary line showing the new column boundary using wxINVERT.
This results in better user experience, as it the effect of changing the
column width can be immediately seen (especially important for non-left
aligned columns or columns using ellipsizition) and, equally if not more
importantly, fixes wxGrid drag-resize not showing any visible UI at all
with wxGTK3 and wxOSX where wxINVERT is not implemented.
Rename the functions used from wxGridHeaderCtrl event handlers to start
with DoHeader prefix to make it clear that they're (only) used by it in
an attempt to make things more clear and more uniform.
No real changes.
This probably doesn't matter much, but use the correct mouse position in
this event, expressed in wxGrid coordinate system instead of using
screen coordinates.
Don't reuse the same m_dragRowOrCol variable for both the index of the
row or column being drag-resized and for the index of the column being
drag-moved. Reusing it was confusing and made it more difficult what the
code was doing and what invariants were preserved in it, and just wasn't
worth saving a few bytes per wxGrid object.
No real changes.
Use new ShouldRefresh() helper instead of testing for !GetBatchCount()
before calling Refresh().
Also check for GetBatchCount() inside CalcDimensions() itself, which
means that it can now be called unconditionally.
No real changes.
This results in a single intelligible error instead of a hundred of less
clear ones in case our code is compiled against an out of date SDK
version.
There doesn't seem to be any way to check the version directly, so just
check that the interface which hadn't been defined in the previous
version is defined now to check for it indirectly.
Instead of using a single test case, with multiple sections, generated
by CppUnit compatibility macros, use multiple independent test cases.
This makes it more convenient to run individual tests, simplifies the
code and allows to get rid of ugly "pseudo tests".
It is convenient to have this function if only in order to be able to
call GetGridColHeader() safely, i.e. without triggering an assert if
native header is not being used.
This is appropriate for single selection, where the selected item is
also always the focused one, but not in the multiple selection case.
And wxMSW native version already behaves like this, so this makes the
generic one consistent with it.
Closes#18691.
The behaviour of these functions for the tools containing controls is
counter-intuitive but changing it now would silently break existing code
working around the current semantics, so just document it instead.
See #16552.
When the bitmap is larger than the draw area, it should be resized. Do this by
providing the correct size parameters for ID2D1RenderTarget::DrawBitmap.
Also update DrawBitmap code guarded with wxD2D_DEVICE_CONTEXT_SUPPORTED so it
will compile successfully when enabled. However, the drawing behaviour is,
and was, different from the normal behaviour. It does not resize the bitmap.
Closes#18686
Since it appears it's not possible to create DirectWrite fonts with
IDWriteGdiInterop::CreateFontFromLOGFONT() for fonts registered with
AddFontResourceEx() as private ones (with FR_PRIVATE flag), we need to
maintain a custom DirectWrite font collection and use it as source of
font data if call to CreateFontFromLOGFONT() fails. This collection
consists of IDWriteFontFileEnumerator and IDWriteFontCollectionLoader
objects which are seeded with font data based on the private fonts list
taken from wxGetPrivateFontFileNames().
Closes https://github.com/wxWidgets/wxWidgets/pull/1753Closes#18687.