我刚开始学习GTK +。但是,我在文档中找不到必需品。即菜单上的“激活”信号的回调原型。 我知道可能有一个标准的回调。但目前尚不清楚。
这是菜单选择回调的正确原型吗?
// Is this correct? It does appear to work. But I don't want to be sure so as to avoid any corruption
static void menu_select(GtkMenu* menu, int item)
{
printf("menu_activate: %d\n", item);
}
void build_menu()
{
// ...
login = gtk_menu_item_new_with_label("Login");
// ...
separator = gtk_separator_menu_item_new();
quit = gtk_menu_item_new_with_label("Exit");
// ...
g_signal_connect(G_OBJECT(login), "activate", G_CALLBACK(menu_select), GINT_TO_POINTER(0));
g_signal_connect(G_OBJECT(quit), "activate", G_CALLBACK(menu_select), GINT_TO_POINTER(1));
}