|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>Range Widgets
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
NAME="GENERATOR"
|
|
Packit |
98cdb6 |
CONTENT="Modular DocBook HTML Stylesheet Version 1.79">
|
|
Packit |
98cdb6 |
REL="HOME"
|
|
Packit |
98cdb6 |
TITLE="GTK+ 2.0 Tutorial"
|
|
Packit |
98cdb6 |
HREF="book1.html">
|
|
Packit |
98cdb6 |
REL="PREVIOUS"
|
|
Packit |
98cdb6 |
TITLE="Adjustment Internals"
|
|
Packit |
98cdb6 |
HREF="x602.html">
|
|
Packit |
98cdb6 |
REL="NEXT"
|
|
Packit |
98cdb6 |
TITLE="Scale Widgets"
|
|
Packit |
98cdb6 |
HREF="x645.html">
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="CHAPTER"
|
|
Packit |
98cdb6 |
BGCOLOR="#FFFFFF"
|
|
Packit |
98cdb6 |
TEXT="#000000"
|
|
Packit |
98cdb6 |
LINK="#0000FF"
|
|
Packit |
98cdb6 |
VLINK="#840084"
|
|
Packit |
98cdb6 |
ALINK="#0000FF"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="NAVHEADER"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
SUMMARY="Header navigation table"
|
|
Packit |
98cdb6 |
WIDTH="100%"
|
|
Packit |
98cdb6 |
BORDER="0"
|
|
Packit |
98cdb6 |
CELLPADDING="0"
|
|
Packit |
98cdb6 |
CELLSPACING="0"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
COLSPAN="3"
|
|
Packit |
98cdb6 |
ALIGN="center"
|
|
Packit |
98cdb6 |
>GTK+ 2.0 Tutorial
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="10%"
|
|
Packit |
98cdb6 |
ALIGN="left"
|
|
Packit |
98cdb6 |
VALIGN="bottom"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
HREF="x602.html"
|
|
Packit |
98cdb6 |
ACCESSKEY="P"
|
|
Packit |
98cdb6 |
><<< Previous
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="80%"
|
|
Packit |
98cdb6 |
ALIGN="center"
|
|
Packit |
98cdb6 |
VALIGN="bottom"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="10%"
|
|
Packit |
98cdb6 |
ALIGN="right"
|
|
Packit |
98cdb6 |
VALIGN="bottom"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
HREF="x645.html"
|
|
Packit |
98cdb6 |
ACCESSKEY="N"
|
|
Packit |
98cdb6 |
>Next >>>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
ALIGN="LEFT"
|
|
Packit |
98cdb6 |
WIDTH="100%">
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="CHAPTER"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
NAME="CH-RANGEWIDGETS"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>Range Widgets
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>The category of range widgets includes the ubiquitous scrollbar widget
|
|
Packit |
98cdb6 |
and the less common scale widget. Though these two types of widgets
|
|
Packit |
98cdb6 |
are generally used for different purposes, they are quite similar in
|
|
Packit |
98cdb6 |
function and implementation. All range widgets share a set of common
|
|
Packit |
98cdb6 |
graphic elements, each of which has its own X window and receives
|
|
Packit |
98cdb6 |
events. They all contain a "trough" and a "slider" (what is sometimes
|
|
Packit |
98cdb6 |
called a "thumbwheel" in other GUI environments). Dragging the slider
|
|
Packit |
98cdb6 |
with the pointer moves it back and forth within the trough, while
|
|
Packit |
98cdb6 |
clicking in the trough advances the slider towards the location of the
|
|
Packit |
98cdb6 |
click, either completely, or by a designated amount, depending on
|
|
Packit |
98cdb6 |
which mouse button is used.
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>As mentioned in
|
|
Packit |
98cdb6 |
HREF="c563.html"
|
|
Packit |
98cdb6 |
>Adjustments
|
|
Packit |
98cdb6 |
> above,
|
|
Packit |
98cdb6 |
all range widgets are associated with an adjustment object, from which
|
|
Packit |
98cdb6 |
they calculate the length of the slider and its position within the
|
|
Packit |
98cdb6 |
trough. When the user manipulates the slider, the range widget will
|
|
Packit |
98cdb6 |
change the value of the adjustment.
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="SECT1"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="SECT1"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
NAME="SEC-SCROLLBARWIDGETS"
|
|
Packit |
98cdb6 |
>Scrollbar Widgets
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>These are your standard, run-of-the-mill scrollbars. These should be
|
|
Packit |
98cdb6 |
used only for scrolling some other widget, such as a list, a text box,
|
|
Packit |
98cdb6 |
or a viewport (and it's generally easier to use the scrolled window
|
|
Packit |
98cdb6 |
widget in most cases). For other purposes, you should use scale
|
|
Packit |
98cdb6 |
widgets, as they are friendlier and more featureful.
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>There are separate types for horizontal and vertical scrollbars.
|
|
Packit |
98cdb6 |
There really isn't much to say about these. You create them with the
|
|
Packit |
98cdb6 |
following functions:
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
BORDER="0"
|
|
Packit |
98cdb6 |
BGCOLOR="#E0E0E0"
|
|
Packit |
98cdb6 |
WIDTH="100%"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="PROGRAMLISTING"
|
|
Packit |
98cdb6 |
>GtkWidget *gtk_hscrollbar_new( GtkAdjustment *adjustment );
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
GtkWidget *gtk_vscrollbar_new( GtkAdjustment *adjustment );
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>and that's about it (if you don't believe me, look in the header
|
|
Packit |
98cdb6 |
files!). The
|
|
Packit |
98cdb6 |
CLASS="LITERAL"
|
|
Packit |
98cdb6 |
>adjustment
|
|
Packit |
98cdb6 |
> argument can either be a pointer to an
|
|
Packit |
98cdb6 |
existing Adjustment, or NULL, in which case one will be created for
|
|
Packit |
98cdb6 |
you. Specifying NULL might actually be useful in this case, if you
|
|
Packit |
98cdb6 |
wish to pass the newly-created adjustment to the constructor function
|
|
Packit |
98cdb6 |
of some other widget which will configure it for you, such as a text
|
|
Packit |
98cdb6 |
widget.
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
CLASS="NAVFOOTER"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
ALIGN="LEFT"
|
|
Packit |
98cdb6 |
WIDTH="100%">
|
|
Packit |
98cdb6 |
SUMMARY="Footer navigation table"
|
|
Packit |
98cdb6 |
WIDTH="100%"
|
|
Packit |
98cdb6 |
BORDER="0"
|
|
Packit |
98cdb6 |
CELLPADDING="0"
|
|
Packit |
98cdb6 |
CELLSPACING="0"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="33%"
|
|
Packit |
98cdb6 |
ALIGN="left"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
HREF="x602.html"
|
|
Packit |
98cdb6 |
ACCESSKEY="P"
|
|
Packit |
98cdb6 |
><<< Previous
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="34%"
|
|
Packit |
98cdb6 |
ALIGN="center"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
HREF="book1.html"
|
|
Packit |
98cdb6 |
ACCESSKEY="H"
|
|
Packit |
98cdb6 |
>Home
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="33%"
|
|
Packit |
98cdb6 |
ALIGN="right"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
HREF="x645.html"
|
|
Packit |
98cdb6 |
ACCESSKEY="N"
|
|
Packit |
98cdb6 |
>Next >>>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="33%"
|
|
Packit |
98cdb6 |
ALIGN="left"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>Adjustment Internals
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="34%"
|
|
Packit |
98cdb6 |
ALIGN="center"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
WIDTH="33%"
|
|
Packit |
98cdb6 |
ALIGN="right"
|
|
Packit |
98cdb6 |
VALIGN="top"
|
|
Packit |
98cdb6 |
>Scale Widgets
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|
|
Packit |
98cdb6 |
>
|