Add support for bitmaps to wxToggleButton XRC handler

Handle "bitmap" and "bitmapposition" attributes in wxToggleButton XRC handler,
just as it's already done for wxBitmap and wxBitmapToggleButton.

Closes #17850.
This commit is contained in:
tm
2017-05-28 16:05:38 +02:00
committed by Vadim Zeitlin
parent 0a3720beff
commit 7ce3693956
4 changed files with 14 additions and 1 deletions

View File

@@ -136,6 +136,7 @@ All (GUI):
text (NewPagodi). text (NewPagodi).
- Fix adding/removing items to/from wxRearrangeList. - Fix adding/removing items to/from wxRearrangeList.
- Handle wxST_ELLIPSIZE_XXX styles in wxStaticText XRC handler (tm). - Handle wxST_ELLIPSIZE_XXX styles in wxStaticText XRC handler (tm).
- Add support for bitmaps to wxToggleButton XRC handler (tm).
wxGTK: wxGTK:

View File

@@ -2019,6 +2019,10 @@ No additional properties.
Label to display on the button (default: empty).} Label to display on the button (default: empty).}
@row3col{checked, @ref overview_xrcformat_type_bool, @row3col{checked, @ref overview_xrcformat_type_bool,
Should the button be checked/pressed initially (default: 0)?} Should the button be checked/pressed initially (default: 0)?}
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
Bitmap to display in the button (optional). @since 3.1.1}
@row3col{bitmapposition, @c wxLEFT|wxRIGHT|wxTOP|wxBOTTOM,
Position of the bitmap in the button, see wxButton::SetBitmapPosition() (default: wxLEFT). @since 3.1.1}
@endTable @endTable
@subsubsection xrc_wxtoolbar wxToolBar @subsubsection xrc_wxtoolbar wxToolBar

View File

@@ -1508,7 +1508,9 @@ wxToggleButton =
stdObjectNodeAttributes & stdObjectNodeAttributes &
stdWindowProperties & stdWindowProperties &
[xrc:p="important"] element label {_, t_text }* & [xrc:p="important"] element label {_, t_text }* &
[xrc:p="o"] element checked {_, t_bool }* [xrc:p="o"] element checked {_, t_bool }* &
[xrc:p="o"] element bitmap {_, t_bitmap }* &
[xrc:p="o"] element bitmapposition {_, t_direction }*
} }

View File

@@ -78,6 +78,12 @@ void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject *control)
wxDefaultValidator, wxDefaultValidator,
GetName()); GetName());
if ( GetParamNode("bitmap") )
{
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
GetDirection("bitmapposition"));
}
button->SetValue(GetBool( wxT("checked"))); button->SetValue(GetBool( wxT("checked")));
} }