diff options
author | Owen Taylor <otaylor@src.gnome.org> | 1998-05-01 04:23:59 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-05-01 04:23:59 +0000 |
commit | 05bc6a5b3639869eee69cfa4a2db8b8968b247cb (patch) | |
tree | 58bad8f48d24c88dfc95206defe79dd0464256f6 /gtk/gtkadjustment.c | |
parent | e909f843f8e2949144e624ce1af4fd1737396f62 (diff) | |
download | gdk-pixbuf-05bc6a5b3639869eee69cfa4a2db8b8968b247cb.tar.gz |
Merged changes from gtk-1-0. Check ChangeLog for details.
Diffstat (limited to 'gtk/gtkadjustment.c')
-rw-r--r-- | gtk/gtkadjustment.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index 40de518a8..37b2aa346 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -34,10 +34,10 @@ static void gtk_adjustment_init (GtkAdjustment *adjustment); static guint adjustment_signals[LAST_SIGNAL] = { 0 }; -guint +GtkType gtk_adjustment_get_type () { - static guint adjustment_type = 0; + static GtkType adjustment_type = 0; if (!adjustment_type) { @@ -130,3 +130,33 @@ gtk_adjustment_set_value (GtkAdjustment *adjustment, gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed"); } + +void +gtk_adjustment_clamp_page (GtkAdjustment *adjustment, + gfloat lower, + gfloat upper) +{ + gint need_emission; + + g_return_if_fail (adjustment != NULL); + g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); + + lower = CLAMP (lower, adjustment->lower, adjustment->upper); + upper = CLAMP (upper, adjustment->lower, adjustment->upper); + + need_emission = FALSE; + + if (adjustment->value + adjustment->page_size < upper) + { + adjustment->value = upper - adjustment->page_size; + need_emission = TRUE; + } + if (adjustment->value > lower) + { + adjustment->value = lower; + need_emission = TRUE; + } + + if (need_emission) + gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed"); +} |