X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d76419bd541e46b6a423dca04efc12875da5cfa6..4a46a5df879c4f820d0a0a435b34c7d5e4793991:/src/gtk/menu.cpp?ds=inline diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index e56488272a..fd598295af 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -322,7 +322,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title) entry.accelerator = (gchar*) NULL; entry.callback = (GtkItemFactoryCallback) NULL; entry.callback_action = 0; - entry.item_type = ""; + entry.item_type = (char *)""; gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ /* in order to get the pointer to the item we need the item text _without_ underscores */ @@ -578,12 +578,14 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); int id = menu->FindMenuIdByMenuItem(widget); /* should find it for normal (not popup) menu */ - wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) ); + wxASSERT_MSG( (id != -1) || (menu->GetInvokingWindow() != NULL), + _T("menu item not found in gtk_menu_clicked_callback") ); if (!menu->IsEnabled(id)) return; @@ -607,25 +609,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) } } - wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); - event.SetEventObject( menu ); - if (item->IsCheckable()) - event.SetInt( item->IsChecked() ); - -#if wxUSE_MENU_CALLBACK - if (menu->GetCallback()) - { - (void) (*(menu->GetCallback())) (*menu, event); - return; - } -#endif // wxUSE_MENU_CALLBACK - - if (menu->GetEventHandler()->ProcessEvent(event)) - return; - - wxWindow *win = menu->GetInvokingWindow(); - if (win) - win->GetEventHandler()->ProcessEvent( event ); + menu->SendEvent(item->GetId(), item->IsCheckable() ? item->IsChecked() : -1); } //----------------------------------------------------------------------------- @@ -683,7 +667,7 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) // wxMenuItem //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxMenuItemBase) +IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu, int id, @@ -902,10 +886,10 @@ void wxMenu::Init() if(m_style & wxMENU_TEAROFF) { GtkItemFactoryEntry entry; - entry.path = "/tearoff"; + entry.path = (char *)"/tearoff"; entry.callback = (GtkItemFactoryCallback) NULL; entry.callback_action = 0; - entry.item_type = ""; + entry.item_type = (char *)""; entry.accelerator = (gchar*) NULL; gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ //GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "
/tearoff" ); @@ -939,10 +923,10 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem) { #if (GTK_MINOR_VERSION > 0) GtkItemFactoryEntry entry; - entry.path = "/sep"; + entry.path = (char *)"/sep"; entry.callback = (GtkItemFactoryCallback) NULL; entry.callback_action = 0; - entry.item_type = ""; + entry.item_type = (char *)""; entry.accelerator = (gchar*) NULL; gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ @@ -968,7 +952,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem) entry.path = buf; entry.callback = (GtkItemFactoryCallback) 0; entry.callback_action = 0; - entry.item_type = ""; + entry.item_type = (char *)""; entry.accelerator = (gchar*) NULL; gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ @@ -1038,9 +1022,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem) entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback; entry.callback_action = 0; if ( mitem->IsCheckable() ) - entry.item_type = ""; + entry.item_type = (char *)""; else - entry.item_type = ""; + entry.item_type = (char *)""; entry.accelerator = (gchar*) NULL; #if wxUSE_ACCEL @@ -1267,6 +1251,9 @@ static wxString GetHotKey( const wxMenuItem& item ) #include #include +extern "C" +{ + static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass); static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item); static void gtk_pixmap_menu_item_draw (GtkWidget *widget, @@ -1292,6 +1279,8 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item); static GtkMenuItemClass *parent_class = NULL; +} + #define BORDER_SPACING 3 #define PMAP_WIDTH 20 @@ -1304,7 +1293,7 @@ gtk_pixmap_menu_item_get_type (void) { GtkTypeInfo pixmap_menu_item_info = { - "GtkPixmapMenuItem", + (char *)"GtkPixmapMenuItem", sizeof (GtkPixmapMenuItem), sizeof (GtkPixmapMenuItemClass), (GtkClassInitFunc) gtk_pixmap_menu_item_class_init,