]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/accel.cpp
concentrating content and structure region calculations
[wxWidgets.git] / src / os2 / accel.cpp
index 802a3867e4513413ed0640b95f23b96a92d8cc3a..e21a611fe03f6e979f0745f720e2a2c3e1121da5 100644 (file)
@@ -105,7 +105,7 @@ extern int wxCharCodeWXToOS2(
 // Create from an array
 wxAcceleratorTable::wxAcceleratorTable(
   int                               n
-, wxAcceleratorEntry                vaEntries[]
+, const wxAcceleratorEntry          vaEntries[]
 )
 {
     int                             nAccelLength = ((sizeof(ACCEL) * n) + sizeof(ACCELTABLE));
@@ -148,7 +148,7 @@ wxAcceleratorTable::wxAcceleratorTable(
         pArr->aaccel[i].key = uKey;
         pArr->aaccel[i].cmd = uCmd;
     }
-    pArr->codepage = 437; // default to english Fix???
+    pArr->codepage = ::WinQueryCp(wxTheApp->m_hMq);
     pArr->cAccel = (USHORT)n;
     M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain
                                                   ,pArr
@@ -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
+