From 385547a946420cb77167de772f95fedcfc2aa549 Mon Sep 17 00:00:00 2001 From: Randalphwa <38287198+Randalphwa@users.noreply.github.com> Date: Fri, 10 Jun 2022 14:54:07 -0700 Subject: [PATCH] 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. --- docs/doxygen/overviews/xrc_format.h | 8 ++++++++ misc/schema/xrc_schema.rnc | 1 + src/xrc/xh_aui.cpp | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 65261571bf..428bec5fb4 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -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: diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index 153b76fc5b..9292733e26 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -580,6 +580,7 @@ wxAuiNotebook = attribute class { "wxAuiNotebook" } & stdObjectNodeAttributes & stdWindowProperties & + [xrc:p="o"] element art-provider {_, ("default" | "simple") }* & (wxAuiNotebook_notebookpage | objectRef)* } diff --git a/src/xrc/xh_aui.cpp b/src/xrc/xh_aui.cpp index d81e618ada..2eed3d5d16 100644 --- a/src/xrc/xh_aui.cpp +++ b/src/xrc/xh_aui.cpp @@ -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;