clamp the value to the range that was set

2001-06-05  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkspinbutton.c (gtk_spin_button_set_range): clamp the value
	to the range that was set

	* gtk/gtkrange.c: add value_changed signal, primarily
	intended for use with GtkScale
	(gtk_range_set_increments): new function
	(gtk_range_set_range): new function with weird name
	(gtk_range_set_value): new function
	(gtk_range_get_value): new function

	* gtk/gtkspinbutton.c (gtk_spin_button_get_value): rename
	from gtk_spin_button_get_value_as_float(). Compat #define
	added for get_value_as_float.

	* gtk/gtkhscale.c (gtk_hscale_new_with_range): new function

	* gtk/gtkvscale.c (gtk_vscale_new_with_range): new function

2001-06-05  Havoc Pennington  <hp@redhat.com>

	* test-loaders.c (main): use putenv not setenv, reported by
	 Armin Theissen
This commit is contained in:
Havoc Pennington
2001-06-05 20:07:02 +00:00
committed by Havoc Pennington
parent 451b224324
commit b32e7c9bb8
23 changed files with 493 additions and 32 deletions

View File

@ -7,9 +7,8 @@ a horizontal slider widget for selecting a value from a range.
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GtkHScale widget is used to allow the user to select a value using
a horizontal slider.
A #GtkAdjustment is used to set the initial value, the lower
and upper bounds, and the step and page increments.
a horizontal slider. To create one, use
gtk_hscale_new_with_range().
</para>
<para>
The position to show the current value, and the number of decimal places

View File

@ -67,14 +67,21 @@ GtkRange
<!-- ##### SIGNAL GtkRange::move-slider ##### -->
<para>
Virtual function that moves the slider. Used for keybindings.
</para>
@range: the object which received the signal.
@arg1:
@range: the #GtkRange
@step: how to move the slider
<!-- # Unused Parameters # -->
@arg2:
<!-- ##### SIGNAL GtkRange::value-changed ##### -->
<para>
Emitted when the range value changes.
</para>
@range: the #GtkRange
<!-- ##### ARG GtkRange:update-policy ##### -->
<para>

View File

@ -6,8 +6,17 @@ a base class for #GtkHScale and #GtkVScale.
<!-- ##### SECTION Long_Description ##### -->
<para>
A #GtkScale is a slider control used to select a numeric value.
To use it, you'll probably want to investigate the methods on
its base class, #GtkRange, in addition to the methods for #GtkScale itself.
To set the value of a scale, you would normally use gtk_range_set_value().
To detect changes to the value, you would normally use the "value_changed"
signal.
</para>
<para>
The #GtkScale widget is an abstract class, used only for deriving the
subclasses #GtkHScale and #GtkVScale.
subclasses #GtkHScale and #GtkVScale. To create a scale widget,
call gtk_hscale_new_with_range() or gtk_vscale_new_with_range().
</para>
<!-- ##### SECTION See_Also ##### -->
@ -74,12 +83,25 @@ Sets the position in which the current value is displayed.
<!-- ##### SIGNAL GtkScale::format-value ##### -->
<para>
Signal which allows you to change how the scale value is displayed. Connect a
signal handler which returns an allocated string representing @value.
That string will then be used to display the scale's value.
Here's an example signal handler which displays a value 1.0 as
with "-->1.0<--".
<programlisting>
static gchar*
format_value_callback (GtkScale *scale,
gdouble value)
{
return g_strdup_printf ("-->%0.*g<--",
gtk_scale_get_digits (scale), value);
}
</programlisting>
</para>
@scale: the object which received the signal.
@arg1:
@Returns:
@value: value to format
@Returns: allocated string representing @value
<!-- ##### ARG GtkScale:digits ##### -->
<para>

View File

@ -230,13 +230,14 @@ Creates a new #GtkSpinButton.
@max:
<!-- ##### FUNCTION gtk_spin_button_get_value_as_float ##### -->
<!-- ##### MACRO gtk_spin_button_get_value_as_float ##### -->
<para>
</para>
@spin_button:
@Returns:
<!-- # Unused Parameters # -->
@spin_button:
<!-- ##### FUNCTION gtk_spin_button_get_value_as_int ##### -->

View File

@ -8,8 +8,7 @@ a vertical slider widget for selecting a value from a range.
<para>
The #GtkVScale widget is used to allow the user to select a value using
a vertical slider.
A #GtkAdjustment is used to set the initial value, the lower
and upper bounds, and the step and page increments.
To create one, use gtk_hscale_new_with_range().
</para>
<para>
The position to show the current value, and the number of decimal places