DwtScrollBar(3Dwt)
Name
DwtScrollBar, DwtScrollBarCreate − Creates a scroll bar widget for the application to display and process scroll bar screen operations.
Syntax
Widget DwtScrollBar(parent_widget, name, x, y,
width, height, inc, page_inc,
shown, value, min_value, max_value,
orientation, callback, help_callback,
unit_inc_callback, unit_dec_callback,
page_inc_callback, page_dec_callback,
to_top_callback, to_bottom_callback)
drag_callback)
Widget parent_widget;
char *name;
Position x, y;
Dimension width, height;
int inc, page_inc;
int shown;
int value;
int min_value, max_value;
int orientation;
DwtCallbackPtr callback, help_callback;
DwtCallbackPtr unit_inc_callback, unit_dec_callback;
DwtCallbackPtr page_inc_callback, page_dec_callback;
DwtCallbackPtr to_top_callback, to_bottom_callback;
DwtCallbackPtr drag_callback;
Widget DwtScrollBarCreate (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.
nameSpecifies the name of the created widget.
xSpecifies 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.
ySpecifies, 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.
widthSpecifies the width of the widget window. This argument sets the DwtNwidth core widget attribute.
heightSpecifies the height of the widget window. This argument sets the DwtNheight core widget attribute.
incSpecifies the amount of button increment and decrement. If this argument is nonzero, the scroll bar widget automatically adjusts the slider when an increment or decrement action occurs. This argument sets the DwtNinc attribute associated with DwtScrollBarCreate.
page_incSpecifies the amount of page increment and decrement. If this argument is nonzero, the scroll bar widget automatically adjusts the slider when an increment or decrement action occurs. This argument sets the DwtNpageInc attribute associated with DwtScrollBarCreate.
shownSpecifies the size of the slider as a value between zero and the absolute value of DwtNmaxValue minus DwtNminValue. The size of the slider varies, depending on how much of the slider scroll area it represents. This argument sets the DwtNshown attribute associated with DwtScrollBarCreate.
valueSpecifies the scroll bar’s top thumb position between DwtNminValue and DwtNmaxValue. This sets the DwtNvalue attribute associated with DwtScrollBarCreate.
min_valueSpecifies the scroll bar’s minimum value. This argument sets the DwtNminValue attribute associated with DwtScrollBarCreate.
max_valueSpecifies the scroll bar’s maximum value. This argument sets the DwtNmaxValue attribute associated with DwtScrollBarCreate.
orientationSpecifies whether the scroll bar is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrientationVertical. This argument sets the DwtNorientation attribute associated with DwtScrollBarCreate.
callbackSpecifies the callback function or functions called back when the value of the scroll bar changes. This argument sets the DwtNvalueChangedCallback attribute associated with DwtScrollBarCreate.
help_callbackSpecifies the callback function or functions called when a help request is made. This argument sets the DwtNhelpCallback common widget attribute.
unit_inc_callback
Specifies the callback function or functions called when the user selected the down or right unit scroll function. For this callback, the reason is DwtCRUnitInc. This argument sets the DwtNunitIncCallback attribute associated with DwtScrollBarCreate.
unit_dec_callback
Specifies the callback function or functions called when the user selected the above or left unit scroll function. For this callback, the reason is DwtCRUnitDec. This argument sets the DwtNunitDecCallback attribute associated with DwtScrollBarCreate.
page_inc_callback
Specifies the callback function or functions called when the user selected the below or right page scroll function. For this callback, the reason is DwtCRPageInc. This argument sets the DwtNpageIncCallback attribute associated with DwtScrollBarCreate.
page_dec_callback
Specifies the callback function or functions called when the user selected the above or left page scroll function. For this callback, the reason is DwtCRPageDec. This argument sets the DwtNpageDecCallback attribute associated with DwtScrollBarCreate.
to_top_callback
Specifies the callback function or functions called when the user selected the current line to top scroll function. For this callback, the reason is DwtCRToTop. The scroll bar does not automatically change the scroll bar’s DwtNvalue for this callback. This argument sets the DwtNtoTopCallback attribute associated with DwtScrollBarCreate.
to_bottom_callback
Specifies the callback function or functions called when the user selected the current line to bottom scroll function. For this callback, the reason is DwtCRToBottom. The scroll bar does not automatically change the scroll bar’s DwtNvalue for this callback. This argument sets the DwtNtoBottomCallback attribute associated with DwtScrollBarCreate.
drag_callbackSpecifies the callback function or functions called when the user is dragging the scroll bar slider. For this callback, the reason is DwtCRDrag. This argument sets the DwtNdragCallback attribute associated with DwtScrollBarCreate.
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 DwtScrollBar and DwtScrollBarCreate functions create an instance of a scroll bar widget and return its associated widget ID. The scroll bar widget is a screen object that the application or user uses to scroll through display data too large for the screen. This widget consists of two stepping arrows at either end of an elongated rectangle called the scroll region. The scroll region is overlaid with a slider bar (thumb) that is adjusted in size and position (thumb shown) as scrolling occurs using the function attributes. The stepping arrows and the exposed scroll areas behind the slider are the scroll activator objects providing the user interface syntax “feel.”
If the default core widget attributes DwtNwidth or DwtNheight (0) are used, the scroll bar is set to the DwtNheight of the parent window (vertical) or to the DwtNwidth of the parent window (horizontal). If the default core widget attributes DwtNx or DwtNy (0) are used, the scroll bar is set to the right of the parent window (vertical) or to the bottom of the parent window (horizontal). This is also true if you specify DwtNwidth, DwtNheight, DwtNx, or DwtNy in the call to XtSetValues.
Note that the DwtNtoTopCallback and DwtNtoBottomCallback callbacks do not automatically set the thumb as the other callbacks do.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | For vertical scroll bars, 17 pixels. |
| For horizontal scroll bars, the width of the parent minus 17 pixels. |
||
| DwtNheight | Dimension | For horizontal scroll bars, 17 pixels. |
| For vertical scroll bars, the height of the parent minus 17 pixels. |
||
| DwtNborderWidth | Dimension | One pixel |
| 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 DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| 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 | NOT SUPPORTED | |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
Widget-Specific Attributes
| Attribute Name | Data Type | Default |
| DwtNvalue | int | Zero |
| DwtNminValue | int | Zero |
| DwtNmaxValue | int | 100 |
| DwtNorientation | unsigned char | DwtOrientationVertical |
| DwtNtranslations1 | XtTranslations | NULL |
| DwtNtranslations2 | XtTranslations | NULL |
| DwtNshown | int | 10 units |
| DwtNinc | int | 10 units |
| DwtNpageInc | int | 10 units |
| DwtNvalueChangedCallback | DwtCallbackPtr | NULL |
| DwtNunitIncCallback | DwtCallbackPtr | NULL |
| DwtNunitDecCallback | DwtCallbackPtr | NULL |
| DwtNpageIncCallback | DwtCallbackPtr | NULL |
| DwtNpageDecCallback | DwtCallbackPtr | NULL |
| DwtNtoTopCallback | DwtCallbackPtr | NULL |
| DwtNtoBottomCallback | DwtCallbackPtr | NULL |
| DwtNdragCallback | DwtCallbackPtr | NULL |
| DwtNshowArrows | Boolean | True |
DwtNvalueSpecifies the scroll bar’s top thumb position between DwtNminValue and DwtNmaxValue. This attribute also appears as a member in DwtScrollBarCallbackStruct.
DwtNminValueSpecifies the scroll bar’s minimum value.
DwtNmaxValueSpecifies the scroll bar’s maximum value.
DwtNorientation
Specifies whether the scroll bar is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrientationVertical.
DwtNtranslations1
Specifies the translation table for events after being parsed by the X intrinsics function XtParseTranslationTable for the decrement button.
DwtNtranslations2
Specifies the translation table for events after being parsed by the X intrinsics function XtParseTranslationTable for the increment button.
DwtNshownSpecifies the size of the slider as a value between zero and the absolute value of DwtNmaxValue minus DwtNminValue. The size of the slider varies, depending on how much of the slider scroll area it represents.
DwtNincSpecifies the amount of button increment and decrement. If this argument is nonzero, the scroll bar widget automatically adjusts the slider when an increment or decrement action occurs.
DwtNpageIncSpecifies the amount of page increment and decrement. If this argument is nonzero, the scroll bar widget automatically adjusts the slider when an increment or decrement action occurs.
DwtNvalueChangedCallback
Specifies the callback function or functions called when the value of the scroll bar slider was changed. For this callback, the reason is DwtCRValueChanged.
DwtNunitIncCallback
Specifies the callback function or functions called when the user selected the down or right unit scroll function. For this callback, the reason is DwtCRUnitInc.
DwtNunitDecCallback
Specifies the callback function or functions called when the user selected the above or left unit scroll function. For this callback, the reason is DwtCRUnitDec.
DwtNpageIncCallback
Specifies the callback function or functions called when the user selected the below or right page scroll function. For this callback, the reason is DwtCRPageInc.
DwtNpageDecCallback
Specifies the callback function or functions called when the user selected the above or left page scroll function. For this callback, the reason is DwtCRPageDec.
DwtNtoTopCallback
Specifies the callback function or functions called when the user selected the current line to top scroll function. For this callback, the reason is DwtCRToTop. The scroll bar does not automatically change the scroll bar’s DwtNvalue for this callback.
DwtNtoBottomCallback
Specifies the callback function or functions called when the user selected the current line to bottom scroll function. For this callback, the reason is DwtCRToBottom. The scroll bar does not automatically change the scroll bar’s DwtNvalue for this callback.
DwtNdragCallback
Specifies the callback function or functions called when the user is dragging the scroll bar slider. For this callback, the reason is DwtCRDrag. The scroll bar does not automatically change the scroll bar’s DwtNvalue for this callback.
DwtNshowArrowsSpecifies a boolean value that, when True, indicates there are arrows. If False, there are no arrows.
Return Value
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;
int pixel;
} DwtScrollBarCallbackStruct;
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 changed the value of the scroll bar slider. |
| DwtCRUnitInc | The user selected the down or right unit scroll function. |
| DwtCRUnitDec | The user selected the up or left unit scroll function. |
| DwtCRPageDec | The user selected the above or left page scroll function. |
| DwtCRPageInc | The user selected the below or right page scroll function. |
| DwtCRToTop | The user selected the current line to top scroll function. |
| DwtCRToBottom | The user selected the current line to bottom scroll function. |
| DwtCRDrag | The user is dragging the scroll bar 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 slider’s current value and maps to the DwtNvalue attribute. The pixel member is set to the pixel value from the top right of the scroll bar where the event occurred. This pixel value is used for the DwtNtoTopCallback and DwtNtoBottomCallback attributes.
See Also
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding