Don't define operators for wx types in global scope.
This results in much better error messages when the compiler gives an
error about failing to resolve a call to some operator in user code
because it doesn't list all the wx-defined operators as candidates. In
practice, this cuts down error messages from 500 (!) lines to 2 with
gcc.
See #24190.
Add new wxDECLARE_VARIANT_OBJECT_EXPORTED() macro defining these
operators as friend functions inside the class declaration and replace
all uses of DECLARE_VARIANT_OBJECT_EXPORTED() inside the core library
with the new macro to avoid defining any operator<<() overloads in the
global scope.
Also add wxIMPLEMENT_VARIANT_OBJECT() for consistency, even though it is
not really needed.
This is similar to wxAuiManager::AlwaysUsesLiveResize() and does the
same thing, i.e. returns true if live update is always used, whether
wxSP_LIVE_UPDATE is enabled or not.
Use the new function in the sample to disable the menu item in the
environments where it doesn't do anything, as it was confusing to have
it under e.g. Wayland.
This code was already used for Ctrl-C handling, refactor it into a
separate function that can be called from the application now.
This commit is best viewed with --color-moved-ws=ignore-all-space Git
option.
Closes#24124.
Although wxGenericTreeCtrl is not used under MSW by default, it still
doesn't hurt to adjust its metrics when DPI changes there.
Note that this shouldn't be done for the platforms using DIPs.
Replace user-specified empty constructors and destructors with the
compiler-generated versions, which has a number of advantages for code
generation, in addition to being more clear.
Closes#22965.
Closes#24058.
Refactor wxImageList and convert it to use physical pixels and
add support for high DPI state images wxTreeCtrl using the new
wxImageList.
See #24000, #24033.
This is similar but not totally identical to the existing
GetNextVisible() as it doesn't require the initial item itself to be
visible (notably, it could be the hidden virtual root).
It is also more efficient than the old GetNextVisible() implementation
calling GetNext() in the loop until finding a visible item, as it avoids
looking inside collapsed items in the first place.
Unlike the existing SetStateImageList() function, the new one allows to
provide the high-resolution versions of the state images too.
Update the treectrl sample to use the new API.
Closes#23993.
Since the changes of 4d76a87015 (Make wxSearchCtrl inherit from
wxTextEntry in all ports, 2023-07-09, see #23697) GetEditHWND() returned
null for wxSearchCtrl which was considered to be correct because all
wxTextEntry functions were supposed to be forwarded to wxSearchTextCtrl
anyhow.
This wasn't really correct, however, as GetEditHWND() was also called
from SetHint(), resulting in an assert failure and falling back on
generic hint implementation which, while mostly working, suffers from
some problems that the native implementation doesn't have.
So make this function return the actual HWND used by the associated text
entry to fix this and allow SetHint() to work as before and also
forestall any problems due to not having the right HWND in the future.
See #23983.
Closes#23975.
Having this line is not useful at all as it doesn't contain any
information and shouldn't be filled in the future as git-shortlog can
provide the information about people who changed the given file more
more reliably than consulting the comments in any case.
Keep the non-blank lines for historical purposes.
Also make it clear that wxCHOICE_{HEIGHT,WIDTH} constants are not really
used for anything.
Closes#23949.
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
Just refresh the window and repaint it from OnPaint().
This was already effectively done under Mac and now this class can be
also used in wxGTK (where it may be preferable to the native one as the
latter one doesn't support high DPI animations yet).
Allow specifying multiple animation versions, for different resolutions,
when setting the animation to use via wxAnimationBundle class which is a
much simpler version of wxBitmapBundle used elsewhere.
This is not implemented for the native GTK version yet.
Update the sample, even though the difference in it is not really
noticeable as the "high DPI" throbber is just a scaled up version of the
existing standard DPI animation produced using gifsicle.
The changes of 8c1234ea66 (Improve assert checking line index validity
in wxGenericListCtrl, 2023-07-24) were wrong for virtual list controls
as the lines vector is not used for them, so restrict the assert to the
non-virtual case only.
Don't just check that the index is not -1, but also that it's valid,
which can catch other problems.
Also replace the ASSERT with CHECK to avoid dereferencing invalid
pointer, it's better to crash when trying to dereference a NULL one.
This function should be used to get the parent for the custom controls
instead of relying on them being reparented under it by the code added
in the last commit.
Change the type of m_contents to be wxWindow and not wxPanel as it
doesn't really matter, but wxPanel is not fully declared in this header
while wxWindow is.
Return the correct foreground colour from this function for hyper links,
it's different from the default text colour for the links.
This makes it easy to reuse this colour for the link-like elements in
the application code.
Make wxGridFixedIndicesSet a std::unordered_set and use unordered_map
for the other maps used by wxGrid.
Remove the initial buckets assignment, as it isn't really clear if it's
helpful.
Also remove the casts that are not needed now that we use a map with the
correct type for the keys and values.
This type is part of the public API, so it can't be just replaced by a
std::vector<>, but it can at least be replaced by wxBaseArray<> which
inherits from std::vector<>.
Also accept just a vector, unimaginatively called wxGridCellCoordsVector
in the code, on input, as this is backwards-compatible with passing in a
wxGridCellCoordsArray.
Finally, simplify the code a bit by using range-for loop.
No real changes.
This allows to simplify the code by directly using the standard class
methods.
Note that wxGridStringArray is used outside of wxWidgets, so we still
preserve its definition but make it just a simple vector of objects
instead of a legacy object array as there is really no need to keep
pointers to wxArrayString here.
This fixes wxCollapsiblePane appearance inside a wxNotebook in wxMSW, as
it now correctly uses wxNotebook (white) background instead of the
default (light grey) one.
Closes#23274.
Remove WXDLLEXPORT from the internal classes used only inside the
implementation.
Also remove forward declarations of classes not used in the header from
it.
This is consistent with the native GTK and macOS dialogs and it makes
sense to try be more consistent with them, as the generic version is
used as a fallback under Mac.
Also use a smaller font for the copyright as is customary.
This could be a noticeable optimization as it should be much more
efficient to store many lines in a single block of memory instead of
using pointers to them and it also simplifies the code as we don't need
to delete the pointers any more.
Don't manage the pointer lifetime manually but use a smart pointer for
it: this is simpler and allows to make this class default-movable.
Also make it non-copyable as it never actually was (copying it would
have resulted in a double free of the owned pointer).
This simplifies the code and avoids unnecessary heap allocations as we
can store the objects in the vectors directly instead of storing
pointers to them.
This class contains (sometimes) owned pointers and so can't be copied
but it can be moved, so make it moveable.
No real changes, this is done in preparation for storing objects of this
type in a std::vector.
Get rid of Init() function and just initialize all the members in their
declarations, as this is less verbose, more clear and more robust.
Note that we also initialize m_rect now, which was left uninitialized by
Init() before, as it's simpler and more reliable to always do even if we
happen to overwrite it in the ctor.
This not only simplifies the code but also makes it more efficient by
avoiding unnecessary heap allocations, as we can now just store the
objects themselves in the vector instead of storing pointers to them.
No real changes, this is just a code cleanup/modernization.
Assume they are always 1 now, there is no good reason to ever set them
to 0 any more.
Note that we still keep wxUSE_STD_IOSTREAM for now, but we can drop
wxUSE_STD_DEFAULT as it's not worth having it just for this single
option (previously it was used as the default value for 3 of them).
There is no need to have them as they were identical for all platforms.
This basically reverts 5b87bd6c0b (Split wxPanel in wxPanelBase and
platform-specific files., 2011-03-20) as, 10+ years later, it turns out
that we're not going to have more MSW-specific parts, but none of them.
No real changes.
This is similar to the changes of 020b6ebcb8 (Derive from wxTextEntry
instead of wxTextCtrlBase, 2019-12-29) for wxGTK and removes the methods
that don't exist in the other ports from the generic wxSearchCtrl too.
Add a helper function calling wxDC::DrawBitmap() and hiding its ugly
"useMask" boolean parameter which was also error-prone, e.g. some
recently modified code passed wxIMAGELIST_DRAW_TRANSPARENT to it by
mistake.
No real changes, this is just a refactoring.
Use wxWithImages::GetImageBitmapFor() instead of wxImageList in this
control code to ensure that we use the provided high DPI bitmaps, if we
have them, instead of always scaling up the fixed-size image list
images.
Closes#22907.