SgSpringBox(3X)
SgSpringBox --The SgSpringBox widget class
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME SgSpringBox --The SgSpringBox widget class SYNOPSIS #include <Sgm/SgSpringBox.h> VERSION This page documents the version of Sgm that accompanies Motif 1.2. DESCRIPTION SgSpringBox is a container widget with no input semantics of its own. It arranges its children in a single row or column based on a set of spring constraints assigned to each child. The SgSpringBox widget allows layouts similar to those supported by the XmForm widget, but are usually easier to set up. It is also possible to create some layouts that cannot be achieved with the XmForm widget. For example, centering a column of widgets is very easy to do with the SgSpringBox widget, but nearly impossible using the Xm- Form. Each child of an SgSpringBox widget has 6 constraints associated with it. First, each child has a "springyness" in both the vertical and horizontal direction that determines how much the child may be resized in each direc- tion. The resources XmNverticalSpring and XmNhorizontalSpring control the degree of "springyness" in each child. A value of zero means the child cannot be resized in that direction. For non-zero values, the values are compared to the values of other springs in the overall system to determine the propor- tional effects of any resizing. The default value of both resources is zero. Each child also has a spring between its left, right, top, and bottom sides and whatever boundary it is adjacent to. By default, the value of each of these springs is 50. A value of zero means that the SgSpringBox widget can- not add additional space adjacent to that part of a widget. Larger values are considered in relation to all other spring values in the system. The behavior of the widget is best seen by example. The following code places two widget in a single column. With the default resource settings, this results in both chidlren being centered in the parent, one above the other. void createCenteredWidgets(Widget parent) { Arg args[2]; Widget springbox, child1, child2; XtSetArg(args[0], XmNorientation, XmVERTICAL); springbox = SgCreateSpringBox( parent, "column", args, 1 ); child1 = XmCreatePushButton ( box, "child1", NULL, 0 ); child2 = XmCreatePushButton ( box, "child2", NULL, 0 ); XtManageChild(child1); XtManageChild(child2); XtManageChild(springbox); } This example creates two widgets in a horizontal row. As the row is re- sized, the widget gravitates to the left and right sides of the row. The leftmost child also hangs from the top of its parent, while the rightmost widget gravitates to the bottom of its parent. void createCenteredWidgets(Widget parent) { Arg args[5]; int n; Widget springbox, child1, child2; n = 0; XtSetArg(args[n], XmNorientation, XmCOLUMN);n++ springbox = SgCreateSpringBox( parent, "column", args, 1 ); n = 0; XtSetArg(args[n], XmNrightSpring, 0);n++ XtSetArg(args[n], XmNleftSpring, 100);n++ XtSetArg(args[n], XmNbottomSpring, 0);n++ XtSetArg(args[n], XmNtopSpring, 100);n++ child1 = XmCreatePushButton ( box, "child1", args, n); n = 0; XtSetArg(args[n], XmNrightSpring, 100);n++ XtSetArg(args[n], XmNleftSpring, 0);n++ XtSetArg(args[n], XmNbottomSpring, 100);n++ XtSetArg(args[n], XmNtopSpring, 0);n++ child2 = XmCreatePushButton ( box, "child2", args, n); XtManageChild(child1); XtManageChild(child2); XtManageChild(springbox); } Following are some important considerations in using a SgSpringBox: Unmapping a child has no effect on the SgSpringBox except that the child is not mapped. Classes SgSpringBox inherits behavior and resources from Core, Composite, Con- straint, XmManager, and XmBulletinBoard classes. The class pointer is sgSpringBoxWidgetClass. The class name is SgSpringBox. New Resources The following table defines a set of widget resources used by the program- mer 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 re- maining letters (in either lowercase or uppercase, but include any under- scores 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). +----------------------------------------------------------------+ | SgSpringBox Resource Set | +----------------+----------------+------+--------------+--------+ | Name | Class | Type | Default | Access | +----------------+----------------+------+--------------+--------+ +----------------+----------------+------+--------------+--------+ | XmNorientation | XmCOrientation | int | XmHORIZONTAL | CG | +----------------+----------------+------+--------------+--------+ +-----------------------------------------------------------+ | SgSpringBox Constraint Resource Set | +---------------------+-----------+------+---------+--------+ | Name | Class | Type | Default | Access | +---------------------+-----------+------+---------+--------+ +---------------------+-----------+------+---------+--------+ | XmNleftSpring | XmCSpring | int | 50 | CSG | +---------------------+-----------+------+---------+--------+ | XmNrightSpring | XmCSpring | int | 50 | CSG | +---------------------+-----------+------+---------+--------+ | XmNtopSpring | XmCSpring | int | 50 | CSG | +---------------------+-----------+------+---------+--------+ | XmNbottomSpring | XmCSpring | int | 50 | CSG | +---------------------+-----------+------+---------+--------+ | XmNverticalSpring | XmCSpring | int | 0 | CSG | +---------------------+-----------+------+---------+--------+ | XmNhorizontalSpring | XmCSpring | int | 0 | CSG | +---------------------+-----------+------+---------+--------+ XmNleftSpring Determines the stretchability of the space adjacent to the left side of the widget. The larger the value, the more this space can be re- sized relative to other "springs" contained in the SgSpringBox wid- get. XmNrightSpring Determines the stretchability of the space adjacent to the right side of the widget. The larger the value, the more this space can be resized rela- tive to other "springs" contained in the SgSpringBox widget. XmNtopSpring Determines the stretchability of the space adjacent to the top side of the widget. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XmNbottomSpring Determines the stretchability of the space adjacent to the bottom side of the widget. The larger the value, the more this space can be resized rela- tive to other "springs" contained in the SgSpringBox widget. XmNverticalSpring Determines the stretchability of the widget in the vertical direction. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. XmNhorizontalSpring Determines the stretchability of the widget in the horizontal direction. The larger the value, the more this space can be resized relative to other "springs" contained in the SgSpringBox widget. Inherited Resources SgSpringBox inherits behavior and resources from the following super- classes. For a complete description of each resource, refer to the man page for that superclass. +-----------------------------------------------------------------------------------+ | XmBulletinBoard Resource Set | +---------------------+--------------------+----------------+--------------+--------+ | Name | Class | Type | Default | Access | +---------------------+--------------------+----------------+--------------+--------+ +---------------------+--------------------+----------------+--------------+--------+ | XmNallowOverlap | XmCAllowOverlap | Boolean | True | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNautoUnmanage | XmCAutoUnmanage | Boolean | True | CG | +---------------------+--------------------+----------------+--------------+--------+ | XmNbuttonFontList | XmCButtonFontList | XmFontList | dynamic | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNcancelButton | XmCWidget | Widget | NULL | SG | +---------------------+--------------------+----------------+--------------+--------+ | XmNdefaultButton | XmCWidget | Widget | NULL | SG | +---------------------+--------------------+----------------+--------------+--------+ | XmNdefaultPosition | XmCDefaultPosition | Boolean | True | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNdialogStyle | XmCDialogStyle | unsigned char | dynamic | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNdialogTitle | XmCDialogTitle | XmString | NULL | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNfocusCallback | XmCCallback | XtCallbackList | NULL | C | +---------------------+--------------------+----------------+--------------+--------+ | XmNlabelFontList | XmCLabelFontList | XmFontList | dynamic | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNmapCallback | XmCCallback | XtCallbackList | NULL | C | +---------------------+--------------------+----------------+--------------+--------+ | XmNmarginHeight | XmCMarginHeight | Dimension | 0 | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNmarginWidth | XmCMarginWidth | Dimension | 0 | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNnoResize | XmCNoResize | Boolean | False | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNresizePolicy | XmCResizePolicy | unsigned char | XmRESIZE_ANY | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNshadowType | XmCShadowType | unsigned char | XmSHADOW_OUT | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNtextFontList | XmCTextFontList | XmFontList | dynamic | CSG | +---------------------+--------------------+----------------+--------------+--------+ | XmNtextTranslations | XmCTranslations | XtTranslations | NULL | C | +---------------------+--------------------+----------------+--------------+--------+ | XmNunmapCallback | XmCCallback | XtCallbackList | NULL | C | +---------------------+--------------------+----------------+--------------+--------+ | | | | | | +---------------------+--------------------+----------------+--------------+--------+ +---------------------------------------------------------------------------------------------------------+ | XmManager Resource Set | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | Name | Class | Type | Default | Access | +-----------------------+-----------------------------+-------------------+----------------------+--------+ +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNforeground | XmCForeground | Pixel | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNinitialFocus | XmCInitialFocus | Widget | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNshadowThickness | XmCShadowThickness | Dimension | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNtopShadowColor | XmCBackgroundTopShadowColor | Pixel | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNunitType | XmCUnitType | unsigned char | dynamic | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | XmNuserData | XmCUserData | Pointer | NULL | CSG | +-----------------------+-----------------------------+-------------------+----------------------+--------+ | | | | | | +-----------------------+-----------------------------+-------------------+----------------------+--------+ +------------------------------------------------------------------------+ | Composite Resource Set | +-------------------+-------------------+-------------+---------+--------+ | Name | Class | Type | Default | Access | +-------------------+-------------------+-------------+---------+--------+ +-------------------+-------------------+-------------+---------+--------+ | XmNchildren | XmCReadOnly | WidgetList | NULL | G | +-------------------+-------------------+-------------+---------+--------+ | XmNinsertPosition | XmCInsertPosition | XtOrderProc | NULL | CSG | +-------------------+-------------------+-------------+---------+--------+ | XmNnumChildren | XmCReadOnly | Cardinal | 0 | G | +-------------------+-------------------+-------------+---------+--------+ | | | | | | +-------------------+-------------------+-------------+---------+--------+ +----------------------------------------------------------------------------------------------------------------+ | Core Resource Set | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | Name | Class | Type | Default | Access | +-------------------------------+-------------------------------+----------------+----------------------+--------+ +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNaccelerators | XmCAccelerators | XtAccelerators | dynamic | N/A | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNancestorSensitive | XmCSensitive | Boolean | dynamic | G | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNbackground | XmCBackground | Pixel | dynamic | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNborderColor | XmCBorderColor | Pixel | XtDefaultForeground | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNcolormap | XmCColormap | Colormap | dynamic | CG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNdepth | XmCDepth | int | dynamic | CG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNheight | XmCHeight | Dimension | dynamic | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean | True | C | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNscreen | XmCScreen | Screen * | dynamic | CG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNsensitive | XmCSensitive | Boolean | True | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNtranslations | XmCTranslations | XtTranslations | dynamic | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNwidth | XmCWidth | Dimension | dynamic | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNx | XmCPosition | Position | 0 | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | XmNy | XmCPosition | Position | 0 | CSG | +-------------------------------+-------------------------------+----------------+----------------------+--------+ | | | | | | +-------------------------------+-------------------------------+----------------+----------------------+--------+ Translations qSgSpringBox inherits translations from XmBulletinBoard. RELATED INFORMATION Composite(3X), Constraint(3X), Core(3X), XmBulletinBoard(3X), SgCreateGrid, SgCreateGridDialog(3X), and XmManager(3X). SgSpringBox(3X)