]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/menu.cpp
suppressed compiler warning about unitialised umask value
[wxWidgets.git] / src / gtk / menu.cpp
index dd3d6850bfcc88f9be21c885abb3fad21351a27b..56ddd5ac50b664201959697843eb4aaa528b90b7 100644 (file)
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
 
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
 //-----------------------------------------------------------------------------
 // wxMenuBar
 //-----------------------------------------------------------------------------
@@ -100,12 +107,12 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
     {
         if (*pc == _T('&'))
        {
-           pc++; /* skip it */
 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
             str << _T('_');
 #endif
         }
-        str << *pc;
+        else
+           str << *pc;
     }
 
     /* this doesn't have much effect right now */
@@ -173,7 +180,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
     return wxNOT_FOUND;
 }
 
-wxMenuItem *wxMenuBar::FindItemForId(int itemId, wxMenu **menuForItem = NULL) const
+wxMenuItem *wxMenuBar::FindItemForId(int itemId, wxMenu **menuForItem ) const
 {
     if ( menuForItem )
     {
@@ -343,6 +350,8 @@ wxString wxMenuBar::GetHelpString( int id ) const
 
 static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     int id = menu->FindMenuIdByMenuItem(widget);
 
     /* should find it for normal (not popup) menu */
@@ -392,6 +401,8 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
 
 static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     int id = menu->FindMenuIdByMenuItem(widget);
 
     wxASSERT( id != -1 ); // should find it!
@@ -424,6 +435,8 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
 
 static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu )
 {
+    if (g_isIdle) wxapp_install_idle_handler();
+
     int id = menu->FindMenuIdByMenuItem(widget);
 
     wxASSERT( id != -1 ); // should find it!
@@ -466,12 +479,12 @@ void wxMenuItem::SetName( const wxString& str )
     {
         if (*pc == _T('&'))
        {
-           pc++; /* skip it */
 #if (GTK_MINOR_VERSION > 0)
             m_text << _T('_');
 #endif
         }
-        m_text << *pc;
+        else
+           m_text << *pc;
     }
 
     if (m_menuItem)
@@ -616,8 +629,8 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
     
 #else
 
-    GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label( item.mb_str() )
-                                    : gtk_menu_item_new_with_label( item.mb_str() );
+    GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label( mitem->GetText().mb_str() )
+                                    : gtk_menu_item_new_with_label( mitem->GetText().mb_str() );
                                    
     gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
                         GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),