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

@ -1,3 +1,25 @@
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).
Wed Oct 8 00:06:17 2003 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/ui_manager.c (activate_radio_action): New

View File

@ -1,3 +1,25 @@
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).
Wed Oct 8 00:06:17 2003 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/ui_manager.c (activate_radio_action): New

View File

@ -1,3 +1,25 @@
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).
Wed Oct 8 00:06:17 2003 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/ui_manager.c (activate_radio_action): New

View File

@ -1,3 +1,25 @@
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).
Wed Oct 8 00:06:17 2003 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/ui_manager.c (activate_radio_action): New

View File

@ -1,3 +1,25 @@
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).
Wed Oct 8 00:06:17 2003 Matthias Clasen <maclas@gmx.de>
* demos/gtk-demo/ui_manager.c (activate_radio_action): New

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)
{

View File

@ -24,6 +24,8 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef GTK_DISABLE_DEPRECATED
#ifndef __GTK_SMART_COMBO_H__
#define __GTK_SMART_COMBO_H__
@ -117,4 +119,4 @@ void gtk_combo_disable_activate (GtkCombo* combo);
#endif /* __GTK_SMART_COMBO_H__ */
#endif /* GTK_DISABLE_DEPRECATED */

View File

@ -891,14 +891,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
bin_req.width = MAX (bin_req.width, combo_box->priv->width);
/* separator */
gtk_widget_set_size_request (combo_box->priv->separator,
-1, bin_req.height);
gtk_widget_size_request (combo_box->priv->separator, &sep_req);
/* arrow */
gtk_widget_set_size_request (combo_box->priv->arrow,
-1, bin_req.height);
gtk_widget_size_request (combo_box->priv->arrow, &arrow_req);
height = MAX (sep_req.height, arrow_req.height);
@ -909,15 +902,13 @@ gtk_combo_box_size_request (GtkWidget *widget,
height += border_width + 1 + xthickness * 2 + 4;
width += border_width + 1 + ythickness * 2 + 4;
gtk_widget_set_size_request (combo_box->priv->button, width, height);
gtk_widget_size_request (combo_box->priv->button, requisition);
requisition->width = width;
requisition->height = height;
}
else
{
GtkRequisition but_req;
gtk_widget_set_size_request (combo_box->priv->button,
-1, bin_req.height);
gtk_widget_size_request (combo_box->priv->button, &but_req);
requisition->width = bin_req.width + but_req.width;
@ -934,17 +925,15 @@ gtk_combo_box_size_request (GtkWidget *widget,
if (combo_box->priv->cell_view_frame)
{
requisition->width +=
requisition->width += 2 *
(GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness) * 2;
requisition->height +=
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
requisition->height += 2 *
(GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness) * 2;
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness);
}
/* the button */
gtk_widget_set_size_request (combo_box->priv->button,
-1, requisition->height);
gtk_widget_size_request (combo_box->priv->button, &button_req);
requisition->height = MAX (requisition->height, button_req.height);
@ -985,13 +974,12 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
/* handle the childs */
gtk_widget_size_request (combo_box->priv->arrow, &req);
child.width = req.width;
child.height = req.height;
child.height = allocation->height - 2 * (child.y - allocation->y);
child.x += width - req.width;
gtk_widget_size_allocate (combo_box->priv->arrow, &child);
gtk_widget_size_request (combo_box->priv->separator, &req);
child.width = req.width;
child.height = req.height;
child.x -= req.width;
gtk_widget_size_allocate (combo_box->priv->separator, &child);
@ -999,8 +987,6 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.x = allocation->x + border_width + 1 + xthickness + 2;
child.width -= child.x;
gtk_widget_size_request (GTK_BIN (widget)->child, &req);
child.height = req.height;
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
}
else
@ -1027,13 +1013,14 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.x = allocation->x + allocation->width - req.width;
child.y = allocation->y;
child.width = req.width;
child.height = req.height;
child.height = allocation->height;
gtk_widget_size_allocate (combo_box->priv->button, &child);
/* frame */
child.x = allocation->x;
child.y = allocation->y;
child.width = allocation->width - req.width;
child.height = allocation->height;
if (combo_box->priv->cell_view_frame)
{
@ -1046,12 +1033,12 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.y +=
GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness;
child.width -=
child.width -= 2 * (
GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness;
child.height -=
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
child.height -= 2 * (
GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness;
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness);
}
gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child);

View File

@ -73,12 +73,15 @@
#include "gtkvbox.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtkoptionmenu.h"
#include "gtkdialog.h"
#include "gtkmessagedialog.h"
#include "gtkdnd.h"
#include "gtkeventbox.h"
#undef GTK_DISABLE_DEPRECATED
#include "gtkoptionmenu.h"
#define GTK_DISABLE_DEPRECATED
#define WANT_HPANED 1
#include "gtkhpaned.h"

View File

@ -47,12 +47,15 @@
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtknotebook.h"
#include "gtkoptionmenu.h"
#include "gtkscrolledwindow.h"
#include "gtkstock.h"
#include "gtktable.h"
#include "gtkvbox.h"
#undef GTK_DISABLE_DEPRECATED
#include "gtkoptionmenu.h"
#define GTK_DISABLE_DEPRECATED
#include "gtkintl.h"
typedef struct _GtkInputDialogPrivate GtkInputDialogPrivate;

View File

@ -30,7 +30,6 @@
#include "config.h"
#include "gtkitemfactory.h"
#include "gtk/gtkoptionmenu.h"
#include "gtk/gtkmenubar.h"
#include "gtk/gtkmenu.h"
#include "gtk/gtkmenuitem.h"
@ -51,6 +50,10 @@
#endif
#include <stdio.h>
#undef GTK_DISABLE_DEPRECATED
#include "gtk/gtkoptionmenu.h"
#define GTK_DISABLE_DEPRECATED
/* --- defines --- */
#define ITEM_FACTORY_STRING ((gchar*) item_factory_string)
#define ITEM_BLOCK_SIZE (128)

View File

@ -27,10 +27,12 @@
#include "gtkintl.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtkoptionmenu.h"
#include "gtkmarshalers.h"
#include "gdk/gdkkeysyms.h"
#undef GTK_DISABLE_DEPRECATED
#include "gtkoptionmenu.h"
#define GTK_DISABLE_DEPRECATED
#define CHILD_LEFT_SPACING 4
#define CHILD_RIGHT_SPACING 1

View File

@ -24,6 +24,8 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef GTK_DISABLE_DEPRECATED
#ifndef __GTK_OPTION_MENU_H__
#define __GTK_OPTION_MENU_H__
@ -90,3 +92,5 @@ void gtk_option_menu_set_history (GtkOptionMenu *option_menu,
#endif /* __GTK_OPTION_MENU_H__ */
#endif /* GTK_DISABLE_DEPRECATED */