From 572d746108ab763e593e2f49f256da63d5928228 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Sep 1999 17:54:14 +0000 Subject: [PATCH] underscores in menu items handled too under GTK+ 1.2 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/menu.cpp | 10 +++++++--- src/gtk1/menu.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 294636a191..3520e227ec 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -594,8 +594,12 @@ void wxMenuItem::SetName( const wxString& str ) { #if (GTK_MINOR_VERSION > 0) m_text << _T('_'); - } else - if (*pc == _T('/')) /* we have to filter out slashes ... */ + } + else if ( *pc == _T('_') ) // escape underscores + { + m_text << _T("__"); + } + else if (*pc == _T('/')) /* we have to filter out slashes ... */ { m_text << _T('\\'); /* ... and replace them with back slashes */ #endif @@ -829,7 +833,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool wxString s = _T("
/"); for ( const wxChar *pc = text; *pc != _T('\0'); pc++ ) { - if (*pc == _T('_')) pc++; /* skip it */ + while (*pc == _T('_')) pc++; /* skip it */ s << *pc; } diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 294636a191..3520e227ec 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -594,8 +594,12 @@ void wxMenuItem::SetName( const wxString& str ) { #if (GTK_MINOR_VERSION > 0) m_text << _T('_'); - } else - if (*pc == _T('/')) /* we have to filter out slashes ... */ + } + else if ( *pc == _T('_') ) // escape underscores + { + m_text << _T("__"); + } + else if (*pc == _T('/')) /* we have to filter out slashes ... */ { m_text << _T('\\'); /* ... and replace them with back slashes */ #endif @@ -829,7 +833,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool wxString s = _T("
/"); for ( const wxChar *pc = text; *pc != _T('\0'); pc++ ) { - if (*pc == _T('_')) pc++; /* skip it */ + while (*pc == _T('_')) pc++; /* skip it */ s << *pc; } -- 2.45.2