summaryrefslogtreecommitdiff
path: root/gtk/gtkmenuitem.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2003-11-19 19:44:45 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2003-11-19 19:44:45 +0000
commit907483c615db1f15549c5130a2e16c207c079dc5 (patch)
tree32c2015cf8237d99ed6c196cfd9254fb5a34123c /gtk/gtkmenuitem.c
parenta3976b68b68739c4d1020eeb7409c7d8ce13674a (diff)
downloadgtk+-907483c615db1f15549c5130a2e16c207c079dc5.tar.gz
set to 200 instead of 225 Impose a minimum width on items that have a
Wed Nov 19 18:15:00 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkmenu.c (DEFAULT_POPUP_DELAY): set to 200 instead of 225 * gtk/gtkmenuitem.c (get_minimum_width): Impose a minimum width on items that have a submenu. (#120104). Wed Nov 19 18:11:08 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtktoolbar.c (struct _ToolbarContent): Add a new "ItemState" field indicating the overflowed-ness etc. of the item. (gtk_toolbar_size_allocate): update the field here.
Diffstat (limited to 'gtk/gtkmenuitem.c')
-rw-r--r--gtk/gtkmenuitem.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 3cb2b948f5..3058706b97 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -465,6 +465,26 @@ gtk_menu_item_accel_width_foreach (GtkWidget *widget,
data);
}
+static gint
+get_minimum_width (GtkWidget *widget)
+{
+ PangoContext *context;
+ PangoFontMetrics *metrics;
+ gint height;
+
+ context = gtk_widget_get_pango_context (widget);
+ metrics = pango_context_get_metrics (context,
+ widget->style->font_desc,
+ pango_context_get_language (context));
+
+ height = pango_font_metrics_get_ascent (metrics) +
+ pango_font_metrics_get_descent (metrics);
+
+ pango_font_metrics_unref (metrics);
+
+ return PANGO_PIXELS (7 * height);
+}
+
static void
gtk_menu_item_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@ -508,6 +528,8 @@ gtk_menu_item_size_request (GtkWidget *widget,
requisition->width += child_requisition.height;
requisition->width += arrow_spacing;
+
+ requisition->width = MAX (requisition->width, get_minimum_width (widget));
}
}
else