public class Adjustment extends Object
ScrolledWindow
.
A single Adjustment object can be shared by more than one Widget. Thus if you need to have multiple Widgets behave similarly with respect to say vertical scrolling, a single Adjustment object will do.
An Adjustment does not update its own values. Associated Widgets
that use an Adjustment call the emitValueChanged()
method on
the widget, causing a Adjustment.ValueChanged
signal which in
turn is what drives GTK's internal scrolling behaviours. You can react to
it too.
Modifier and Type | Class and Description |
---|---|
static interface |
Adjustment.Changed
This signal is emitted when one or more of Adjustment's fields, other
than the value field have been changed.
|
static interface |
Adjustment.ValueChanged
This signal is emitted when Adjustment's value field has
been changed.
|
Constructor and Description |
---|
Adjustment()
Create an Adjustment with all parameters set to initial values of 0.
|
Adjustment(double value,
double lower,
double upper,
double stepIncrement,
double pageIncrement,
double pageSize)
Create a new Adjustment, with given values for the initial
value value, the lower and upper
bounds, the single step increment, page increment
and the page size properties.
|
Modifier and Type | Method and Description |
---|---|
void |
clampPage(double lower,
double upper)
Update the Adjustment's value, to ensure that the bound, defined by
lower and upper , is in the current page. |
void |
configure(double value,
double lower,
double upper,
double stepIncrement,
double pageIncrement,
double pageSize)
Change all the configuration values and the data value.
|
void |
connect(Adjustment.Changed handler)
Hook up an
Adjustment.Changed signal handler. |
void |
connect(Adjustment.ValueChanged handler)
Hook up an
Adjustment.ValueChanged signal handler. |
void |
emitChanged()
Emits a
Adjustment.Changed signal from the Adjustment
widget. |
void |
emitValueChanged()
Emits a
Adjustment.ValueChanged signal on the Adjustment. |
double |
getLower()
Get the lower bound of the Adjustment.
|
double |
getPageSize()
Get the current value of the page-size property of this
Adjustment.
|
double |
getUpper()
Get the upper bound of the Adjustment.
|
double |
getValue()
Get the current value of the Adjustment.
|
void |
setLower(double lower)
Set the lower bound of this Adjustment.
|
void |
setUpper(double upper)
Set the upper bound of this Adjustment.
|
void |
setValue(double value)
Set the value of the Adjustment.
|
public Adjustment()
public Adjustment(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize)
Be aware that pageSize
must be set to zero if this
Adjustment is representing a single scalar value (ie, if it is going to
be the Adjustment backing a SpinButton or Scale).
public void clampPage(double lower, double upper)
lower
and upper
, is in the current page.
Thus, it will lie between value
and
value + pageSize
that you set in the constructor. If the
bound is larger than the page size, then only the start of it will be
in the current page.
As always, a Adjustment.ValueChanged
signal is emitted if
the value is changed.
public void configure(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize)
This is available as as a single method rather than a series of
individual setters because each invocation of a setter causes
Adjustment.Changed
to be emitted, and generally you'd only
want one per sequence of property changes.
public void connect(Adjustment.Changed handler)
Adjustment.Changed
signal handler.public void connect(Adjustment.ValueChanged handler)
Adjustment.ValueChanged
signal handler.public void emitChanged()
Adjustment.Changed
signal from the Adjustment
widget. This method will typically be called by the Widget with which
the Adjustment is associated when it changes any of Adjustment's
properties, other than value.
If you have changed value, then emitValueChanged()
is the method you want to change instead.
public void emitValueChanged()
Adjustment.ValueChanged
signal on the Adjustment.
This method is probably unnecessary, since calling
setValue()
will result in the signal being
raised.public double getLower()
0
.public double getPageSize()
public double getUpper()
public double getValue()
setValue()
.public void setLower(double lower)
0.0
and leave it that way, so
you probably won't need this much.
Use configure()
if changing more than one property at a time.
public void setUpper(double upper)
Use configure()
if changing more than one property at a time.
public void setValue(double value)