Deprecate. Ditto.

Fri Oct 10 19:10:12 2003  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtkcombo.h: Deprecate.
	* gtk/gtkoptionmenu.h: Ditto.

	* gtk/gtkcombobox.c (gtk_combo_box_size_request),
	(gtk_combo_box_size_allocate): Rework, things behave better now. Still
	needs some work on requesting enough size when taking the items in
	the list into account.

	* gtk/gtkfilesel.c: put gtkoptionmenu.h include inside "enable
	deprecated" guards.
	* gtk/gtkinputdialog.c: ditto.
	* gtk/gtkitemfactory.c: ditto.
	* gtk/gtkoptionmenu.c: ditto.

	* demos/gtk-demo/menus.c: remove the option menu.
	* demos/gtk-demo/sizegroup.c: replace the option menus with
	GtkComboBox.
	* demos/gtk-demo/textview.c: ditto.
	(A general GtkComboBox demo will be added later on).
This commit is contained in:
Kristian Rietveld
2003-10-10 17:18:34 +00:00
committed by Kristian Rietveld
parent 7d9c4f6ea3
commit e6100ecd11
15 changed files with 161 additions and 123 deletions

View File

@ -19,9 +19,6 @@
* up when the menu item is selected. Typically, all menu items in a menu bar
* have submenus.
*
* The GtkOptionMenu widget is a button that pops up a GtkMenu when clicked.
* It's used inside dialogs and such.
*
* GtkItemFactory provides a higher-level interface for creating menu bars
* and menus; while you can construct menus manually, most people don't
* do that. There's a separate demo for GtkItemFactory.
@ -130,62 +127,6 @@ do_menus (void)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
menu = create_menu (1, FALSE);
gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);
menuitem = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("Accelerate Me");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
gtk_widget_add_accelerator (menuitem,
"activate",
accel_group,
GDK_F1,
0,
GTK_ACCEL_VISIBLE);
menuitem = gtk_check_menu_item_new_with_label ("Accelerator Locked");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
gtk_widget_add_accelerator (menuitem,
"activate",
accel_group,
GDK_F2,
0,
GTK_ACCEL_VISIBLE | GTK_ACCEL_LOCKED);
menuitem = gtk_check_menu_item_new_with_label ("Accelerators Frozen");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
gtk_widget_add_accelerator (menuitem,
"activate",
accel_group,
GDK_F2,
0,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (menuitem,
"activate",
accel_group,
GDK_F3,
0,
GTK_ACCEL_VISIBLE);
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 3);
gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0);
gtk_widget_show (optionmenu);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);

View File

@ -17,29 +17,22 @@
static GtkWidget *window = NULL;
/* Convenience function to create an option menu holding a number of strings
/* Convenience function to create a combo box holding a number of strings
*/
GtkWidget *
create_option_menu (const char **strings)
create_combo_box (const char **strings)
{
GtkWidget *menu;
GtkWidget *option_menu;
GtkWidget *combo_box;
const char **str;
menu = gtk_menu_new ();
combo_box = gtk_combo_box_new_text ();
for (str = strings; *str; str++)
{
GtkWidget *menu_item = gtk_menu_item_new_with_label (*str);
gtk_widget_show (menu_item);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), *str);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
option_menu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
return option_menu;
return combo_box;
}
static void
@ -49,7 +42,7 @@ add_row (GtkTable *table,
const char *label_text,
const char **options)
{
GtkWidget *option_menu;
GtkWidget *combo_box;
GtkWidget *label;
label = gtk_label_new_with_mnemonic (label_text);
@ -59,10 +52,10 @@ add_row (GtkTable *table,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
option_menu = create_option_menu (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
gtk_size_group_add_widget (size_group, option_menu);
gtk_table_attach (GTK_TABLE (table), option_menu,
combo_box = create_combo_box (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
gtk_size_group_add_widget (size_group, combo_box);
gtk_table_attach (GTK_TABLE (table), combo_box,
1, 2, row, row + 1,
0, 0,
0, 0);

View File

@ -399,21 +399,11 @@ attach_widgets (GtkTextView *text_view)
}
else if (i == 1)
{
GtkWidget *menu_item;
GtkWidget *menu;
widget = gtk_combo_box_new_text ();
menu = gtk_menu_new ();
widget = gtk_option_menu_new ();
menu_item = gtk_menu_item_new_with_label ("Option 1");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
menu_item = gtk_menu_item_new_with_label ("Option 2");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
menu_item = gtk_menu_item_new_with_label ("Option 3");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 1");
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 2");
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 3");
}
else if (i == 2)
{