DwtScale(3Dwt) DwtScale(3Dwt)
Name
DwtScale, DwtScaleCreate - Creates a scale widget that allows an application to display a scale for vernier control of a parameter while
displaying the current value and range.
Syntax
Widget DwtScale(parent_widget, name, x, y,
width, height, scale_width, scale_height,
title, min_value, max_value, decimal_points,
value, orientation, callback,
drag_callback, help_callback)
Widget parent_widget;
char *name;
Position x, y;
Dimension width, height;
Dimension scale_width, scale_height;
DwtCompString title;
int min_value, max_value;
int decimal_points;
int value;
unsigned char orientation;
DwtCallbackPtr callback, drag_callback, help_callback;
Widget DwtScaleCreate (parent_widget, name,
override_arglist, override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
name Specifies the name of the created widget.
x Specifies the placement, in pixels, of the left side of the widget window relative to the inner upper left corner of the parent
window. This argument sets the DwtNx core widget attribute.
y Specifies, in pixels, the placement of the upper left corner of the widget window relative to the inner upper left corner of the
parent window. This argument sets the DwtNy core widget attribute.
width Specifies the width of the widget window. (The window width is calculated based on the scale width, the label widths, and orien-
tation.) This argument sets the DwtNwidth core widget attribute.
height Specifies the height of the widget window. (The window height is calculated based on the scale height, the labels, and orienta-
tion.) This argument sets the DwtNheight core widget attribute.
scale_width
Specifies the width of the scale, excluding the scale labels. This argument sets the DwtNscaleWidth attribute associated with
DwtScaleCreate.
scale_height
Specifies the height of the scale, excluding the scale labels. This argument sets the DwtNscaleHeight attribute associated with
DwtScaleCreate.
title Specifies the title text string to appear in the scale window widget. This argument sets the DwtNtitle attribute associated with
DwtScaleCreate.
min_value Specifies the value represented by the top or left end of the scale. This argument sets the DwtNminValue attribute associated
with DwtScaleCreate.
max_value Specifies the value represented by the bottom or right end of the scale. This argument sets the DwtNmaxValue attribute associ-
ated with DwtScaleCreate.
decimal_points
Specifies the number of decimal points to shift the current slider value for display of the next slider position. This argument
sets the DwtNdecimalPoints attribute associated with DwtScaleCreate.
value Specifies the current slider position along the scale (the value selected by the user). This argument sets the DwtNvalue
attribute associated with DwtScaleCreate.
orientation
Specifies whether the scale is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrientationVer-
tical. This argument sets the DwtNorientation attribute associated with DwtScaleCreate.
callback Specifies the callback function or functions called back when the value of the scale changes. This argument sets the DwtNval-
ueChangedCallback attribute associated with DwtScaleCreate.
drag_callback
Specifies the callback function or functions called when the user is dragging the scale slider. For this callback, the reason is
DwtCRDrag. This argument sets the DwtNdragCallback attribute associated with DwtScaleCreate.
help_callback
Specifies the callback function or functions called when a help request is made. This argument sets the DwtNhelpCallback common
widget attribute.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtScale and DwtScaleCreate functions create an instance of the scale widget and return its associated widget ID. The scale widget is
a primitive widget figure that allows the application to display a scale for vernier control of a specific parameter by the user. The user
moves or drags a slider, which is part of the scale widget, and places the slider at a position representing the desired value. The scale
may have labeled text at any number of points identifying the values corresponding to the points. The scale can be made insensitive and
used as an output value indicator only (for example, a thermometer or percent completion indicator).
The application passes lower and upper values for the scale as integers and can (optionally) indicate a decimal point position. For exam-
ple, a DwtNminValue of 100, a DwtNmaxValue of 10000, and a DwtNdecimalPoints of 2 would produce a scale from 1.00 to 100.00. Possible val-
ues returned from this example could be 230 or 5783.
Scale widget labels are provided by its children. The labels can be any widgets created using the scale widget as the parent.
Inherited Attributes
------------------------------------------------------------------
Attribute Name Data Type Default
------------------------------------------------------------------
Core Attributes
DwtNx Position Determined by the geome-
try manager
DwtNy Position Determined by the geome-
try manager
DwtNwidth Dimension Calculated based on
scale width, the label
widths, and the orienta-
tion
DwtNheight Dimension Calculated based on
scale height, the label
widths, and the orienta-
tion
DwtNborderWidth Dimension zero pixels
DwtNborder Pixel Default foreground color
DwtNborderPixmap Pixmap NULL
DwtNbackground Pixel Default background color
DwtNbackgroundPixmap Pixmap NULL
DwtNcolormap Colormap Default color map
DwtNsensitive Boolean True
DwtNancestorSensitive Boolean The bitwise AND of the
parent widget's DwtNsen-
sitive and DwtNances-
torSensitive attributes
DwtNaccelerators XtTranslations NULL
DwtNdepth int Depth of the parent win-
dow
DwtNtranslations XtTranslations NULL
DwtNmappedWhenManaged Boolean True
DwtNscreen Screen * The parent screen
DwtNdestroyCallback DwtCallbackPtr NULL
Common Attributes
DwtNforeground Pixel Default foreground color
DwtNhighlight Pixel Default foreground color
DwtNhighlightPixmap Pixmap NULL
DwtNuserData Opaque * NULL
DwtNdirectionRToL unsigned char DwtDirectionRightDown
DwtNfont DwtFontList The default XUI Toolkit
font
DwtNhelpCallback DwtCallbackPtr NULL
------------------------------------------------------------------
Widget-Specific Attributes
----------------------------------------------------------------------
Attribute Name Data Type Default
----------------------------------------------------------------------
DwtNvalue int zero
DwtNtitle DwtCompString Scale name
DwtNorientation unsigned char DwtOrientationHorizontal
DwtNscaleWidth Dimension 100 pixels
DwtNscaleHeight Dimension 20 pixels
DwtNminValue int Zero
DwtNmaxValue int 100
DwtNdecimalPoints short Zero
DwtNshowValue Boolean True
DwtNdragCallback DwtCallbackPtr NULL
DwtNvalueChangedCallback DwtCallbackPtr NULL
----------------------------------------------------------------------
DwtNvalue Specifies the current slider position along the scale (the value selected by the user).
DwtNtitleType Specifies the title type. You can pass DwtCString or DwtPixmap.
DwtNtitle Specifies the title text string to appear in the scale window widget.
DwtNorientation
Specifies whether the scale is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrienta-
tionVertical.
DwtNscaleWidth Specifies the thickness in pixels of the scale itself, not counting the labels.
DwtNscaleHeight
Specifies the height of the scale, excluding the scale labels.
DwtNminValue Specifies the value represented by the top or left end of the scale.
DwtNmaxValue Specifies the value represented by the bottom or right end of the scale.
DwtNdecimalPoints
Specifies the number of decimal points to shift the current slider value for display of the next slider position.
DwtNshowValue Specifies a boolean value that, when True, states that the current value of the slider label string will be displayed next
to the slider.
DwtNdragCallback
Specifies the callback function or functions called when the user is dragging the scale slider. For this callback, the rea-
son is DwtCRDrag.
DwtNvalueChangedCallback
Specifies the callback function or functions called when the scale value was changed. For this callback, the reason is
DwtCRValueChanged.
Return Values
These functions return the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
int value;
} DwtScaleCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can
be set to:
DwtCRValueChanged The user moved the slider
in the scale with drag or
click.
DwtCRDrag The user is dragging the
slider.
DwtCRHelpRequested The user selected Help.
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a
union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib
Library: C Language Binding.
The value member is set to the current value of the scale.
See Also
DwtScaleGetSlider(3Dwt), DwtScaleSetSlider(3Dwt)
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding
DwtScale(3Dwt)