]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/accel.cpp
(blind) fix for gcc 3.4 warning for an always true comparison in an assert
[wxWidgets.git] / src / os2 / accel.cpp
index 662e2c63f073f34ff7c6f3c747ac95d308c68e7e..e21a611fe03f6e979f0745f720e2a2c3e1121da5 100644 (file)
@@ -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
+