[gtk+/a11y] GtkAdjustment: add an auxiliary function



commit 95e8b5bd62f22cdca1bb06cbafad455818faa679
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 28 00:38:20 2011 -0400

    GtkAdjustment: add an auxiliary function
    
    This is going to be used in AtkValue implementations.

 gtk/a11y/gailadjustment.c |  230 ---------------------------------------------
 gtk/a11y/gailadjustment.h |   55 -----------
 gtk/gtk.symbols           |    1 +
 gtk/gtkadjustment.c       |   44 +++++++++
 gtk/gtkadjustment.h       |    2 +
 5 files changed, 47 insertions(+), 285 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 5bac657..83e83fd 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -157,6 +157,7 @@ gtk_adjustment_changed
 gtk_adjustment_clamp_page
 gtk_adjustment_configure
 gtk_adjustment_get_lower
+gtk_adjustment_get_minimum_increment
 gtk_adjustment_get_page_increment
 gtk_adjustment_get_page_size
 gtk_adjustment_get_step_increment
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index 40329a4..29aa1c9 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -809,3 +809,47 @@ gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
   if (need_emission)
     gtk_adjustment_value_changed (adjustment);
 }
+
+/**
+ * gtk_adjustment_get_minimum_increment:
+ * @adjustment: a #GtkAdjustment
+ *
+ * Gets the smaller of step increment and page increment.
+ *
+ * Returns: the minimum increment of @adjustment
+ *
+ * Since: 3.2
+ */
+gdouble
+gtk_adjustment_get_minimum_increment (GtkAdjustment *adjustment)
+{
+  GtkAdjustmentPrivate *priv;
+  gdouble minimum_increment;
+
+  g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0);
+
+  priv = adjustment->priv;
+
+    if (priv->step_increment != 0 && priv->page_increment != 0)
+    {
+      if (ABS (priv->step_increment) < ABS (priv->page_increment))
+        minimum_increment = priv->step_increment;
+      else
+        minimum_increment = priv->page_increment;
+    }
+  else if (priv->step_increment == 0 && priv->page_increment == 0)
+    {
+      minimum_increment = 0;
+    }
+  else if (priv->step_increment == 0)
+    {
+      minimum_increment = priv->page_increment;
+    }
+  else
+    {
+      minimum_increment = priv->step_increment;
+    }
+
+  return minimum_increment;
+}
+
diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h
index 1ea9de5..d3ff03a 100644
--- a/gtk/gtkadjustment.h
+++ b/gtk/gtkadjustment.h
@@ -116,6 +116,8 @@ void       gtk_adjustment_configure             (GtkAdjustment   *adjustment,
                                                  gdouble          page_increment,
                                                  gdouble          page_size);
 
+gdouble    gtk_adjustment_get_minimum_increment (GtkAdjustment   *adjustment);
+
 G_END_DECLS
 
 #endif /* __GTK_ADJUSTMENT_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]