[gtk+/native-layout] Bug 607082 - Add accessors for sealed GtkRange members
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Bug 607082 - Add accessors for sealed GtkRange members
- Date: Sun, 4 Apr 2010 02:21:02 +0000 (UTC)
commit 5585335dd9652e87f107f85c067c6888ed6fc46a
Author: Michael Natterer <mitch gimp org>
Date: Fri Jan 22 16:52:56 2010 +0100
Bug 607082 - Add accessors for sealed GtkRange members
Add accessors for range->range_rect, range->slider_range,
range->slider_size_fixed and range->min_slider_size. Didn't add
properties for any of them because thir purpose is mostly to enable
proper subclassing.
gtk/gtk.symbols | 6 ++
gtk/gtkrange.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkrange.h | 14 +++++
3 files changed, 169 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 871a22b..dccf556 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -3359,8 +3359,12 @@ gtk_range_get_fill_level
gtk_range_get_flippable
gtk_range_get_inverted
gtk_range_get_lower_stepper_sensitivity
+gtk_range_get_min_slider_size
+gtk_range_get_range_rect
gtk_range_get_restrict_to_fill_level
gtk_range_get_show_fill_level
+gtk_range_get_slider_range
+gtk_range_get_slider_size_fixed
gtk_range_get_type G_GNUC_CONST
gtk_range_get_update_policy
gtk_range_get_upper_stepper_sensitivity
@@ -3371,9 +3375,11 @@ gtk_range_set_flippable
gtk_range_set_increments
gtk_range_set_inverted
gtk_range_set_lower_stepper_sensitivity
+gtk_range_set_min_slider_size
gtk_range_set_range
gtk_range_set_restrict_to_fill_level
gtk_range_set_show_fill_level
+gtk_range_set_slider_size_fixed
gtk_range_set_update_policy
gtk_range_set_upper_stepper_sensitivity
gtk_range_set_value
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 18224e0..90cd8cb 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -890,6 +890,155 @@ gtk_range_get_flippable (GtkRange *range)
}
/**
+ * gtk_range_set_slider_size_fixed:
+ * @range: a #GtkRange
+ * @size_fixed: %TRUE to make the slider size constant
+ *
+ * Sets whether the range's slider has a fixed size, or a size that
+ * depends on it's adjustment's page size.
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * Since: 2.20
+ **/
+void
+gtk_range_set_slider_size_fixed (GtkRange *range,
+ gboolean size_fixed)
+{
+ g_return_if_fail (GTK_IS_RANGE (range));
+
+ if (size_fixed != range->slider_size_fixed)
+ {
+ range->slider_size_fixed = size_fixed ? TRUE : FALSE;
+
+ range->need_recalc = TRUE;
+ gtk_range_calc_layout (range, range->adjustment->value);
+ gtk_widget_queue_draw (GTK_WIDGET (range));
+ }
+}
+
+/**
+ * gtk_range_get_slider_size_fixed:
+ * @range: a #GtkRange
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * See gtk_range_set_slider_size_fixed().
+ *
+ * Return value: whether the range's slider has a fixed size.
+ *
+ * Since: 2.20
+ **/
+gboolean
+gtk_range_get_slider_size_fixed (GtkRange *range)
+{
+ g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
+
+ return range->slider_size_fixed;
+}
+
+/**
+ * gtk_range_set_min_slider_size:
+ * @range: a #GtkRange
+ * @min_size: The slider's minimum size
+ *
+ * Sets the minimum size of the range's slider.
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * Since: 2.20
+ **/
+void
+gtk_range_set_min_slider_size (GtkRange *range,
+ gboolean min_size)
+{
+ g_return_if_fail (GTK_IS_RANGE (range));
+ g_return_if_fail (min_size > 0);
+
+ if (min_size != range->min_slider_size)
+ {
+ range->min_slider_size = min_size;
+
+ range->need_recalc = TRUE;
+ gtk_range_calc_layout (range, range->adjustment->value);
+ gtk_widget_queue_draw (GTK_WIDGET (range));
+ }
+}
+
+/**
+ * gtk_range_get_min_slider_size:
+ * @range: a #GtkRange
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * See gtk_range_set_min_slider_size().
+ *
+ * Return value: The minimum size of the range's slider.
+ *
+ * Since: 2.20
+ **/
+gint
+gtk_range_get_min_slider_size (GtkRange *range)
+{
+ g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
+
+ return range->min_slider_size;
+}
+
+/**
+ * gtk_range_get_range_rect:
+ * @range: a #GtkRange
+ * @range_rect: return location for the range rectangle
+ *
+ * This function returns the area that contains the range's trough
+ * and its steppers, in widget->window coordinates.
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * Since: 2.20
+ **/
+void
+gtk_range_get_range_rect (GtkRange *range,
+ GdkRectangle *range_rect)
+{
+ g_return_if_fail (GTK_IS_RANGE (range));
+ g_return_if_fail (range_rect != NULL);
+
+ gtk_range_calc_layout (range, range->adjustment->value);
+
+ *range_rect = range->range_rect;
+}
+
+/**
+ * gtk_range_get_slider_range:
+ * @range: a #GtkRange
+ * @slider_start: return location for the slider's start, or %NULL
+ * @slider_end: return location for the slider's end, or %NULL
+ *
+ * This function returns sliders range along the long dimension,
+ * in widget->window coordinates.
+ *
+ * This function is useful mainly for #GtkRange subclasses.
+ *
+ * Since: 2.20
+ **/
+void
+gtk_range_get_slider_range (GtkRange *range,
+ gint *slider_start,
+ gint *slider_end)
+{
+ g_return_if_fail (GTK_IS_RANGE (range));
+
+ gtk_range_calc_layout (range, range->adjustment->value);
+
+ if (slider_start)
+ *slider_start = range->slider_start;
+
+ if (slider_end)
+ *slider_end = range->slider_end;
+}
+
+/**
* gtk_range_set_lower_stepper_sensitivity:
* @range: a #GtkRange
* @sensitivity: the lower stepper's sensitivity policy.
diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h
index 268a522..abfbc7c 100644
--- a/gtk/gtkrange.h
+++ b/gtk/gtkrange.h
@@ -151,6 +151,20 @@ void gtk_range_set_flippable (GtkRange *range
gboolean flippable);
gboolean gtk_range_get_flippable (GtkRange *range);
+void gtk_range_set_slider_size_fixed (GtkRange *range,
+ gboolean size_fixed);
+gboolean gtk_range_get_slider_size_fixed (GtkRange *range);
+
+void gtk_range_set_min_slider_size (GtkRange *range,
+ gboolean min_size);
+gint gtk_range_get_min_slider_size (GtkRange *range);
+
+void gtk_range_get_range_rect (GtkRange *range,
+ GdkRectangle *range_rect);
+void gtk_range_get_slider_range (GtkRange *range,
+ gint *slider_start,
+ gint *slider_end);
+
void gtk_range_set_lower_stepper_sensitivity (GtkRange *range,
GtkSensitivityType sensitivity);
GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange *range);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]