underscors are handled better in the menu item labels
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -208,16 +208,25 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
|||||||
{
|
{
|
||||||
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
|
||||||
str << _T('_');
|
str << _T('_');
|
||||||
} else
|
}
|
||||||
if (*pc == _T('/'))
|
else if (*pc == _T('/'))
|
||||||
{
|
{
|
||||||
str << _T('\\');
|
str << _T('\\');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( *pc == _T('_') )
|
||||||
|
{
|
||||||
|
// underscores must be doubled to prevent them from being
|
||||||
|
// interpreted as accelerator character prefix by GTK
|
||||||
str << *pc;
|
str << *pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str << *pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* this doesn't have much effect right now */
|
/* this doesn't have much effect right now */
|
||||||
menu->SetTitle( str );
|
menu->SetTitle( str );
|
||||||
|
|
||||||
@@ -243,7 +252,11 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
|||||||
wxString tmp = _T("<main>/");
|
wxString tmp = _T("<main>/");
|
||||||
for ( pc = str; *pc != _T('\0'); pc++ )
|
for ( pc = str; *pc != _T('\0'); pc++ )
|
||||||
{
|
{
|
||||||
if (*pc == _T('_')) pc++; /* skip it */
|
// contrary to the common sense, we must throw out _all_ underscores,
|
||||||
|
// (i.e. "Hello__World" => "HelloWorld" and not "Hello_World" as we
|
||||||
|
// might naively think). IMHO it's a bug in GTK+ (VZ)
|
||||||
|
while (*pc == _T('_'))
|
||||||
|
pc++;
|
||||||
tmp << *pc;
|
tmp << *pc;
|
||||||
}
|
}
|
||||||
menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
|
menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
|
||||||
|
@@ -208,16 +208,25 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
|||||||
{
|
{
|
||||||
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
|
||||||
str << _T('_');
|
str << _T('_');
|
||||||
} else
|
}
|
||||||
if (*pc == _T('/'))
|
else if (*pc == _T('/'))
|
||||||
{
|
{
|
||||||
str << _T('\\');
|
str << _T('\\');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( *pc == _T('_') )
|
||||||
|
{
|
||||||
|
// underscores must be doubled to prevent them from being
|
||||||
|
// interpreted as accelerator character prefix by GTK
|
||||||
str << *pc;
|
str << *pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str << *pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* this doesn't have much effect right now */
|
/* this doesn't have much effect right now */
|
||||||
menu->SetTitle( str );
|
menu->SetTitle( str );
|
||||||
|
|
||||||
@@ -243,7 +252,11 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
|||||||
wxString tmp = _T("<main>/");
|
wxString tmp = _T("<main>/");
|
||||||
for ( pc = str; *pc != _T('\0'); pc++ )
|
for ( pc = str; *pc != _T('\0'); pc++ )
|
||||||
{
|
{
|
||||||
if (*pc == _T('_')) pc++; /* skip it */
|
// contrary to the common sense, we must throw out _all_ underscores,
|
||||||
|
// (i.e. "Hello__World" => "HelloWorld" and not "Hello_World" as we
|
||||||
|
// might naively think). IMHO it's a bug in GTK+ (VZ)
|
||||||
|
while (*pc == _T('_'))
|
||||||
|
pc++;
|
||||||
tmp << *pc;
|
tmp << *pc;
|
||||||
}
|
}
|
||||||
menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
|
menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
|
||||||
|
Reference in New Issue
Block a user