X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ebb116d15ca4101f69b84cd4e46fe6d4ea6389b..320c341a1017798148ace98f7416c8a3cc902c04:/src/os2/accel.cpp?ds=sidebyside diff --git a/src/os2/accel.cpp b/src/os2/accel.cpp index 662e2c63f0..e21a611fe0 100644 --- a/src/os2/accel.cpp +++ b/src/os2/accel.cpp @@ -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 +