Using a const char* and a wxString in the two branches of the ternary
operator resulted in compile-time errors when using C++20 standard
since the result type of the conditional expression was ambiguous,
so add explicit conversions to fix it.
See also #19355.
Closes#25501.
Using wxArrayPtrVoid was ugly and completely unnecessary, just store
both item labels and bitmaps in a single vector.
No real changes, this is just code cleanup.
Replace the remaining call to SetImageList() with SetImages() too.
This should have been part of e0ed66b8d3 (Use wxBitmapBundle for widgets
sample icons, 2025-03-30), see #25282.
Closes#25428.
Closes#25429.
As part of this change, the cursor.png file of unclear provenance added
back in 9ea83ebc7c (Add test for a custom cursor to the image sample.,
2010-07-24) is replaced with the new hand image with a non-zero hotspot
point taken from https://uxwing.com/up-hand-pointer-icon/
This new class allows to let wxWidgets select the appropriate cursor,
similarly to how wxBitmapBundle allows to select the bitmap of the
appropriate size.
Document the new class and show using it in the drawing sample.
There is no need to use an intermediate wxImage any more.
We also don't need to copy cursor.png to the build directory, as it is
now used only during the build and not when running the sample, so don't
do this.
There doesn't seem to be any sample more suitable than this one, so add
a "Cursors" screen to it, as we already have "Colours" screens there.
For now just show the cursor size.
This doesn't work correctly in wxGTK currently, as the exception is not
passed to wxApp::OnExceptionInMainLoop() as expected, but it will be
fixed soon.
This provider implements a non-glossy look, unlike wxAuiGenericTabArt,
but is still not as weird/ugly as wxAuiSimpleTabArt.
For now this provider has to be chosen explicitly, but the plan is to
make it the default one in the future.
Simple art provider can't be used if pin or unpin buttons are used, so
prevent this from happening.
This is not ideal, but better than just giving an endless stream of
asserts and nobody cares about the simple art provider anyhow.
Use range-for loop over AUI panes instead of counted for loop and also
consistently use wxDynamicCast() instead of IsKindOf() and subsequent
C-style cast everywhere.
No real changes, just simplify the code.
The existing code was confusing because it did something strange for
ID_NotebookArt{Gloss,Simple} in OnUpdateUI(), but this handler wasn't
actually connected to the menu items with these IDs.
Do connect it and add another member variable storing the current choice
of the art provider, as the existing handler code couldn't, and didn't,
work (and this only wasn't a problem because it was never executed).
Stop saving and restoring locked tabs: their semantics dictates that
their state can't be changed by the user, and so they must remain locked
no matter what, whereas it was possible to turn a locked tab into a
normal one via data given to the deserializer (e.g. by editing a config
file manually).
Also ensure that restoring the pinned tabs doesn't break the control
invariant, i.e. that they don't come after any normal tabs. If the
deserializer returns the data that puts pinned tabs on invalid
positions, just ignore it and don't make them pinned: this is better
than ending up in an invalid state and simpler than moving them before
the normal tabs.
It can be useful to preserve the last selected page -- and if the
application doesn't want to do it, it can avoid it by not saving
wxAuiTabLayoutInfo::active.
This allows newer versions of the program, adding new pages, to still
restore data saved by the older versions.
By default the pages not described by the deserialized data are simply
appended to the main tab control, however this behaviour can be
customized by overriding the new HandleOrphanedPage() function.
The signature of the new function is rather complex and not very
elegant, but this seems to be the least bad solution, as it allows wxAUI
itself to provide the default values (main tab control and -1, meaning
to append, for the index), making the code of the applications
overriding this function simpler.
Also note that we really need to get the location for the page in some
way, e.g. we couldn't just let HandleOrphanedPage() or a similar
function put it into its place on its own because at the moment of its
call the wxAuiNotebook invariant saying that each page in m_tabs is
present in exactly one wxAuiTabCtrl is broken, and so many wxAuiNotebook
functions, including e.g. DeletePage(), don't work as expected.
In some build variants (e.g. when wxUSE_INTL==0) _() is a macro doing
nothing, in particular not involving a function call, and the temporary
wxString created by it doesn't survive past the end of the statement and
hence a reference to it can't be used.
Just make a copy of the string to fix this.
This style doesn't make much sense any longer now that using
wxAUI_MGR_VENETIAN_BLINDS_HINT on its down doesn't enable fade-in
effect, so (informally) deprecate it and keep it defined as 0 just for
compatibility.
Panes may be hidden by user, so it makes sense to store their visibility
as part of the serialized representation to be able to restore the same
visual layout later.
See #25186.
This passes now, after the recent changes.
Also update the sample to use a mnemonic for one of the pages to be able
to check that it appears correctly visually too.