testgtk: Drop tabular menu

Tabular menus are basically unused, and we want to drop this.
This commit is contained in:
Matthias Clasen 2019-01-23 22:40:53 -05:00
parent d339a43634
commit e2693ef44f

View File

@ -1784,197 +1784,6 @@ create_menu (GdkDisplay *display, gint depth, gint length)
return menu;
}
static GtkWidget*
create_table_menu (GdkDisplay *display, gint cols, gint rows)
{
GtkWidget *menu;
GtkWidget *menuitem;
GtkWidget *submenu;
GtkWidget *image;
GtkWidget *label;
GtkWidget *box;
char buf[32];
int i, j;
menu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (menu), display);
j = 0;
menuitem = gtk_menu_item_new_with_label ("items");
gtk_menu_attach (GTK_MENU (menu), menuitem, 0, cols, j, j + 1);
submenu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (submenu), display);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_widget_show (menuitem);
j++;
/* now fill the items submenu */
image = gtk_image_new_from_icon_name ("help-broswer");
gtk_widget_show (image);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
menuitem = gtk_menu_item_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
label = gtk_label_new ("Image");
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (box), image);
gtk_container_add (GTK_CONTAINER (menuitem), box);
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 0, 1);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 0, 1);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 1, 2);
gtk_widget_show (menuitem);
image = gtk_image_new_from_icon_name ("help-browser");
gtk_widget_show (image);
menuitem = gtk_menu_item_new ();
label = gtk_label_new ("Image");
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (box), image);
gtk_container_add (GTK_CONTAINER (menuitem), box);
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 1, 2);
gtk_widget_show (menuitem);
menuitem = gtk_radio_menu_item_new_with_label (NULL, "Radio");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 2, 3);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 2, 3);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 3, 4);
gtk_widget_show (menuitem);
menuitem = gtk_radio_menu_item_new_with_label (NULL, "Radio");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 3, 4);
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("Check");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 4, 5);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 4, 5);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("x");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 5, 6);
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("Check");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 5, 6);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("1. Inserted normally (8)");
gtk_widget_show (menuitem);
gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), menuitem, 8);
menuitem = gtk_menu_item_new_with_label ("2. Inserted normally (2)");
gtk_widget_show (menuitem);
gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), menuitem, 2);
menuitem = gtk_menu_item_new_with_label ("3. Inserted normally (0)");
gtk_widget_show (menuitem);
gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), menuitem, 0);
menuitem = gtk_menu_item_new_with_label ("4. Inserted normally (-1)");
gtk_widget_show (menuitem);
gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), menuitem, -1);
/* end of items submenu */
menuitem = gtk_menu_item_new_with_label ("spanning");
gtk_menu_attach (GTK_MENU (menu), menuitem, 0, cols, j, j + 1);
submenu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (submenu), display);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_widget_show (menuitem);
j++;
/* now fill the spanning submenu */
menuitem = gtk_menu_item_new_with_label ("a");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 2, 0, 1);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("b");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 2, 3, 0, 2);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("c");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 1, 3);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("d");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 2, 1, 2);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("e");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 1, 3, 2, 3);
gtk_widget_show (menuitem);
/* end of spanning submenu */
menuitem = gtk_menu_item_new_with_label ("left");
gtk_menu_attach (GTK_MENU (menu), menuitem, 0, 1, j, j + 1);
submenu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (submenu), display);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("Empty");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 0, 1);
submenu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (submenu), display);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("right");
gtk_menu_attach (GTK_MENU (menu), menuitem, 1, 2, j, j + 1);
submenu = gtk_menu_new ();
gtk_menu_set_display (GTK_MENU (submenu), display);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("Empty");
gtk_menu_attach (GTK_MENU (submenu), menuitem, 0, 1, 0, 1);
gtk_widget_show (menuitem);
j++;
for (; j < rows; j++)
for (i = 0; i < cols; i++)
{
sprintf (buf, "(%d %d)", i, j);
menuitem = gtk_menu_item_new_with_label (buf);
gtk_menu_attach (GTK_MENU (menu), menuitem, i, i + 1, j, j + 1);
gtk_widget_show (menuitem);
}
menuitem = gtk_menu_item_new_with_label ("1. Inserted normally (8)");
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), menuitem, 8);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("2. Inserted normally (2)");
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), menuitem, 2);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("3. Inserted normally (0)");
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), menuitem, 0);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("4. Inserted normally (-1)");
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), menuitem, -1);
gtk_widget_show (menuitem);
return menu;
}
static void
create_menus (GtkWidget *widget)
{
@ -2024,13 +1833,6 @@ create_menus (GtkWidget *widget)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
menu = create_table_menu (display, 2, 50);
menuitem = gtk_menu_item_new_with_label ("table");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("foo");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (display, 3, 5));
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);