diff options
author | Kristian Rietveld <kris@gtk.org> | 2003-10-10 17:18:34 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2003-10-10 17:18:34 +0000 |
commit | e6100ecd110ab750644b6311bec304f6e1b55622 (patch) | |
tree | 5e0e740d0e55c4f281ed6682095e4a8935da8141 /demos | |
parent | 7d9c4f6ea3d542d64f6802be9f1426cb699804d0 (diff) | |
download | gtk+-e6100ecd110ab750644b6311bec304f6e1b55622.tar.gz |
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).
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/menus.c | 59 | ||||
-rw-r--r-- | demos/gtk-demo/sizegroup.c | 31 | ||||
-rw-r--r-- | demos/gtk-demo/textview.c | 18 |
3 files changed, 16 insertions, 92 deletions
diff --git a/demos/gtk-demo/menus.c b/demos/gtk-demo/menus.c index eb4df916f7..9ab61af350 100644 --- a/demos/gtk-demo/menus.c +++ b/demos/gtk-demo/menus.c @@ -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. @@ -132,62 +129,6 @@ do_menus (void) 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); gtk_widget_show (box2); diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c index 930a0d61f8..e2fa1705d2 100644 --- a/demos/gtk-demo/sizegroup.c +++ b/demos/gtk-demo/sizegroup.c @@ -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_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - } + gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), *str); - option_menu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0); - 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); diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c index fbec120b4b..f331ffa9f4 100644 --- a/demos/gtk-demo/textview.c +++ b/demos/gtk-demo/textview.c @@ -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) { |