mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Make GtkMenuItem's arrow size themeable. (#469239, Michael Natterer)
2007-11-21 Behdad Esfahbod <behdad@gnome.org> * gtk/gtkmenuitem.c (gtk_menu_item_class_init), (gtk_menu_item_paint): Make GtkMenuItem's arrow size themeable. (#469239, Michael Natterer) svn path=/trunk/; revision=19020
This commit is contained in:
parent
f4d4a6e6cb
commit
a64cba34e3
@ -1,3 +1,9 @@
|
||||
2007-11-21 Behdad Esfahbod <behdad@gnome.org>
|
||||
|
||||
* gtk/gtkmenuitem.c (gtk_menu_item_class_init),
|
||||
(gtk_menu_item_paint): Make GtkMenuItem's arrow size themeable.
|
||||
(#469239, Michael Natterer)
|
||||
|
||||
2007-11-21 Behdad Esfahbod <behdad@gnome.org>
|
||||
|
||||
* gdk/x11/gdksettings.c (gdk_settings_names, gdk_settings_map): Add
|
||||
|
@ -241,6 +241,13 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
G_MAXINT,
|
||||
10,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_float ("arrow-scaling",
|
||||
P_("Arrow Scaling"),
|
||||
P_("Amount of space used up by arrow, relative to the menu item's font size"),
|
||||
0.0, 2.0, 0.8,
|
||||
GTK_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -862,16 +869,17 @@ gtk_menu_item_paint (GtkWidget *widget,
|
||||
gint arrow_size;
|
||||
gint arrow_extent;
|
||||
guint horizontal_padding;
|
||||
gfloat arrow_scaling;
|
||||
GtkTextDirection direction;
|
||||
GtkArrowType arrow_type;
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
gint ascent, descent;
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
"arrow-scaling", &arrow_scaling,
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_pango_context (GTK_BIN (menu_item)->child);
|
||||
@ -879,13 +887,15 @@ gtk_menu_item_paint (GtkWidget *widget,
|
||||
GTK_WIDGET (GTK_BIN (menu_item)->child)->style->font_desc,
|
||||
pango_context_get_language (context));
|
||||
|
||||
ascent = pango_font_metrics_get_ascent (metrics);
|
||||
descent = pango_font_metrics_get_descent (metrics);
|
||||
arrow_size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
||||
pango_font_metrics_get_descent (metrics)));
|
||||
|
||||
pango_font_metrics_unref (metrics);
|
||||
|
||||
arrow_size = PANGO_PIXELS (ascent + descent) - 2 * widget->style->ythickness;
|
||||
arrow_extent = arrow_size * arrow_scaling;
|
||||
|
||||
arrow_extent = arrow_size * 0.8;
|
||||
g_printerr ("%s: scaling = %f size = %d extent = %d\n",
|
||||
G_STRFUNC, arrow_scaling, arrow_size, arrow_extent);
|
||||
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
if (state_type == GTK_STATE_PRELIGHT)
|
||||
|
Loading…
Reference in New Issue
Block a user