Add support for hiding sizer items in XRC

Handle the `<hideitems>` property for sizers and document it.

Also group `minsize` together with `hideitems` in `stdSizerProperties`, which
is used by all sizer classes except `wxStdDialogButtonSizer` in the XRC
schema.
This commit is contained in:
Bogdan Iordanescu 2015-09-24 14:48:11 +02:00 committed by Vadim Zeitlin
parent 42338fb5fd
commit b2c3ad614f
4 changed files with 24 additions and 10 deletions

View File

@ -80,6 +80,7 @@ All (GUI):
- Allow requesting modern (3.x+) OpenGL version in wxGLCanvas (Fabio Arnold).
- Add wxActivityIndicator.
- Add wxWindow::FromDIP() for simpler high DPI support.
- Allow initially hiding sizer items in XRC (Bogdan Iordanescu).
- Allow customizing window shown by wxBusyInfo.
- Add wxAddRemoveCtrl.
- Add wxAppProgressIndicator for MSW (Chaobin Zhang) and OS X (Tobias Taschner).

View File

@ -2282,13 +2282,17 @@ Example of sizers XRC code:
@endcode
The sizer classes that can be used are listed below, together with their
class-specific properties. All classes support the following properties:
class-specific properties. All classes except wxStdDialogButtonSizer
support the following properties:
@beginTable
@hdr3col{property, type, description}
@row3col{minsize, @ref overview_xrcformat_type_size,
Minimal size that this sizer will have, see wxSizer::SetMinSize()
(default: no min size).}
@row3col{hideitems, @ref overview_xrcformat_type_bool,
Whether the sizer will be created with all its items hidden
(default: 0).}
@endTable
@subsection overview_xrcformat_wxboxsizer wxBoxSizer

View File

@ -1772,6 +1772,11 @@ wxSizerGB_item =
}*
}
# All sizer objects except wxStdDialogButtonSizer have these properties.
stdSizerProperties =
[xrc:p="o"] element minsize {_, t_size }* &
[xrc:p="o"] element hideitems {_, t_bool }*
# Notice that horizontal orientation is the default (only for backwards
# compatibility reasons, it would make more sense to require always specifying
# it probably).
@ -1779,7 +1784,7 @@ wxBoxSizer_horz =
element object {
attribute class { "wxBoxSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="o"] element orient {_, "wxHORIZONTAL" }* &
(wxBoxSizer_horz_item | objectRef)*
}
@ -1788,7 +1793,7 @@ wxBoxSizer_vert =
element object {
attribute class { "wxBoxSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
element orient {_, "wxVERTICAL" } &
(wxBoxSizer_vert_item | objectRef)*
}
@ -1797,7 +1802,7 @@ wxStaticBoxSizer_horz =
element object {
attribute class { "wxStaticBoxSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="important"] element label {_, t_text }* &
[xrc:p="o"] element orient {_, "wxHORIZONTAL" }* &
(wxBoxSizer_horz_item | objectRef)*
@ -1807,7 +1812,7 @@ wxStaticBoxSizer_vert =
element object {
attribute class { "wxStaticBoxSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="important"] element label {_, t_text }* &
element orient {_, "wxVERTICAL" } &
(wxBoxSizer_vert_item | objectRef)*
@ -1817,7 +1822,7 @@ wxGridSizer =
element object {
attribute class { "wxGridSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="o"] element rows {_, t_unsigned }* &
[xrc:p="o"] element cols {_, t_unsigned }* &
[xrc:p="o"] element vgap {_, t_dimension }* &
@ -1829,7 +1834,7 @@ wxFlexGridSizer =
element object {
attribute class { "wxFlexGridSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="o"] element rows {_, t_unsigned }* &
[xrc:p="o"] element cols {_, t_unsigned }* &
[xrc:p="o"] element vgap {_, t_dimension }* &
@ -1847,7 +1852,7 @@ wxGridBagSizer =
element object {
attribute class { "wxGridBagSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="o"] element vgap {_, t_dimension }* &
[xrc:p="o"] element hgap {_, t_dimension }* &
[xrc:p="o"] element flexibledirection {_, ("wxVERTICAL" | "wxHORIZONTAL" | "wxBOTH") }* &
@ -1863,7 +1868,7 @@ wxWrapSizer_horz =
element object {
attribute class { "wxWrapSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
[xrc:p="important"] element orient {_, "wxHORIZONTAL" }* &
[xrc:p="o"] element flag {_, t_style }* &
(wxBoxSizer_horz_item | objectRef)*
@ -1873,7 +1878,7 @@ wxWrapSizer_vert =
element object {
attribute class { "wxWrapSizer" } &
stdObjectNodeAttributes &
[xrc:p="o"] element minsize {_, t_size }* &
stdSizerProperties &
element orient {_, "wxVERTICAL" } &
[xrc:p="o"] element flag {_, t_style }* &
(wxBoxSizer_vert_item | objectRef)*

View File

@ -267,6 +267,10 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
CreateChildren(parent, true/*only this handler*/);
// This has to be done after CreateChildren().
if ( GetBool(wxT("hideitems"), 0) == 1 )
sizer->ShowItems(false);
// set growable rows and cols for sizers which support this
if ( wxFlexGridSizer *flexsizer = wxDynamicCast(sizer, wxFlexGridSizer) )
{