diff --git a/docs/changes.txt b/docs/changes.txt index 3518cfdb8b..f4eb783fe2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -136,6 +136,7 @@ All (GUI): text (NewPagodi). - Fix adding/removing items to/from wxRearrangeList. - Handle wxST_ELLIPSIZE_XXX styles in wxStaticText XRC handler (tm). +- Add support for bitmaps to wxToggleButton XRC handler (tm). wxGTK: diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 1cf826545c..187d8677d1 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -2019,6 +2019,10 @@ No additional properties. Label to display on the button (default: empty).} @row3col{checked, @ref overview_xrcformat_type_bool, 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 @subsubsection xrc_wxtoolbar wxToolBar diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index c890724b9f..b298088e45 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -1508,7 +1508,9 @@ wxToggleButton = stdObjectNodeAttributes & stdWindowProperties & [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 }* } diff --git a/src/xrc/xh_tglbtn.cpp b/src/xrc/xh_tglbtn.cpp index 31c146b80e..2bac11a264 100644 --- a/src/xrc/xh_tglbtn.cpp +++ b/src/xrc/xh_tglbtn.cpp @@ -78,6 +78,12 @@ void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject *control) wxDefaultValidator, GetName()); + if ( GetParamNode("bitmap") ) + { + button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON), + GetDirection("bitmapposition")); + } + button->SetValue(GetBool( wxT("checked"))); }