Make it simpler to use mnemonics for wxRadioBox items in XRC

Allow specifying label="1" attribute in wxRadioBox <item> tags to
indicate that the usual translation of "_" to "&" should be done, as for
all the other labels.

This is still not the default behaviour to avoid breaking any existing
XRC files using "_", even though using labels="1" by default would make
more sense.
This commit is contained in:
Vadim Zeitlin
2018-01-11 01:14:47 +01:00
parent bc2c9ce2a3
commit 3357d46ccc
4 changed files with 20 additions and 3 deletions

View File

@@ -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;
}