compilation fixes for wxUSE_ACCEL=0

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-11 13:08:13 +00:00
parent 8d22935dcb
commit 6c30965353
2 changed files with 10 additions and 5 deletions

View File

@@ -110,7 +110,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
*height = 0; *height = 0;
} }
#if wxUSE_MENUS #if wxUSE_MENUS && wxUSE_ACCEL
// Helper for wxCreateAcceleratorTableForMenuBar // Helper for wxCreateAcceleratorTableForMenuBar
static void wxAddAccelerators(wxList& accelEntries, wxMenu* menu) static void wxAddAccelerators(wxList& accelEntries, wxMenu* menu)
{ {
@@ -166,21 +166,21 @@ static wxAcceleratorTable wxCreateAcceleratorTableForMenuBar(wxMenuBar* menuBar)
return table; return table;
} }
#endif #endif // wxUSE_MENUS && wxUSE_ACCEL
bool wxFrame::ShowFullScreen(bool show, long style) bool wxFrame::ShowFullScreen(bool show, long style)
{ {
if (!wxFrameBase::ShowFullScreen(show, style)) if (!wxFrameBase::ShowFullScreen(show, style))
return false; return false;
#if wxUSE_MENUS #if wxUSE_MENUS && wxUSE_ACCEL
if (show && GetMenuBar()) if (show && GetMenuBar())
{ {
wxAcceleratorTable table(wxCreateAcceleratorTableForMenuBar(GetMenuBar())); wxAcceleratorTable table(wxCreateAcceleratorTableForMenuBar(GetMenuBar()));
if (table.IsOk()) if (table.IsOk())
SetAcceleratorTable(table); SetAcceleratorTable(table);
} }
#endif #endif // wxUSE_MENUS && wxUSE_ACCEL
wxWindow* const bar[] = { wxWindow* const bar[] = {
#if wxUSE_MENUS #if wxUSE_MENUS

View File

@@ -798,11 +798,14 @@ void wxMenuItem::SetItemLabel( const wxString& str )
oldLabel = wxStripMenuCodes(oldLabel); oldLabel = wxStripMenuCodes(oldLabel);
oldLabel.Replace(wxT("_"), wxT("")); oldLabel.Replace(wxT("_"), wxT(""));
wxString label1 = wxStripMenuCodes(str); wxString label1 = wxStripMenuCodes(str);
#if wxUSE_ACCEL
wxString oldhotkey = GetHotKey(); // Store the old hotkey in Ctrl-foo format wxString oldhotkey = GetHotKey(); // Store the old hotkey in Ctrl-foo format
wxCharBuffer oldbuf = wxGTK_CONV_SYS( GetGtkHotKey(*this) ); // and as <control>foo wxCharBuffer oldbuf = wxGTK_CONV_SYS( GetGtkHotKey(*this) ); // and as <control>foo
#endif // wxUSE_ACCEL
DoSetText(str); DoSetText(str);
#if wxUSE_ACCEL
if (oldLabel == label1 && if (oldLabel == label1 &&
oldhotkey == GetHotKey()) // Make sure we can change a hotkey even if the label is unaltered oldhotkey == GetHotKey()) // Make sure we can change a hotkey even if the label is unaltered
return; return;
@@ -877,6 +880,7 @@ void wxMenuItem::SetItemLabel( const wxString& str )
accel_key, accel_key,
accel_mods ); accel_mods );
} }
#endif // wxUSE_FILECTRL
} }
// NOTE: this function is different from the similar functions GTKProcessMnemonics() // NOTE: this function is different from the similar functions GTKProcessMnemonics()
@@ -1179,11 +1183,11 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
} }
#if wxUSE_ACCEL
guint accel_key; guint accel_key;
GdkModifierType accel_mods; GdkModifierType accel_mods;
wxCharBuffer buf = wxGTK_CONV_SYS( GetGtkHotKey(*mitem) ); wxCharBuffer buf = wxGTK_CONV_SYS( GetGtkHotKey(*mitem) );
// wxPrintf( wxT("item: %s hotkey %s\n"), mitem->GetItemLabel().c_str(), GetGtkHotKey(*mitem).c_str() );
if (buf[(size_t)0] != '\0') if (buf[(size_t)0] != '\0')
{ {
gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods); gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods);
@@ -1208,6 +1212,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
accel_mods, accel_mods,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
} }
#endif // wxUSE_FILECTRL
if (pos == -1) if (pos == -1)
gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem); gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);