ported characters escaping in menus to GTK+ 2.0

(it is now possible to have / in menu entries, unlike in case of GTK+ 1.2;
and \ was fixed to work in 2.0)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-07-28 18:48:36 +00:00
parent 8a9650eaaf
commit 4e9cbd33d0
2 changed files with 60 additions and 8 deletions

View File

@ -117,14 +117,25 @@ static wxString wxReplaceUnderscore( const wxString& title )
{
if (*pc == wxT('&'))
{
#if GTK_CHECK_VERSION(1, 2, 1)
#if GTK_CHECK_VERSION(1, 2, 0)
str << wxT('_');
#endif
}
#if GTK_CHECK_VERSION(2, 0, 0)
else if (*pc == wxT('/'))
{
str << wxT("\\/");
}
else if (*pc == wxT('\\'))
{
str << wxT("\\\\");
}
#elif GTK_CHECK_VERSION(1, 2, 0)
else if (*pc == wxT('/'))
{
str << wxT('\\');
#endif
}
#endif
else
{
#if __WXGTK12__
@ -810,20 +821,35 @@ void wxMenuItem::DoSetText( const wxString& str )
const wxChar *pc = str;
for (; (*pc != wxT('\0')) && (*pc != wxT('\t')); pc++ )
{
#if GTK_CHECK_VERSION(1, 2, 0)
if (*pc == wxT('&'))
{
#if GTK_CHECK_VERSION(1, 2, 0)
m_text << wxT('_');
}
else if ( *pc == wxT('_') ) // escape underscores
{
m_text << wxT("__");
}
#else // GTK+ < 1.2.0
if (*pc == wxT('&'))
{
}
#endif
#if GTK_CHECK_VERSION(2, 0, 0)
else if (*pc == wxT('/')) // we have to escape slashes
{
m_text << wxT("\\/");
}
else if (*pc == wxT('\\')) // we have to double backslashes
{
m_text << wxT("\\\\");
}
#elif GTK_CHECK_VERSION(1, 2, 0)
else if (*pc == wxT('/')) /* we have to filter out slashes ... */
{
m_text << wxT('\\'); /* ... and replace them with back slashes */
#endif // GTK+ 1.2.0+
}
#endif
else
m_text << *pc;
}

View File

@ -117,14 +117,25 @@ static wxString wxReplaceUnderscore( const wxString& title )
{
if (*pc == wxT('&'))
{
#if GTK_CHECK_VERSION(1, 2, 1)
#if GTK_CHECK_VERSION(1, 2, 0)
str << wxT('_');
#endif
}
#if GTK_CHECK_VERSION(2, 0, 0)
else if (*pc == wxT('/'))
{
str << wxT("\\/");
}
else if (*pc == wxT('\\'))
{
str << wxT("\\\\");
}
#elif GTK_CHECK_VERSION(1, 2, 0)
else if (*pc == wxT('/'))
{
str << wxT('\\');
#endif
}
#endif
else
{
#if __WXGTK12__
@ -810,20 +821,35 @@ void wxMenuItem::DoSetText( const wxString& str )
const wxChar *pc = str;
for (; (*pc != wxT('\0')) && (*pc != wxT('\t')); pc++ )
{
#if GTK_CHECK_VERSION(1, 2, 0)
if (*pc == wxT('&'))
{
#if GTK_CHECK_VERSION(1, 2, 0)
m_text << wxT('_');
}
else if ( *pc == wxT('_') ) // escape underscores
{
m_text << wxT("__");
}
#else // GTK+ < 1.2.0
if (*pc == wxT('&'))
{
}
#endif
#if GTK_CHECK_VERSION(2, 0, 0)
else if (*pc == wxT('/')) // we have to escape slashes
{
m_text << wxT("\\/");
}
else if (*pc == wxT('\\')) // we have to double backslashes
{
m_text << wxT("\\\\");
}
#elif GTK_CHECK_VERSION(1, 2, 0)
else if (*pc == wxT('/')) /* we have to filter out slashes ... */
{
m_text << wxT('\\'); /* ... and replace them with back slashes */
#endif // GTK+ 1.2.0+
}
#endif
else
m_text << *pc;
}