2008-06-30 23:01:56 +00:00
|
|
|
/* GTK - The GTK+ Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkadjustment.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
#include "gtkprivate.h"
|
|
|
|
#include "gtkintl.h"
|
2005-03-20 07:01:23 +00:00
|
|
|
#include "gtkalias.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2004-01-29 23:49:25 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_VALUE,
|
|
|
|
PROP_LOWER,
|
|
|
|
PROP_UPPER,
|
|
|
|
PROP_STEP_INCREMENT,
|
|
|
|
PROP_PAGE_INCREMENT,
|
|
|
|
PROP_PAGE_SIZE
|
|
|
|
};
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2008-03-14 17:26:12 +00:00
|
|
|
enum
|
|
|
|
{
|
1997-11-24 22:37:52 +00:00
|
|
|
CHANGED,
|
|
|
|
VALUE_CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-14 17:26:12 +00:00
|
|
|
static void gtk_adjustment_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_adjustment_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_adjustment_dispatch_properties_changed (GObject *object,
|
|
|
|
guint n_pspecs,
|
|
|
|
GParamSpec **pspecs);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint adjustment_signals[LAST_SIGNAL] = { 0 };
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2006-05-14 04:25:34 +00:00
|
|
|
G_DEFINE_TYPE (GtkAdjustment, gtk_adjustment, GTK_TYPE_OBJECT)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_adjustment_class_init (GtkAdjustmentClass *class)
|
|
|
|
{
|
2004-01-29 23:49:25 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
|
2008-03-14 17:26:12 +00:00
|
|
|
gobject_class->set_property = gtk_adjustment_set_property;
|
|
|
|
gobject_class->get_property = gtk_adjustment_get_property;
|
|
|
|
gobject_class->dispatch_properties_changed = gtk_adjustment_dispatch_properties_changed;
|
2004-01-29 23:49:25 +00:00
|
|
|
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
class->changed = NULL;
|
|
|
|
class->value_changed = NULL;
|
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:value:
|
|
|
|
*
|
|
|
|
* The value of the adjustment.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VALUE,
|
|
|
|
g_param_spec_double ("value",
|
|
|
|
P_("Value"),
|
|
|
|
P_("The value of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:lower:
|
|
|
|
*
|
|
|
|
* The minimum value of the adjustment.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_LOWER,
|
|
|
|
g_param_spec_double ("lower",
|
|
|
|
P_("Minimum Value"),
|
|
|
|
P_("The minimum value of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:upper:
|
|
|
|
*
|
|
|
|
* The maximum value of the adjustment.
|
|
|
|
* Note that values will be restricted by
|
|
|
|
* <literal>upper - page-size</literal> if the page-size
|
|
|
|
* property is nonzero.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_UPPER,
|
|
|
|
g_param_spec_double ("upper",
|
|
|
|
P_("Maximum Value"),
|
|
|
|
P_("The maximum value of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:step-increment:
|
|
|
|
*
|
|
|
|
* The step increment of the adjustment.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_STEP_INCREMENT,
|
|
|
|
g_param_spec_double ("step-increment",
|
|
|
|
P_("Step Increment"),
|
|
|
|
P_("The step increment of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:page-increment:
|
|
|
|
*
|
|
|
|
* The page increment of the adjustment.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_PAGE_INCREMENT,
|
|
|
|
g_param_spec_double ("page-increment",
|
|
|
|
P_("Page Increment"),
|
|
|
|
P_("The page increment of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
2004-12-27 06:34:10 +00:00
|
|
|
/**
|
|
|
|
* GtkAdjustment:page-size:
|
|
|
|
*
|
|
|
|
* The page size of the adjustment.
|
|
|
|
* Note that the page-size is irrelevant and should be set to zero
|
|
|
|
* if the adjustment is used for a simple scalar value, e.g. in a
|
|
|
|
* #GtkSpinButton.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
*/
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_PAGE_SIZE,
|
|
|
|
g_param_spec_double ("page-size",
|
|
|
|
P_("Page Size"),
|
|
|
|
P_("The page size of the adjustment"),
|
|
|
|
-G_MAXDOUBLE,
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
0.0,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2004-01-29 23:49:25 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
adjustment_signals[CHANGED] =
|
2005-09-01 05:11:46 +00:00
|
|
|
g_signal_new (I_("changed"),
|
2002-10-09 22:25:18 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (class),
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
G_STRUCT_OFFSET (GtkAdjustmentClass, changed),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2008-03-14 17:26:12 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
adjustment_signals[VALUE_CHANGED] =
|
2005-09-01 05:11:46 +00:00
|
|
|
g_signal_new (I_("value_changed"),
|
2002-10-09 22:25:18 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (class),
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
G_STRUCT_OFFSET (GtkAdjustmentClass, value_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_adjustment_init (GtkAdjustment *adjustment)
|
|
|
|
{
|
|
|
|
adjustment->value = 0.0;
|
|
|
|
adjustment->lower = 0.0;
|
|
|
|
adjustment->upper = 0.0;
|
|
|
|
adjustment->step_increment = 0.0;
|
|
|
|
adjustment->page_increment = 0.0;
|
|
|
|
adjustment->page_size = 0.0;
|
|
|
|
}
|
|
|
|
|
2004-01-29 23:49:25 +00:00
|
|
|
static void
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2004-01-29 23:49:25 +00:00
|
|
|
{
|
|
|
|
GtkAdjustment *adjustment = GTK_ADJUSTMENT (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_VALUE:
|
|
|
|
g_value_set_double (value, adjustment->value);
|
|
|
|
break;
|
|
|
|
case PROP_LOWER:
|
|
|
|
g_value_set_double (value, adjustment->lower);
|
|
|
|
break;
|
|
|
|
case PROP_UPPER:
|
|
|
|
g_value_set_double (value, adjustment->upper);
|
|
|
|
break;
|
|
|
|
case PROP_STEP_INCREMENT:
|
|
|
|
g_value_set_double (value, adjustment->step_increment);
|
|
|
|
break;
|
|
|
|
case PROP_PAGE_INCREMENT:
|
|
|
|
g_value_set_double (value, adjustment->page_increment);
|
|
|
|
break;
|
|
|
|
case PROP_PAGE_SIZE:
|
|
|
|
g_value_set_double (value, adjustment->page_size);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2004-01-29 23:49:25 +00:00
|
|
|
{
|
|
|
|
GtkAdjustment *adjustment = GTK_ADJUSTMENT (object);
|
|
|
|
gdouble double_value = g_value_get_double (value);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_VALUE:
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_set_value (adjustment, double_value);
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
case PROP_LOWER:
|
2008-03-14 17:26:12 +00:00
|
|
|
adjustment->lower = double_value;
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
case PROP_UPPER:
|
2008-03-14 17:26:12 +00:00
|
|
|
adjustment->upper = double_value;
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
case PROP_STEP_INCREMENT:
|
2008-03-14 17:26:12 +00:00
|
|
|
adjustment->step_increment = double_value;
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
case PROP_PAGE_INCREMENT:
|
2008-03-14 17:26:12 +00:00
|
|
|
adjustment->page_increment = double_value;
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
case PROP_PAGE_SIZE:
|
2008-03-14 17:26:12 +00:00
|
|
|
adjustment->page_size = double_value;
|
2004-01-29 23:49:25 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-14 17:26:12 +00:00
|
|
|
static void
|
|
|
|
gtk_adjustment_dispatch_properties_changed (GObject *object,
|
|
|
|
guint n_pspecs,
|
|
|
|
GParamSpec **pspecs)
|
|
|
|
{
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_adjustment_parent_class)->dispatch_properties_changed (object, n_pspecs, pspecs);
|
|
|
|
|
|
|
|
for (i = 0; i < n_pspecs; i++)
|
|
|
|
switch (pspecs[i]->param_id)
|
|
|
|
{
|
|
|
|
case PROP_LOWER:
|
|
|
|
case PROP_UPPER:
|
|
|
|
case PROP_STEP_INCREMENT:
|
|
|
|
case PROP_PAGE_INCREMENT:
|
|
|
|
case PROP_PAGE_SIZE:
|
|
|
|
changed = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
gtk_adjustment_changed (GTK_ADJUSTMENT (object));
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkObject *
|
2001-03-19 21:06:38 +00:00
|
|
|
gtk_adjustment_new (gdouble value,
|
|
|
|
gdouble lower,
|
|
|
|
gdouble upper,
|
|
|
|
gdouble step_increment,
|
|
|
|
gdouble page_increment,
|
|
|
|
gdouble page_size)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2004-01-29 23:49:25 +00:00
|
|
|
return g_object_new (GTK_TYPE_ADJUSTMENT,
|
|
|
|
"lower", lower,
|
|
|
|
"upper", upper,
|
|
|
|
"step-increment", step_increment,
|
|
|
|
"page-increment", page_increment,
|
2005-03-26 05:49:15 +00:00
|
|
|
"page-size", page_size,
|
2004-02-03 21:43:10 +00:00
|
|
|
"value", value,
|
2004-01-29 23:49:25 +00:00
|
|
|
NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-01-30 23:47:09 +00:00
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
/**
|
|
|
|
* gtk_adjustment_get_value:
|
|
|
|
* @adjustment: a #GtkAdjustment
|
|
|
|
*
|
|
|
|
* Gets the current value of the adjustment. See
|
|
|
|
* gtk_adjustment_set_value ().
|
|
|
|
*
|
|
|
|
* Return value: The current value of the adjustment.
|
|
|
|
**/
|
|
|
|
gdouble
|
|
|
|
gtk_adjustment_get_value (GtkAdjustment *adjustment)
|
|
|
|
{
|
2008-03-14 17:26:12 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0.0);
|
2001-06-24 15:34:48 +00:00
|
|
|
|
|
|
|
return adjustment->value;
|
|
|
|
}
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
void
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_set_value (GtkAdjustment *adjustment,
|
|
|
|
gdouble value)
|
1998-01-30 23:47:09 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
|
1998-05-02 18:35:23 +00:00
|
|
|
value = CLAMP (value, adjustment->lower, adjustment->upper);
|
|
|
|
|
|
|
|
if (value != adjustment->value)
|
|
|
|
{
|
|
|
|
adjustment->value = value;
|
|
|
|
|
1998-05-03 19:13:24 +00:00
|
|
|
gtk_adjustment_value_changed (adjustment);
|
1998-05-02 18:35:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_changed (GtkAdjustment *adjustment)
|
1998-05-02 18:35:23 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
|
2002-10-09 22:25:18 +00:00
|
|
|
g_signal_emit (adjustment, adjustment_signals[CHANGED], 0);
|
1998-05-02 18:35:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-03-14 17:26:12 +00:00
|
|
|
gtk_adjustment_value_changed (GtkAdjustment *adjustment)
|
1998-05-02 18:35:23 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
1998-01-30 23:47:09 +00:00
|
|
|
|
2002-10-09 22:25:18 +00:00
|
|
|
g_signal_emit (adjustment, adjustment_signals[VALUE_CHANGED], 0);
|
2004-01-29 23:49:25 +00:00
|
|
|
g_object_notify (G_OBJECT (adjustment), "value");
|
1998-01-30 23:47:09 +00:00
|
|
|
}
|
1998-05-01 04:23:59 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
|
2001-03-19 21:06:38 +00:00
|
|
|
gdouble lower,
|
|
|
|
gdouble upper)
|
1998-05-01 04:23:59 +00:00
|
|
|
{
|
2001-03-16 20:12:40 +00:00
|
|
|
gboolean need_emission;
|
1998-05-01 04:23:59 +00:00
|
|
|
|
|
|
|
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)
|
1998-05-03 19:13:24 +00:00
|
|
|
gtk_adjustment_value_changed (adjustment);
|
1998-05-01 04:23:59 +00:00
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
|
|
|
#define __GTK_ADJUSTMENT_C__
|
|
|
|
#include "gtkaliasdef.c"
|