XmScale(3Xm) — UNIX Programmer’s Manual
NAME
XmScale — the Scale widget class.
SYNOPSIS
#include <Xm/Scale.h>
DESCRIPTION
Scale is used by an application to indicate a value from within a range of values, and it allows the user to input or modify a value from the same range.
A Scale has an elongated rectangular region similar to a ScrollBar. Inside this region, is a slider which indicates the current value along the Scale. The user can also modify the Scale’s value by moving the slider within the rectangular region of the Scale. A Scale can also include a label set located outside the Scale region. These can indicate the relative value at various positions along the scale.
A Scale can be either input/output or output only. An input/output Scale’s value can be set by the application and also modified by the user by using the slider. An output-only Scale is used strictly as an indicator of the current value of something and cannot be modified interactively by the user. The Core resource XmNsensitive specifies whether or not the user can interactively modify the Scale’s value.
Classes
Scale inherits behavior and resources from Core, Composite, Constraint, and XmManager classes.
The class pointer is xmScaleWidgetClass.
The class name is XmScale.
New Resources
The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lower case or upper case, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).
| XmScale Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNdecimalPoints | XmCDecimalPoints | short | 0 | CSG |
| XmNdragCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNfontList | XmCFontList | XmFontList | "Fixed" | CSG |
| XmNhighlightOnEnter | XmCHighlightOnEnter | Boolean | False | CSG |
| XmNhighlightThickness | XmCHighlightThickness | short | 0 | CSG |
| XmNmaximum | XmCMaximum | int | 100 | CSG |
| XmNminimum | XmCMinimum | int | 0 | CSG |
| XmNorientation | XmCOrientation | unsigned char | XmVERTICAL | CSG |
| XmNprocessingDirection | XmCProcessingDirection | unsigned char | XmMAX_ON_TOP | CSG |
| XmNscaleHeight | XmCScaleHeight | Dimension | 0 | CSG |
| XmNscaleWidth | XmCScaleWidth | Dimension | 0 | CSG |
| XmNshowValue | XmCShowValue | Boolean | False | CSG |
| XmNtitleString | XmCTitleString | XmString | NULL | CSG |
| XmNtraversalOn | XmCTraversalOn | Boolean | False | CSG |
| XmNvalue | XmCValue | int | 0 | CSG |
| XmNvalueChangedCallback | XmCCallback | XtCallbackList | NULL | C |
XmNdecimalPoints
Specifies the number of decimal points to shift the slider value when displaying it. For example, a slider value of 2,350 and an XmdecimalPoints value of 2 would result in a display value of 23.50.
XmNdragCallback
Specifies the list of callbacks that is called when the slider position changes as the slider is being dragged. The reason sent by the callback is XmCR_DRAG.
XmNfontList
Specifies the font list to use for the title text string specified by XmNtitleString.
XmNhighlightOnEnter
Specifies whether to draw the slider’s border highlight on enter window events. This resource is ignored if the XmNtraversalOn resource is set to True.
XmNhighlightThickness
Specifies the size of the slider’s border drawing rectangle used for enter window and traversal highlight drawing.
XmNmaximum
Specifies the slider’s maximum value.
XmNminimum
Specifies the slider’s minimum value.
XmNorientation
Displays Scale vertically or horizontally. This resource can have values of XmVERTICAL and XmHORIZONTAL.
XmNprocessingDirection
Specifies whether the value for XmNmaximum is on the right or left side of XmNminimum for horizontal Scales or above or below XmNminimum for vertical Scales. This resource can have values of XmMAX_ON_TOP, XmMAX_ON_BOTTOM, XmMAX_ON_LEFT, and XmMAX_ON_RIGHT.
XmNscaleHeight
Specifies the height of the slider area. The value should be in the specified unit type (default is pixels).
XmNscaleWidth
Specifies the width of the slider area. The value should be in the specified unit type (default is pixels).
XmNshowValue
Specifies if a label for the current slider value should be displayed next to the slider. If it is True, the current slider value is displayed.
XmNtitleString
Specifies the title text string to appear in the scale widget window.
XmNtraversalOn
Specifies whether the Scale’s slider is to have traversal on for it.
XmNvalue
Specifies the slider’s current position along the scale, between minimum and maximum.
XmNvalueChangedCallback
Specifies the list of callbacks that is called when the value of the slider has changed. The reason sent by the callback is XmCR_VALUE_CHANGED.
Inherited Resources
Scale inherits behavior and resources from the following superclasses. For a complete description of these resources, refer to the man page for that superclass.
| XmManager Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNbottomShadowColor | XmCForeground | Pixel | dynamic | CSG |
| XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNforeground | XmCForeground | Pixel | dynamic | CSG |
| XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNhighlightColor | XmCForeground | Pixel | Black | CSG |
| XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
| XmNshadowThickness | XmCShadowThickness | short | 0 | N/A |
| XmNtopShadowColor | XmCBackground | Pixel | dynamic | CSG |
| XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNunitType | XmCUnitType | unsigned char | XmPIXELS | CSG |
| XmNuserData | XmCUserData | caddr_t | NULL | CSG |
| Composite Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNinsertPosition | XmCInsertPosition | XmRFunction | NULL | CSG |
| Core Resource Set | ||||
| Name | Class | Type | Default | Access |
| XmNaccelerators | XmCAccelerators | XtTranslations | NULL | CSG |
| XmNancestorSensitive | XmCSensitive | Boolean | True | G |
| XmNbackground | XmCBackground | Pixel | dynamic | CSG |
| XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNborderColor | XmCBorderColor | Pixel | Black | CSG |
| XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
| XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG |
| XmNcolormap | XmCColormap | Colormap | XtCopyFromParent | CG |
| XmNdepth | XmCDepth | int | XtCopyFromParent | CG |
| XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
| XmNheight | XmCHeight | Dimension | 0 | CSG |
| XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG |
| XmNscreen | XmCScreen | Pointer | XtCopyScreen | CG |
| XmNsensitive | XmCSensitive | Boolean | True | CSG |
| XmNtranslations | XmCTranslations | XtTranslations | NULL | CSG |
| XmNwidth | XmCWidth | Dimension | 0 | CSG |
| XmNx | XmCPosition | Position | 0 | CSG |
| XmNy | XmCPosition | Position | 0 | CSG |
Callback Information
The following structure is returned with each callback.
typedef struct
{
intreason;
XEvent∗ event;
intvalue;
} XmScaleCallbackStruct;
reasonIndicates why the callback was invoked.
eventPoints to the XEvent that triggered the callback.
valueIs the new slider location value.
Behavior
<Btn1Down>:
Activates the interactive dragging of the slider if the button is pressed anywhere inside of the scale rectangle, including the slider.
Button1<PtrMoved>:
Moves the slider to the new position and calls the callbacks for XmNdragCallback if the button press occurs within the slider.
<Btn1Up>:
Calls the callbacks for XmNvalueChangedCallback if the button press occurs within the scale rectangle and if the slider position was changed.
Default Translations
The following are Scale’s default translations:
<Btn1Down>:Arm()
<Btn1Up>:Activate()
<EnterWindow>: Enter()
<FocusIn>:FocusIn()
Keyboard Traversal
For information on keyboard traversal, see the man page for XmManager(3Xm) and its sections on behavior and default translations.
RELATED INFORMATION
Composite(3Xm), Constraint(3Xm), Core(3Xm), XmCreateScale(3Xm), XmManager(3Xm), XmScaleGetValue(3Xm), and XmScaleSetValue(3Xm).
7th Edition