Commit 35a2b653 authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent 52acceef
......@@ -3348,8 +3348,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
......@@ -3360,9 +3364,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
......
......@@ -889,6 +889,155 @@ gtk_range_get_flippable (GtkRange *range)
return range->flippable;
}
/**
* 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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment