ObjectEditor Widget Class


Overview

ObjectEditor is a widget class that can be used to build panels designed to create and edit Graphic objects interactively. This widget can be customized so that the application can select which objects can be created and which menus are available. The application has also control over the layout of the different submenus that make up the widget.

ObjectEditor is provided for convenience only. It is highly configurable and should be flexible enough to be used by most applications. However, if this is not the case, all of its behavior can be easily duplicated using the EditObject class convenience functions and Graphic object resources.


Object Editor Layout

The ObjectEditor widget is built upon several groups of components, including a group of push buttons used to perform actions on the objects, a group of pulldown menus used to edit the attributes of the selected objects, a group of push buttons to create objects interactively, a group of pulldown menus to edit the object colors and a group of push buttons to set a bitmap pattern on the selected objects.

Each group is created inside a Motif RowColumn widget. Resources are available to specify the content of each group and to position the elements of the group, rowwise or columnwise. Also, using resource XmNeditList, the application can control which groups of components are displayed.


ObjectEditor Widget Appearance

The ObjectEditor widget appears as a rectangular window containing a number of pushbuttons, option menus and bitmap selectors.

Inherited Behavior and Resources

The ObjectEditor widget inherits behavior and resources from the Core, Composite, Constraint and Motif Manager classes.
The following resources are defined by the ObjectEditor widget class:
NameTypeDefaultAccess
XmNactionListString *dynamicCSG
XmNactionNumColumnsshort5CSG
XmNactionOrientationunsigned charXintHORIZONTALCSG
XmNattributeListString *dynamicCSG
XmNattributeNumColumnsshort1CSG
XmNattributeOrientationunsigned charXintVERTICALCSG
XmNcolorAttributeListString *dynamicCSG
XmNcolorListString *dynamicCSG
XmNcolorNumColumnsshort1CSG
XmNcolorOrientationunsigned charXintVERTICALCSG
XmNeditListString *dynamicCSG
XmNeditObjectsWidget *NULLCSG
XmNnumColumnsshort2CSG
XmNnumEditObjectsint0CSG
XmNobjectClassListObjectClass *dynamicCSG
XmNorientationunsigned charXintVERTICALCSG
XmNpixmapListPixmap *NULLCSG
XmNpixmapNumColumnsshortdynamicCSG
XmNpixmapOrientationunsigned charXintVERTICALCSG
XmNshowAttributeLabelsBooleanTrueCSG


XmNactionList

Specifies a NULL terminated list of strings containing the name of the actions that can be performed on objects. For each action that you specify, a push button will be created inside the Action group. Specify any or all of the actions listed below:

XintGROUPCreates a Push Button that groups all the selected objects.
XintUNGROUPCreates a Push Button that ungroups all the selected groups.
XintRAISECreates a Push Button that raises one place the selected objects in the display list.
XintLOWERCreates a Push Button that lowers one place the selected objects in the display list.
XintFRONTCreates a Push Button that raises the selected objects to the front of the display list.
XintBACKCreates a Push Button that lowers the selected objects at the end of the display list.
XintCUTCreates a Push Button that removes the selected objects and places them in the cut and paste buffer.
XintCOPYCreates a Push Button that places the selected objects in the cut and paste buffer.
XintPASTECreates a Push Button that pastes any object in the cut and paste buffer.

The default for this resource is a NULL terminated list containing all the actions listed above.


XmNactionNumColumns, XmNactionOrientation

Specifies the orientation (XintVERTICAL or XintHORIZONTAL) and the number of columns (or rows if directions is set to XintHORIZONTAL) in the row column widget that is created to display the action push buttons (Action group).

XmNattributeList

Specifies a NULL terminated list of strings containing the name of the attributes that can be edited. A pulldown menu, placed inside the attribute group, will be created to edit each of the attributes specified in the list. Specify any or all of the attributes listed below:

XintFILL_STYLECreates a pulldown menu to edit the fill style of the selected objects.
XintLINE_STYLECreates a pulldown menu to edit the line style of the selected objects.
XintLINE_WIDTHCreates a pulldown menu to edit the line width of the selected objects.
XintDASH_TYPECreates a pulldown menu to edit the line dash style of the selected objects.
XintLINE_ENDSCreates a pulldown menu to edit the line end style (for arrows) of the selected line objects.

The default for this resource is a NULL terminated list containing all the attributes listed above.


XmNattributeNumColumns, XmNattributeOrientation

Specifies the orientation (XintVERTICAL or XintHORIZONTAL) and the number of columns (or rows if directions is set to XintHORIZONTAL) in the row column widget that is created to display the attribute pulldown menus (Attribute group).

XmNcolorAttributeList

Specifies a NULL terminated list of strings containing a list of color attributes that can be edited. A pulldown menu, placed inside the color group, will be created to edit each of the attributes specified in the list. Specify any or all of the attributes listed below:

XintFILL_COLORCreates a pulldown menu to edit the fill color of the selected objects.
XintPATTERN_COLORCreates a pulldown menu to edit the pattern color of the selected objects.
XintLINE_COLORCreates a pulldown menu to edit the line color of the selected objects.

The default for this resource is a NULL terminated list containing all the color attributes listed above.


XmNcolorList

Specifies a NULL terminated list of color names that will be used in the color editor pulldown menus.

XmNcolorNumColumns, XmNcolorOrientation

Specifies the orientation (XintVERTICAL or XintHORIZONTAL) and the number of columns (or rows if directions is set to XintHORIZONTAL) in the row column widget that is created to display the pulldown menu used to edit the color attributes listed in resource XmNcolorAttributeList (Color group).

XmNeditList

Specifies a NULL terminated list of strings containing the names of the group of editors that are created inside the ObjectEditor widget. Specify any or all of the names listed below:

XintACTION_EDITORCreates the Action group which contains a set of push buttons used to perform actions on the objects.
XintOBJECT_EDITORCreates the Object group which contains a set of push buttons that can be used to create objects interactively.
XintCOLOR_EDITORCreates the Color group which contains a set of pulldown menus that can be used to edit the object colors.
XintATTRIBUTE_EDITORCreates the Attribute group which contains a set of pulldown menus that can be used to edit the object attributes.
XintPIXMAP_EDITORCreates the Pixmap group which contains a set of push buttons that can be used to assign a fill pattern to the objects.

The default for this resource is a NULL terminated list containing all the items listed above.


XmNeditObjects

Specifies a list of EditObject widgets which can be edited using the ObjectEditor widget. The size of this list is specified using resource XmNnumEditObjects. See also convenience function XintObjectEditorAddEditObjectToList which can be used to add widgets to this list.

XmNnumColumns

Specifies the number of columns (or rows if resource XmNorientation is set to XintHORIZONTAL) in the RowColumn widget used to layout the different sets of editors that compose the ObjectEditor widget.

XmNnumEditObjects

Specifies the size of the widget list specified with resource XmNeditObjects.

XmNobjectClassList

Specifies a NULL terminated list of object class names for which objects can be created interactively. For each class specified, a push button displaying a graphic representation of the object will be created inside the Object group. You can specify a list containing any or all of the classes listed below:

xintChartObjectClassTo create a Chart object interactively.
xintFreeHandObjectClassTo create a Polyline for which points are sampled along the cursor path during creation.
xintLineObjectClassTo create a Line object interactively.
xintOvalObjectClassTo create an Oval object interactively.
xintPolygonObjectClassTo create a closed Polyline object interactively.
xintPolylineObjectClassTo create a Polyline object interactively.
xintRectangleObjectClassTo create a Rectangle object interactively.
xintRoundedRectObjectClassTo create a Rounded Rectangle object interactively.
xintScaledTextObjectClassTo create a scalable Text object interactively.
xintSymbolObjectClassTo create a Symbol object interactively.
xintTextObjectClassTo create a fixed Text object interactively.

See the Graphic object reference section for more information on each object class. The set of push buttons listed above will only be created if attribute XintOBJECT is listed in resource XmNeditList.


XmNorientation

Specifies the orientation (XintVERTICAL or XintHORIZONTAL) of the RowColumn widget used to lay out the different set of editors that compose the ObjectEditor widget. The number of columns or rows is specified using resource XmNnumColumns.

XmNpixmapList

Specifies a list of pixmaps of depth 1 used to create a set of push buttons that can be used to edit an object bitmap pattern. The list must be terminated with constant XmUNSPECIFIED_PIXMAP. The ObjectEditor has a list of predefined patterns of size 32x32 which can be accessed using function XintObjectEditorGetDefinedPixmap defined in the Defined Functions section below.

XmNpixmapNumColumns, XmNpixmapOrientation

Specifies the number of columns and the orientation of the RowColumn widget that contains the array of push buttons that are used for pattern selection (Pixmap group). This set of buttons will only be created if attribute XintPIXMAPS is listed in resource XmNeditList.

XmNshowAttributeLabels

Specifies whether a label describing the attribute is displayed in front of the option menus used to edit the object attributes (see resource XmNattributeList).

Defined Functions

The following functions are defined by the ObjectEditor widget class.

Function NameDescription
XintCreateObjectEditorCreates an ObjectEditor widget.
XintObjectEditorGetDefinedPixmapReturns a pixmap id from a specified name.
XintObjectEditorAddEditObjectToListAdds a widget to the list of EditObject widgets associated with an ObjectEditor widget.
XintObjectEditorRemoveEditObjectFromListRemoves a widget from the list of EditObject widgets managed by an ObjectEditor widget.


XintCreateObjectEditor

Function XintCreateObjectEditor creates an unmanaged ObjectEditor widget.

     Widget XintCreateObjectEditor (...)

WidgetparentParent of new ObjectEditor widget.
char *nameName of new ObjectEditor widget.
ArgListarglistList of resource/value items.
CardinalargcountNumber of items in arglist.


XintObjectEditorGetDefinedPixmap

Function XintObjectEditorGetDefinedPixmap returns the ID of a pixmap of depth 1 from the specified name.

     Pixmap XintObjectEditorGetDefinedPixmap (...)

WidgetwidgetID of any Motif or INT widget.
char *nameName of the pixmap. Use one of the name in the list below.

Below is the list of pixmap names recognized by function XintObjectEditorGetDefinedPixmap. Note that if you don't find the right pixmap in the list, you can always create your own using the proper X library functions.

"Solid""Clear""25_percent_1""25_percent_2"
"25_percent_3""25_percent_4""50_percent_1""50_percent_2"
"75_percent""Vertical""Vertical1""Vertical2"
"Vertical3""Horizontal""Horizontal1""Horizontal2"
"Horizontal3""Slant_Left""Slant_Left1""Slant_Left2"
"Star_Left1""Star_Left2""Star_Right1""Star_Right2"
"Slant_Right""Slant_Right1""Slant_Right2""Zigzag"
"Zigzag1""Zigzag2""Tread""Tread1"
"Tread2""Trellis""Trellis1""Trellis2"
"Weave1""Weave2""Weave3""Weave4"
"12_5_percent_1""12_5_percent_2""12_5_percent_3""12_5_percent_4"
"12_5_percent_5""12_5_percent_6""12_5_percent_7""12_5_percent_8"
"Sandstone""Siltstone""Shale""Limestone"
"Dolomite""Chert""Basement""Check1"
"Check2""Check3""Wicker1""Wicker2"
"Wicker3""Cross_Hatch""Diamond1""Diamond2"
"Diamond3""Lattice1""Lattice2""Lattice3"
"Lattice4""Lattice5""Lattice6" "Lattice7"
"Herring_Bone1""Herring_Bone2""Plaid1""Plaid2"
"Plaid3""Plaid4""Imbrication1""Imbrication2"
"Imbrication3""Imbrication4""Diaper""Parquet1"
"Parquet2""Horizontal_Bar1""Horizontal_Bar2""Horizontal_Bar3"
"Horizontal_Bar4""Horizontal_Bar5""Horizontal_Bar6""Horizontal_Bar7"
"Horizontal_Bar8""Horizontal_Bar9""Horizontal_Bar10""Vertical_Bar1"
"Vertical_Bar2""Vertical_Bar3""Vertical_Bar4""Vertical_Bar5"
"Vertical_Bar6""Vertical_Bar7""Vertical_Bar8""Vertical_Bar9"


XintObjectEditorAddEditObjectToList

Function XintObjectEditorAddEditObjectToList is a convenience function that adds an EditObject widget to resource list XmNeditObjects, which contains the list of widgets managed by the ObjectEditor widget. This function also increments the object count maintained in resource XmNnumEditObjects.

     void XintObjectEditorAddEditObjectToList (...)

WidgetwidgetID of the ObjectEditor widget.
Widgetedit_objectID of an EditObject widget where we want to create or edit objects interactively using the ObjectEditor widget.


XintObjectEditorRemoveEditObjectFromList

Function XintObjectEditorRemoveEditObjectFromList is a convenience function that removes an EditObject widget from the resource list XmNeditObjects, which contains the list of widgets managed by the ObjectEditor widget. This function also decrements the object count maintained in resource XmNnumEditObjects.

     void XintObjectEditorRemoveEditObjectFromList (...)

WidgetwidgetID of the ObjectEditor widget.
WidgeteoID of the EditObject widget to be removed from the list.