12.07.2015 Views

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Simple <strong>Widget</strong>svoid JumpProc( scrollbar, client_data, percent_ptr);scrollbarclient_dataSpecifies the ID of the scroll bar widget.Specifies the client data.percent_ptr Specifies the floating point position of the thumb (0.0\- 1.0).The jumpProc callback is used to implement smooth scrolling and is called by theNotifyThumb action. Percent_ptr must be cast to a pointer to float before use; i.e.float percent = *(float*)percent_ptr;With the default button bindings, button 2 moves the thumb interactively, and thejumpProc is called on each new position of the pointer, while the pointer buttonremains down. The value specified by percent_ptr is the current location of thethumb (from the top or left of the Scrollbar) expressed as a percentage of the lengthof the Scrollbar.Convenience RoutinesTo set the position and length of a Scrollbar thumb, usevoid XawScrollbar<strong>Set</strong>Thumb( w, top, shown);wtopshownSpecifies the Scrollbar widget.Specifies the position of the top of the thumb as a fraction ofthe length of the Scrollbar.Specifies the length of the thumb as a fraction of the totallength of the Scrollbar.XawScrollbarThumb moves the visible thumb to a new position (0.0 \- 1.0) and length(0.0 \- 1.0). Either the top or shown arguments can be specified as \-1.0, in whichcase the current value is left unchanged. Values greater than 1.0 are truncated to1.0.If called from jumpProc, XawScrollbar<strong>Set</strong>Thumb has no effect.<strong>Set</strong>ting Float ResourcesThe shown and topOfThumb resources are of type float. These resources can be difficultto get into an argument list. The reason is that C performs an automatic castof the float value to an integer value, usually truncating the important information.The following code fragment is one portable method of getting a float into an argumentlist.top = 0.5;if (sizeof(float) > sizeof(XtArgVal)) {/*\ * If a float is larger than an XtArgVal then pass this47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!