diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index de2c1e0a27..ebc25b1513 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -1595,6 +1595,11 @@ can also have some optional XML @em attributes (not properties!): Is the button enabled (default: 1)?} @row3col{hidden, @ref overview_xrcformat_type_bool, Is the button hidden initially (default: 0)?} +@row3col{label, @ref overview_xrcformat_type_bool, + Should this item text be interpreted as a label, i.e. escaping underscores + in it as done for the label properties of other controls? This attribute + exists since wxWidgets 3.1.1 and was always treated as having the value of + 0, which still remains its default, until then.} @endTable Example: diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index e4617452f6..ada4360591 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -1225,6 +1225,7 @@ wxRadioBox = attribute helptext { t_string }?, attribute enabled { t_bool }?, attribute hidden { t_bool }?, + attribute label { t_bool }?, t_text }* }? diff --git a/src/xrc/xh_radbx.cpp b/src/xrc/xh_radbx.cpp index 762f31b2e0..5fd8a84287 100644 --- a/src/xrc/xh_radbx.cpp +++ b/src/xrc/xh_radbx.cpp @@ -107,7 +107,13 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource() // we handle handle Label constructs here, and the item // tag can have tooltip, helptext, enabled and hidden attributes - m_labels.push_back(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); + // For compatibility, labels are not escaped in XRC by default and + // label="1" attribute needs to be explicitly specified to handle them + // consistently with the other labels. + m_labels.push_back(GetNodeText(m_node, + GetBoolAttr("label", 0) + ? 0 + : wxXRC_TEXT_NO_ESCAPE)); #if wxUSE_TOOLTIPS m_tooltips.push_back(GetNodeText(GetParamNode(wxT("tooltip")), wxXRC_TEXT_NO_ESCAPE)); diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index fb06278d07..72bfd49738 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -981,9 +981,14 @@ GetNodeContentsKind(wxXmlNode& node, const wxString& contents) } // This one is special: it is translated in XRC, but its contents is not - // escaped. + // escaped, except for the special case of wxRadioBox when it can be, if + // "label" attribute is supplied. if ( node.GetName() == wxT("item") ) - return Contents_TransOnly; + { + return node.GetAttribute(wxT("label"), wxT("0")) == wxT("1") + ? Contents_Text + : Contents_TransOnly; + } return Contents_NotTrans; }