Merge branch 'xrc-text-escape'
Miscellaneous improvements for handling mnemonics in XRC. See https://github.com/wxWidgets/wxWidgets/pull/667 Closes #18033.
This commit is contained in:
@@ -513,7 +513,10 @@ public:
|
||||
// - replaces \n, \r, \t by respective chars (according to C syntax)
|
||||
// - replaces _ by & and __ by _ (needed for _File => &File because of XML)
|
||||
// - calls wxGetTranslations (unless disabled in wxXmlResource)
|
||||
wxString GetText(const wxString& param, bool translate = true) wxOVERRIDE;
|
||||
//
|
||||
// The first two conversions can be disabled by using wxXRC_TEXT_NO_ESCAPE
|
||||
// in flags and the last one -- by using wxXRC_TEXT_NO_TRANSLATE.
|
||||
wxString GetNodeText(const wxXmlNode *node, int flags = 0) wxOVERRIDE;
|
||||
|
||||
// Returns the XRCID.
|
||||
int GetID() wxOVERRIDE;
|
||||
|
@@ -32,6 +32,13 @@ class WXDLLIMPEXP_FWD_CORE wxXmlResourceHandler;
|
||||
// by wxXmlResourceHandler implementation itself.
|
||||
#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style)
|
||||
|
||||
// Flags for GetNodeText().
|
||||
enum
|
||||
{
|
||||
wxXRC_TEXT_NO_TRANSLATE = 1,
|
||||
wxXRC_TEXT_NO_ESCAPE = 2
|
||||
};
|
||||
|
||||
// Abstract base class for the implementation object used by
|
||||
// wxXmlResourceHandlerImpl. The real implementation is in
|
||||
// wxXmlResourceHandlerImpl class in the "xrc" library while this class is in
|
||||
@@ -61,7 +68,7 @@ public:
|
||||
virtual wxString GetParamValue(const wxString& param) = 0;
|
||||
virtual wxString GetParamValue(const wxXmlNode* node) = 0;
|
||||
virtual int GetStyle(const wxString& param = wxT("style"), int defaults = 0) = 0;
|
||||
virtual wxString GetText(const wxString& param, bool translate = true) = 0;
|
||||
virtual wxString GetNodeText(const wxXmlNode *node, int flags = 0) = 0;
|
||||
virtual int GetID() = 0;
|
||||
virtual wxString GetName() = 0;
|
||||
virtual bool GetBool(const wxString& param, bool defaultv = false) = 0;
|
||||
@@ -254,9 +261,14 @@ protected:
|
||||
{
|
||||
return GetImpl()->GetStyle(param, defaults);
|
||||
}
|
||||
wxString GetNodeText(const wxXmlNode *node, int flags = 0)
|
||||
{
|
||||
return GetImpl()->GetNodeText(node, flags);
|
||||
}
|
||||
wxString GetText(const wxString& param, bool translate = true)
|
||||
{
|
||||
return GetImpl()->GetText(param, translate);
|
||||
return GetImpl()->GetNodeText(GetImpl()->GetParamNode(param),
|
||||
translate ? 0 : wxXRC_TEXT_NO_TRANSLATE);
|
||||
}
|
||||
int GetID() const
|
||||
{
|
||||
|
Reference in New Issue
Block a user