Add support for SetArtProvider in wxAuiNotebook XRC handler

Allow selecting between the "default" and "simple" providers for now, we
might want to extend this to allow user-defined providers in the future.

Closes #22515.
This commit is contained in:
Randalphwa 2022-06-10 14:54:07 -07:00 committed by Vadim Zeitlin
parent ddcb047234
commit 385547a946
3 changed files with 17 additions and 0 deletions

View file

@ -741,6 +741,14 @@ wxAuiPaneInfo objects have the following properties:
@subsubsection xrc_wxauinotebook wxAuiNotebook
@beginTable
@hdr3col{property, type, description}
@row3col{art-provider, @ref overview_xrcformat_type_string,
One of @c default for wxAuiDefaultTabArt or @c simple for wxAuiSimpleTabArt
(default: @c default).
@since 3.2.0}
@endTable
A wxAuiNotebook can have one or more child objects of the @c notebookpage
pseudo-class.
@c notebookpage objects have the following properties:

View file

@ -580,6 +580,7 @@ wxAuiNotebook =
attribute class { "wxAuiNotebook" } &
stdObjectNodeAttributes &
stdWindowProperties &
[xrc:p="o"] element art-provider {_, ("default" | "simple") }* &
(wxAuiNotebook_notebookpage | objectRef)*
}

View file

@ -275,6 +275,14 @@ wxObject *wxAuiXmlHandler::DoCreateResource()
GetSize(),
GetStyle(wxS("style")));
wxString provider = GetText("art-provider", false);
if (provider == "default" || provider.IsEmpty())
anb->SetArtProvider(new wxAuiDefaultTabArt);
else if (provider.CmpNoCase("simple") == 0)
anb->SetArtProvider(new wxAuiSimpleTabArt);
else
ReportError("invalid wxAuiNotebook art provider");
SetupWindow(anb);
wxAuiNotebook *old_par = m_notebook;