diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index fa222b0f34..9d9b9fdb16 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -832,14 +832,18 @@ Refer to the section @ref xrc_wxtoolbar for more details. 3.1.5.} @row3col{bitmap, @ref overview_xrcformat_type_bitmap, Bitmap to show on the button (default: none).} -@row3col{selected, @ref overview_xrcformat_type_bitmap, - Bitmap to show when the button is selected (default: none, same as @c bitmap).} +@row3col{pressed, @ref overview_xrcformat_type_bitmap, + Bitmap to show when the button is pressed (default: none, same as @c bitmap). + This property exists since wxWidgets 3.1.6, but the equivalent (and still + supported) "selected" property can be used in the older versions.} @row3col{focus, @ref overview_xrcformat_type_bitmap, Bitmap to show when the button has focus (default: none, same as @c bitmap).} @row3col{disabled, @ref overview_xrcformat_type_bitmap, Bitmap to show when the button is disabled (default: none, same as @c bitmap).} -@row3col{hover, @ref overview_xrcformat_type_bitmap, - Bitmap to show when mouse cursor hovers above the bitmap (default: none, same as @c bitmap).} +@row3col{current, @ref overview_xrcformat_type_bitmap, + Bitmap to show when mouse cursor hovers above the bitmap (default: none, same as @c bitmap). + This property exists since wxWidgets 3.1.6, but the equivalent (and still + supported) "hover" property can be used in the older versions.} @endTable diff --git a/include/wx/xrc/xh_bmpbt.h b/include/wx/xrc/xh_bmpbt.h index e215f90613..f3e10b5b2d 100644 --- a/include/wx/xrc/xh_bmpbt.h +++ b/include/wx/xrc/xh_bmpbt.h @@ -30,7 +30,8 @@ private: void SetBitmapIfSpecified(wxBitmapButton* button, BitmapSetter setter, - const char* paramName); + const char* paramName, + const char* paramNameAlt = NULL); }; #endif // wxUSE_XRC && wxUSE_BMPBUTTON diff --git a/samples/xrc/rc/controls.xrc b/samples/xrc/rc/controls.xrc index 78c96300d5..638f91a167 100644 --- a/samples/xrc/rc/controls.xrc +++ b/samples/xrc/rc/controls.xrc @@ -219,6 +219,7 @@ 5 controls.xpm + custclas.xpm diff --git a/src/xrc/xh_bmpbt.cpp b/src/xrc/xh_bmpbt.cpp index fcf84d56ae..2c72c54695 100644 --- a/src/xrc/xh_bmpbt.cpp +++ b/src/xrc/xh_bmpbt.cpp @@ -31,14 +31,23 @@ wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler() // Function calls the given setter with the contents of the node with the given // name, if present. +// +// If alternative parameter name is specified, it is used too. void wxBitmapButtonXmlHandler::SetBitmapIfSpecified(wxBitmapButton* button, BitmapSetter setter, - const char* paramName) + const char* paramName, + const char* paramNameAlt) { - wxXmlNode* const node = GetParamNode(paramName); - if ( node ) + if ( wxXmlNode* const node = GetParamNode(paramName) ) + { (button->*setter)(GetBitmapBundle(node)); + } + else if ( paramNameAlt ) + { + if ( wxXmlNode* const nodeAlt = GetParamNode(paramNameAlt) ) + (button->*setter)(GetBitmap(nodeAlt)); + } } wxObject *wxBitmapButtonXmlHandler::DoCreateResource() @@ -66,10 +75,12 @@ wxObject *wxBitmapButtonXmlHandler::DoCreateResource() button->SetDefault(); SetupWindow(button); - SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapPressed, "selected"); + SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapPressed, + "pressed", "selected"); SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapFocus, "focus"); SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapDisabled, "disabled"); - SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapCurrent, "hover"); + SetBitmapIfSpecified(button, &wxBitmapButton::SetBitmapCurrent, + "current", "hover"); return button; }