[maemo-commits] [maemo-commits] r13517 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 31 14:18:15 EEST 2007
Author: mitch
Date: 2007-08-31 14:18:12 +0300 (Fri, 31 Aug 2007)
New Revision: 13517

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkmenuitem.c
Log:
2007-08-31  Michael Natterer  <mitch at imendio.com>

	* gtk/gtkmenuitem.c: add an arrow-scaling style property which allows
	to configure the size of the submenu indicator (1.0 means font size).



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2007-08-31 09:01:00 UTC (rev 13516)
+++ projects/haf/trunk/gtk+/ChangeLog	2007-08-31 11:18:12 UTC (rev 13517)
@@ -1,3 +1,8 @@
+2007-08-31  Michael Natterer  <mitch at imendio.com>
+
+	* gtk/gtkmenuitem.c: add an arrow-scaling style property which allows
+	to configure the size of the submenu indicator (1.0 means font size).
+
 2007-08-31  Xan Lopez  <xan.lopez at nokia.com>
 
 	* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):

Modified: projects/haf/trunk/gtk+/gtk/gtkmenuitem.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkmenuitem.c	2007-08-31 09:01:00 UTC (rev 13516)
+++ projects/haf/trunk/gtk+/gtk/gtkmenuitem.c	2007-08-31 11:18:12 UTC (rev 13517)
@@ -241,6 +241,13 @@
 							     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, 10.0, 0.8,
+                                                               GTK_PARAM_READABLE));
 }
 
 static void
@@ -862,31 +869,31 @@
 	  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);
 	  metrics = pango_context_get_metrics (context, 
 					       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 * 0.8;
-	  
+	  arrow_extent = arrow_size * arrow_scaling;
+
 	  shadow_type = GTK_SHADOW_OUT;
 #ifdef MAEMO_CHANGES
 	  if (state_type == GTK_STATE_PRELIGHT &&


More information about the maemo-commits mailing list