Support additional wxWizard properties in XRC

Add support for border, bitmap placement, minimum width and background.

Closes #22539.
This commit is contained in:
Randalphwa 2022-06-16 06:17:23 -07:00 committed by Vadim Zeitlin
parent 237f0c640e
commit a0bdcc0d0f
3 changed files with 57 additions and 0 deletions

View file

@ -2517,6 +2517,22 @@ corresponds to the following tree of labels:
@hdr3col{property, type, description}
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
Bitmap to display on the left side of the wizard (default: none).}
@row3col{border, integer, Sets width of border around page area. (default: 0).
@since 3.2.0}
@row3col{bitmap-placement, @ref overview_xrcformat_type_style,
Sets the flags indicating how the wizard or page bitmap should be expanded
and positioned to fit the page height. By default, placement is 0
(no expansion is done). See wxWizard::SetBitmapPlacement()
@since 3.2.0}
@row3col{bitmap-minwidth, integer,
Sets the minimum width for the bitmap that will be constructed to contain
the actual wizard or page bitmap if a non-zero bitmap placement flag has
been set.
@since 3.2.0}
@row3col{bitmap-bg, @ref overview_xrcformat_type_colour,
Sets the colour that should be used to fill the area not taken up by the
wizard or page bitmap, if a non-zero bitmap placement flag has been set.
@since 3.2.0}
@endTable
A wizard object can have one or more child objects of the wxWizardPage or

View file

@ -1734,7 +1734,18 @@ wxWizard =
stdObjectNodeAttributes &
stdWindowProperties &
[xrc:p="o"] element title {_, t_text }* &
[xrc:p="o"] element border {_, t_integer }* &
[xrc:p="o"] element bitmap {_, t_bitmap }* &
[xrc:p="o"] element bitmap-placement {_, ("wxWIZARD_VALIGN_TOP" |
"wxWIZARD_VALIGN_CENTRE" |
"wxWIZARD_VALIGN_BOTTOM" |
"wxWIZARD_VALIGN_CENTRE" |
"wxWIZARD_HALIGN_LEFT" |
"wxWIZARD_HALIGN_CENTRE" |
"wxWIZARD_HALIGN_RIGHT" |
"wxWIZARD_TILE") }* &
[xrc:p="o"] element bitmap-minwidth {_, t_integer }* &
[xrc:p="o"] element bitmap-bg {_, t_colour }* &
(wxWizardPage_any | objectRef)*
}

View file

@ -46,6 +46,15 @@ wxWizardXmlHandler::wxWizardXmlHandler() : wxXmlResourceHandler()
XRC_ADD_STYLE(wxWIZARD_EX_HELPBUTTON);
AddWindowStyles();
// bitmap placement flags
XRC_ADD_STYLE(wxWIZARD_VALIGN_TOP);
XRC_ADD_STYLE(wxWIZARD_VALIGN_CENTRE);
XRC_ADD_STYLE(wxWIZARD_VALIGN_BOTTOM);
XRC_ADD_STYLE(wxWIZARD_HALIGN_LEFT);
XRC_ADD_STYLE(wxWIZARD_HALIGN_CENTRE);
XRC_ADD_STYLE(wxWIZARD_HALIGN_RIGHT);
XRC_ADD_STYLE(wxWIZARD_TILE);
}
wxObject *wxWizardXmlHandler::DoCreateResource()
@ -63,6 +72,27 @@ wxObject *wxWizardXmlHandler::DoCreateResource()
GetBitmapBundle(),
GetPosition(),
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE));
int border = GetLong("border", -1);
if (border > 0)
wiz->SetBorder(border);
int placement = GetStyle("bitmap-placement", 0);
if (placement > 0)
{
wiz->SetBitmapPlacement(placement);
// The following two options are only valid if "bmp_placement" has been set
int min_width = GetLong("bitmap-minwidth", -1);
if (min_width > 0)
wiz->SetMinimumBitmapWidth(min_width);
wxColor clr = GetColour("bitmap-bg");
if (clr.IsOk())
wiz->SetBitmapBackgroundColour(clr);
}
SetupWindow(wiz);
wxWizard *old = m_wizard;