Fixed separator handling for menus.
Extracted common code for handling translation of labels containing
accelerators from wxWindows representation to native representation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -210,3 +210,45 @@ bool wxAcceleratorTable::Translate(
|
||||
return (Ok() && rc);
|
||||
} // end of wxAcceleratorTable::Translate
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// function for translating labels
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxString wxPMTextToLabel(
|
||||
const wxString& rsTitle
|
||||
)
|
||||
{
|
||||
wxString sTitle;
|
||||
const wxChar* zPc;
|
||||
|
||||
if (rsTitle.IsEmpty())
|
||||
return(sTitle);
|
||||
|
||||
for (zPc = rsTitle.c_str(); *zPc != wxT('\0'); zPc++)
|
||||
{
|
||||
if (*zPc == wxT('&'))
|
||||
{
|
||||
if (*(zPc + 1) == wxT('&'))
|
||||
{
|
||||
zPc++;
|
||||
sTitle << wxT('&');
|
||||
}
|
||||
else
|
||||
sTitle << wxT('~');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( *zPc == wxT('~'))
|
||||
{
|
||||
//
|
||||
// Tildes must be doubled to prevent them from being
|
||||
// interpreted as accelerator character prefix by PM ???
|
||||
//
|
||||
sTitle << *zPc;
|
||||
}
|
||||
sTitle << *zPc;
|
||||
}
|
||||
}
|
||||
return(sTitle);
|
||||
} // end of wxPMTextToLabel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user