]> Pileus Git - ~andy/gtk/commitdiff
combobox: add an arrow-scaling property to GtkComboBox
authorCosimo Cecchi <cosimoc@gnome.org>
Mon, 28 Feb 2011 21:37:52 +0000 (16:37 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Thu, 3 Mar 2011 22:48:25 +0000 (17:48 -0500)
gtk/gtkcombobox.c

index 8625ef85c3323c06fcf99bcd8770db3623e33e72..bf2955fb3a0b83c3d6ccbc49d8a567caac481e80 100644 (file)
@@ -972,6 +972,23 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
                                                              15,
                                                              GTK_PARAM_READABLE));
 
+  /**
+   * GtkComboBox:arrow-scaling:
+   *
+   * Sets the amount of space used up by the combobox arrow,
+   * proportional to the font size.
+   *
+   * Since: 3.2
+   */
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_float ("arrow-scaling",
+                                                               P_("Arrow Scaling"),
+                                                               P_("The amount of space used by the arrow"),
+                                                             0,
+                                                             2.0,
+                                                             1.0,
+                                                             GTK_PARAM_READABLE));
+
   /**
    * GtkComboBox:shadow-type:
    *
@@ -5264,6 +5281,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
   GtkStyleContext       *style_context;
   GtkStateFlags          state;
   GtkBorder             *border;
+  gfloat                 arrow_scaling;
 
   child = gtk_bin_get_child (GTK_BIN (widget));
 
@@ -5274,6 +5292,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
                         "focus-line-width", &focus_width,
                         "focus-padding", &focus_pad,
                         "arrow-size", &arrow_size,
+                        "arrow-scaling", &arrow_scaling,
                         NULL);
 
   style_context = gtk_widget_get_style_context (widget);
@@ -5292,7 +5311,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget,
   pango_font_metrics_unref (metrics);
   pango_font_description_free (font_desc);
 
-  arrow_size = MAX (arrow_size, font_size);
+  arrow_size = MAX (arrow_size, font_size) * arrow_scaling;
 
   gtk_widget_set_size_request (priv->arrow, arrow_size, arrow_size);