diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 9d9b9fdb16..c85da26f8f 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -907,6 +907,17 @@ Example: Label to display on the button (may be omitted if only the bitmap or stock ID is used).} @row3col{bitmap, @ref overview_xrcformat_type_bitmap, Bitmap to display in the button (optional).} +@row3col{pressed, @ref overview_xrcformat_type_bitmap, + Bitmap to show when the button is pressed (default: none, same as @c bitmap). @since 3.1.7} +@row3col{focus, @ref overview_xrcformat_type_bitmap, + Bitmap to show when the button has focus (default: none, same as @c bitmap). @since 3.1.7} +@row3col{disabled, @ref overview_xrcformat_type_bitmap, + Bitmap to show when the button is disabled (default: none, same as @c bitmap). @since 3.1.7} +@row3col{current, @ref overview_xrcformat_type_bitmap, + Bitmap to show when the mouse cursor hovers above the bitmap (default: none, same as @c bitmap). @since 3.1.7} +@row3col{margins, @ref overview_xrcformat_type_size, + Set the margins between the bitmap and the text of the button. + This method is currently only implemented under MSW. If it is not called, a default margin is used around the bitmap. @since 3.1.7} @row3col{bitmapposition, @c wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, Position of the bitmap in the button, see wxButton::SetBitmapPosition() (default: wxLEFT).} @row3col{default, @ref overview_xrcformat_type_bool, diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index 7d490ae7c8..7a2a715142 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -736,6 +736,11 @@ wxButton = stdWindowProperties & [xrc:p="o"] element label {_, t_text }* & [xrc:p="o"] element bitmap {_, t_bitmap }* & + [xrc:p="o"] element pressed {_, t_bitmap }* & + [xrc:p="o"] element focus {_, t_bitmap }* & + [xrc:p="o"] element disabled {_, t_bitmap }* & + [xrc:p="o"] element current {_, t_bitmap }* & + [xrc:p="o"] element margins {_, t_size }* & [xrc:p="o"] element bitmapposition {_, t_direction }* & [xrc:p="o"] element default {_, t_bool }* } diff --git a/src/xrc/xh_bttn.cpp b/src/xrc/xh_bttn.cpp index 033eab2a57..f2bd8053bf 100644 --- a/src/xrc/xh_bttn.cpp +++ b/src/xrc/xh_bttn.cpp @@ -29,6 +29,7 @@ wxButtonXmlHandler::wxButtonXmlHandler() XRC_ADD_STYLE(wxBU_TOP); XRC_ADD_STYLE(wxBU_BOTTOM); XRC_ADD_STYLE(wxBU_EXACTFIT); + XRC_ADD_STYLE(wxBU_NOTEXT); AddWindowStyles(); } @@ -55,6 +56,23 @@ wxObject *wxButtonXmlHandler::DoCreateResource() SetupWindow(button); + const wxXmlNode* node = GetParamNode("pressed"); + if (node) + button->SetBitmapPressed(GetBitmapBundle(node)); + node = GetParamNode("focus"); + if (node) + button->SetBitmapFocus(GetBitmapBundle(node)); + node = GetParamNode("disabled"); + if (node) + button->SetBitmapDisabled(GetBitmapBundle(node)); + node = GetParamNode("current"); + if (node) + button->SetBitmapCurrent(GetBitmapBundle(node)); + + const wxSize margins = GetSize("margins"); + if (margins != wxDefaultSize) + button->SetBitmapMargins(margins); + return button; }