Recent sorting-related changes resulted in calling FindNode(), which
can only be used with the non-"virtual list" models, unconditionally,
after the items values was changed by user, resulting in a crash.
Add the missing IsVirtualList() check and also add a comment explicitly
stating that all code involving wxDataViewTreeNode can only be used
after checking that IsVirtualList() returns false.
Closes#18057.
The comparator used with std::sort() must return true only if the first
item is strictly less than the second one, this is a requirement of the
sorting algorithm and not respecting it results in wrong final order.
See https://github.com/wxWidgets/wxWidgets/pull/642
Check that we have an associated text entry before clearing it.
Fixes a crash introduced by 72fe57ec18
without reverting it as it still seems reasonable to use Clear() here.
Closes#18013.
Do not enable debugrpt and flash examples.
Define UNICODE when building on Windows. This allows the sdk_exe example to build, because it includes the windows headers directly.
uuid should be linked before oleacc, otherwise it causes multiple definition of `IID_IAccessible' (with MinGW64 gcc).
To simplify even more, specify all required libraries in wxTOOLKIT_LIBRARIES, in the same order as in the makefiles.
Add uxtheme library, it is required since wxUxThemeEngine wrapper has been removed.
MinGW compiler predefines WIN32, meaning that wx/msw/winundef.h was
always included from wx/defs.h, even when it was completely unnecessary.
This was just inefficient, but harmless, until the changes of
042d922e88 which broke MinGW compilation
as wxUSE_UNICODE_WINDOWS_H was incorrectly defined during the very first
inclusion of wx/msw/winundef.h, before _UNICODE could be defined
correctly by windows.h.
Fix this by checking whether windows.h was really already included.
Remove various definitions and symbol declarations from
numerous files using msw/uxtheme.h to a single file.
When possible vssym32.h is included from the Windows SDK.
For older SDKs tmschema.h is included and missing symbols
are defined in msw/uxtheme.h.
This undocumented "private" class was used for various windows UxTheme
functions which are available since WinXP. As wxWidgets 3.1 is XP+ it
does not make sense anymore to load the theme functions dynamically.
When having a certain creation sequence, these popup windows were not focused correctly, see https://github.com/wxWidgets/wxWidgets/pull/672 , commit d2265136e359df4d14054860a68bbc7f4910279d , revert this change if problems arise to see whether this is a recursion
Commit bc13119494 removed the inclusion of
xlocale.h because it is not (and never was) needed under Linux with
glibc, but it is still needed under macOS, so this (silently) disabled
wxXLocale support under Mac when using configure and broke the build
when using cmake.
Fix both problems by using xlocale.h only if it's available, both in
configure and in cmake.
Almost totally rewrite the resize-after-toggle code in this control so
that it actually makes sense and works, especially in the situations
when the contents of wxCollapsiblePane changes, for example when it
contains another wxCollapsiblePane inside it which can be collapsed or
expanded. Previously, this didn't work at all in wxGTK and the inner
pane always remained at its minimal, collapsed size. Now it does, after
doing the following:
First, replace the completely useless DoGetBestSize() which just did the
same thing as its base class implementation with the code actually
determining the best size of the window that was previously hidden
inside gtk_collapsiblepane_expanded_callback() for some reason. Note
that the comment about "not caching the best size" in the old code was
very out of date and was probably left over from the days when
GetBestSize() itself was virtual, as caching is not done in
DoGetBestSize() anyhow, but in GetBestSize() itself.
So, second, do fix the best size invalidation by doing it explicitly
whenever the pane is toggled. And, relatedly, do not set the min size of
anything because this overrides the layout computations and is never
reset/invalidated, unlike the best size, even if the best size of the
pane changes, e.g. because of a change to its contents.
Finally, remove many thoroughly outdated comments, e.g. the one speaking
about OnStateChange() which doesn't exist at all in this implementation.
A pane using wxCP_NO_TLW_RESIZE would generate wxCollapsiblePaneEvent
even when toggled from a program because the GTK+ callback didn't take
m_bIgnoreNextChange flag into account in this case.
Fix this and also avoid duplicating the code for sending the event.
The underlying Windows TaskDialog supports adding an additional footer
to the message dialog. This makes the native functionality available
and implements it in the generic version.
See https://github.com/wxWidgets/wxWidgets/pull/573
Testing for xlocale.h was due to a misunderstanding, this header wasn't
supposed to define locale_t which is defined by locale.h itself and was
just some internal glibc header which was removed in its 2.26 release,
see
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
Stop checking for it in configure and also don't always define
wxUSE_XLOCALE but only do it if the configure test succeeded.
Trying to be smart by setting m_isEnabled to false in
wxStaticBox::Enable() without actually disabling the box itself (because
it can't be done if its label window is to remain enabled) didn't really
work. For example, it was impossible to TAB to a checkbox label of the
box when it was disabled, because keyboard navigation (correctly)
doesn't recurse into disabled windows and there could be similar
problems with any other code iterating over windows and skipping over
the disabled ones.
So, finally, simplify things and keep m_isEnabled in sync with the real
box state, even if this, counter-intuitively, means that IsEnabled() on
the box returns true after calling Enable(false) on it.
This also reverts 4ee35cf5ee569b6ee6c7d0d5702484d4d2a20f96 ("Don't
disable wxStaticBox children at wx level when disabling it") as we can't
avoid really disabling the children any more now that their parent is
not disabled: without this, their IsEnabled() would return true, i.e.
they wouldn't be disabled at all, from the program point of view. This
is unfortunate for the reasons that originally motivated that commit,
i.e. if some wxStaticBox child is disabled, disabling and re-enabling
the box will now re-enable this child, even if it shouldn't, but seems
impossible to avoid. The only possible alternative is to modify
IsEnabled() to add some wxStaticBox-specific hook to it, e.g. instead of
calling GetParent()->IsEnabled() there, we could call some now
AreChildrenEnable() method, which would delegate to IsEnabled() by
default but overridden in wxStaticBox. However this seems complicated,
and will add an extra virtual function call to all (frequently
happening) IsEnabled() calls.
Remove wxBookCtrlBase::AcceptsFocus() returning false as it didn't make
any sense: even though wxBookCtrlBase doesn't, indeed, accept focus on
itself, it does accept it for its children and returning false prevented
the focus from ever getting inside it.
This fixes, for example, keyboard navigation in a window containing
wxSimplebook and TAB can now be used to move to the controls inside it
from the outside.
Also remove the now unnecessary AcceptsFocus() override which was just
undoing the damage of the base class method and is not needed any more.
Reset m_pMainWnd in wxMFCApp::ExitInstance() to avoid crash when
deleting it again in OnMainWindowDestroyed() that could happen if
ExitInstance() was called not because the main window was closed (normal
case) but because wxApp::ExitMainLoop() was called, as it happens when
an unhandled exception is thrown.
If wxApp::OnExceptionInMainLoop() returns false, we're supposed to exit
the application by stopping its main event loop, not the loop that is
currently running, so do the former instead of the latter.
Also call wxAbort() if we can't exit the application in any other way,
this is not ideal, but still better than not doing anything and, for
example, keeping showing the same "Unexpected error occurred" message
box to the user over and over again if the exception comes from an event
handler being called repeatedly, such as wxEVT_PAINT or wxEVT_IDLE.
GTK+ 3 (but not the generic version nor even GTK+ 2, apparently) sends
"selection changed" event from gtk_tree_model_row_deleted() when
deleting the currently selected row, which resulted in sending of
wxEVT_TREELIST_SELECTION_CHANGED events with invalid wxTreeListItem,
containing a dangling pointer, and a crash in the treelist sample when
trying to dump it.
Avoid this by clearing the model (and hence generating these events)
first and deleting the items only afterwards.
Also add a trivial unit test for wxTreeListCtrl::DeleteAllItems(), which
doesn't even allow to reproduce this bug, but is still probably better
to have than not to.
Closes#18045.
Checking that a pointer is non-null before dereferencing it is perfectly
useless: the code will crash anyhow, so assert doesn't help with
debugging it in debug builds nor with preventing the crash in release.
SetHasChildren(true) must be called before checking GetChildNodes() if
the parent hadn't had any items in the initial model.
Also remove the assert checking that the node is open in
BuildTreeHelper() as we may need to build even a closed tree branch.