The display and editing capabilities of the EditObject class are implemented through a comprehensive set of actions, callbacks and convenience functions. Editing capabilities include the ability to select one or more objects and to move, size or shape objects. A set of convenience functions is provided for saving and restoring objects to or from an ASCII file. A clipboard mechanism provides cut and paste functionality inside an application or between two different applications that use EditObject widgets (or widgets from a subclass of the EditObject widget class).
Objects can also be edited from the program, just like any other Motif widget, using the XtSetValues or XtVaSetValues calls.
| Name | Type | Default | Access |
|---|---|---|---|
| XmNallowDrag | Boolean | False | CSG |
| XmNallowDrop | Boolean | False | CSG |
| XmNareaSelectionCallback | XtCallbackList | NULL | C |
| XmNcopyCallback | XtCallbackList | NULL | C |
| XmNcursorType | int | XC_crosshair | CSG |
| XmNcutCallback | XtCallbackList | NULL | C |
| XmNdragDropCallback | XtCallbackList | NULL | C |
| XmNflip | Boolean | False | CSG |
| XmNhandleColor | Pixel | "blue" | CSG |
| XmNhandleSize | int | 4 | CSG |
| XmNinsertObjectCallback | XtCallbackList | NULL | C |
| XmNlocatorCallback | XtCallbackList | NULL | C |
| XmNobjectDeselectionCallback | XtCallbackList | NULL | C |
| XmNobjectEditMode | int | XintEDIT_NONE | CSG |
| XmNobjectSelectionCallback | XtCallbackList | NULL | C |
| XmNpasteCallback | XtCallbackList | NULL | C |
| XmNpointSelectionTolerance | int | 4 | CSG |
| XmNresourceDialogCallback | XtCallbackList | NULL | C |
| XmNrubberbandCallback | XtCallbackList | NULL | C |
| XmNselectionCallback | XtCallbackList | NULL | C |
| Resource Value | Description |
|---|---|
| XintEDIT_NONE | ObjectEdit actions do nothing. |
| XintEDIT_MOVE | ObjectEdit actions implement a Move operation. |
| XintEDIT_SIZE | ObjectEdit actions implement a Size operation. |
| XintEDIT_SHAPE | ObjectEdit actions implement a Shape operation. |
| XintEDIT_ADJUST | ObjectEdit actions implement an Adjust operation. Adjust is a Shape operation if the object selection is close to a handle bar or a Move operation if the object selection is anywhere else inside the object. |
| XintEDIT_RUBBERBAND | ObjectEdit actions implement a Rubberband operation. Callback XmNrubberbandCallback is invoked continuously as the pointer moves. |
| Name | Description |
|---|---|
| ChangeCursorMask() | Changes the color of the cross hair cursor in increment. |
| DrawCursor() | Draws the cross hair cursor at the location of the mouse pointer. |
| EndDrawCursor() | Terminates the cross hair drawing operation. |
| InitDrawCursor() | Initiates the cross hair drawing operation. |
| TraverseCurrent() | Moves the focus to the current widget. |
| PreviousTabGroup() | Move the focus to the previous tab group. |
| NextTabGroup() | Moves the focus to the next tab group. |
| Increment(left) | Scrolls left one increment (if implemented by subclass). |
| Increment(right) | Scrolls right one increment (if implemented by subclass). |
| Increment(up) | Scrolls up one increment (if implemented by subclass). |
| Increment(down) | Scrolls down one increment (if implemented by subclass). |
| Locator() | Whenever the cursor is moved inside the widget window, this action calls the list of procedures specified by XmNlocatorCallback. |
| MotifDragStart()) | Initiates a Motif drag operation and calls callback XmNdragDropCallback. Action is disabled if resource XmNallowDrag is False. |
| Page(left) | Scrolls left one page (if implemented by subclass). |
| Page(right) | Scrolls right one page (if implemented by subclass). |
| Page(up) | Scrolls up one page (if implemented by subclass). |
| Page(down) | Scrolls down one page (if implemented by subclass). |
| SelectionCallback() | Whenever a Button is pressed inside the widget window, this action calls the list of procedures specified by resource XmNselectionCallback. |
| InitAreaSelection(callback) | Initiates the selection of a rectangular area in the widget window. Callback XmNareaSelectionCallback will be called by action EndAreaSelection when the selection is terminated. |
| InitAreaSelection(single) | Initiates the selection of a rectangular area within which all graphic objects included will be selected. Previously selected objects are deselected first. |
| InitAreaSelection(extend) | Initiates the selection of a rectangular area within which all graphic objects included will be selected. The new selection will extend the current selection. |
| ExtendAreaSelection() | Draws a rectangle bounding the area being selected. |
| EndAreaSelection() | Terminates the area selection operation. Calls XmNareaSelectionCallback or selects the Graphic objects contained in the selection depending on the argument of the action InitAreaSelection. |
| ObjectSelect(single) | Selects a Graphic object. Previously selected objects are deselected first. |
| ObjectSelect(extend) | Selects a Graphic object and adds it to the list of selected objects. |
| ObjectEditStart() | Initiates an editing operation on the selected Graphic object. The type of editing operation such as Move, Size, Shape, etc. is defined by resource XmNobjectEditMode. This action is also used internally by the widget for creating an object interactively. |
| ObjectEditStart(move) | Initiates a Move operation on the selected Graphic object. |
| ObjectEditStart(shape) | Initiates a Shape operation. Shape allows the user to move the points of MultiPoint based object. It is equivalent to a Size for all other objects. |
| ObjectEditStart(size) | Initiates a Size operation on the selected Graphic object. |
| ObjectEditStart(adjust) | Initiates an Adjust operation on the selected object. Adjust is a combination of Shape when the selection is close to a handle bar and Move otherwise. |
| ObjectEditStart (rubberband) | Initiates a rubberband operation where callback XmNrubberbandCallback is called continuously as the pointer moves. It is up to the application to actually draw a rubberband shape. |
| ObjectEdit() | Continues the editing operation initiated by action ObjectEditStart. |
| ObjectEditEnd() | Terminates the editing operation initiated by action ObjectEditStart and calls callback XmNverifyCallback (callback is defined in Graphic class). When XmNobjectEditMode is set to XintEDIT_INSERT and the object being edited is not a MultiPoint object, terminates the insertion operation and calls the XmNinsertObjectCallback. |
| ObjectEditEnd(m) | Terminates the editing operation initiated by action ObjectEditStart and calls callback XmNverifyCallback (callback is defined in Graphic class). When XmNobjectEditMode is set to XintEDIT_INSERT and the object being edited is a MultiPoint object, terminates the insertion operation initiated by action ObjectEditStart and calls callback XmNinsertObjectCallback. |
| ObjectPointAdd(b) | Adds a point to a MultiPoint object. The point is inserted at the beginning of the list. |
| ObjectPointAdd(e) | Adds a point to a MultiPoint object. The point is inserted at the end of the list. |
| ObjectPointAdd(x) | Adds a point to a MultiPoint object. The point is inserted according to its horizontal coordinate. |
| ObjectPointAdd(y) | Adds a point to a MultiPoint object. The point is inserted according to its vertical coordinate. |
| ObjectPointDelete() | Deletes a point from a MultiPoint object. |
| ObjectCancel() | Cancels an operation on an object. |
| ResourceDialog() | Pops up a resource editor for the selected object (if the class defines one) or let the application provide its own. This action will only activate itself on a double click. |
| Transform3DStart(scale) | Initiates the scaling of a 3D object. |
| Transform3DStart(shift) | Initiates the translation of a 3D object. |
| Transform3DStart(rotate) | Initiates the rotation of a 3D object. |
| Transform3D() | Continues the 3D operation initiated by Transform3D. |
| Transform3DEnd() | Terminates the 3D operation initiated by Transform3D. |
| Event Sequence | Actions Invoked |
|---|---|
| <EnterWindow> | ManagerEnter() InitDrawCursor() |
| <LeaveWindow> | ManagerFocus() EndDrawCursor() |
| <FocusIn> | ManagerFocusIn() |
| <FocusOut> | ManagerFocusOut() |
| Ctrl <Key> k | ChangeCursorMask() |
| !Shift <Key> Tab | PreviousTabGroup() |
| None <Key> Tab | NextTabGroup() |
| !Shift <Btn1Down> | TraverseCurrent() SelectionCallback() InitAreaSelection(callback) ObjectEditEnd() Locator() |
| !Ctrl <Btn1Down> | TraverseCurrent() SelectionCallback() InitAreaSelection(extend) ObjectSelect(extend) Locator() |
| None <Btn1Down> | TraverseCurrent() ObjectSelect(single) ObjectEditStart() Locator() SelectionCallback() InitAreaSelection(single) ResourceDialog() |
| <Btn2Down> | ObjectEditEnd(m) SelectionCallback() MotifDragStart() |
| <Btn1Up> | EndAreaSelection() ObjectEditEnd() |
| None <Btn3Down> | SelectionCallback() Transform3DStart(rotate) |
| Ctrl <Btn3Down> | Transform3DStart(scale) |
| Shift <Btn3Down> | Transform3DStart(shift) |
| <Btn3Motion> | Transform3D() |
| None <Btn3Down> | SelectionCallback() Transform3DStart(rotate) |
| <PtrMoved> | DrawCursor() ExtendAreaSelection() ObjectEdit() Locator() |
| Name | Structure | Reason |
|---|---|---|
| XmNareaSelectionCallback | XintEditObjectArea- SelectionCallbackStruct | XintCR_AREA_SELECTION |
| XmNselectionCallback | XintEditObject- CallbackStruct | XintCR_SELECTION |
| XmNcopyCallback | XintEditObjectEdit- CallbackStruct | XintCR_COPY |
| XmNcutCallback | XintEditObjectEdit- CallbackStruct | XintCR_CUT |
| XmNdragDropCallback | XintEditObjectDragDrop- CallbackStruct | XintCR_DRAG XintCR_DROP |
| XmNinsertObjectCallback | XintEditObjectInsert- CallbackStruct | XintCR_INSERT_OBJECT |
| XmNlocatorCallback | XintEditObjectLocator- CallbackStruct | XintCR_LOCATOR |
| XmNobjectDeselection- Callback | XintEditObjectSelection- CallbackStruct | XintCR_OBJECT_DESELECTION |
| XmNobjectSelectionCallback | XintEditObject- SelectionCallbackStruct | XintCR_OBJECT_SELECTION |
| XmNpasteCallback | XintEditObjectEdit- CallbackStruct | XintCR_PASTE |
| XmNresourceDialogCallback | XintEditObjectResource- DialogCallbackStruct | XintCR_MANAGE_RESOURCE- _DIALOG |
| XmNrubberbandCallback | XintEditObjectRubberband- CallbackStruct | XintCR_RUBBERBAND_START XintCR_RUBBERBAND XintCR_RUBBERBAND_END |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| int | x | X pixel coordinate of the upper left corner of the selected rectangle. |
| int | y | Y pixel coordinate of the upper left corner of the selected rectangle. |
| int | width | Width in pixels of the selected rectangle. |
| int | height | Height in pixels of the selected rectangle. |
Each subclass of the EditObject widget class defines its own callback structure for the callback list specified as the value of the XmNareaSelectionCallback resource. Only instances of the EditObject widget class use the area selection callback structure described above.
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| float | user_x | X user coordinate of the selected location. |
| float | user_y | Y user coordinate of the selected location. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| Object | object | Graphic object being dragged or dropped to. This field is NULL if drag or drop is not from or to a graphic object. |
| int | operation | This field is 0 on a drag. On a drop, it can be set to XintDROP_COPY, XintDROP_MOVE or XintDROP_LINK. You can modify this field on a drop to change the operation. |
| Atom * | atoms | Array of source or destination atoms supported. |
| int | atom_count | Size of array atoms. |
| int | x,y | Location of the pointer when drag/drop started. |
| Boolean | doit | Set to False to cancel the drag or drop operation. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| Object | list | List of objects to be edited. |
| int | count | Number of objects to be edited. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| Object | object | The ID of the object selected or deselected. If multiple objects have been selected/deselected, it contains the ID of the first object in the list. See select_list to access all the selected/deselected objects. |
| Object * | select_list | Points to the list of objects selected/deselected in this operation. |
| int | select_count | The number of selected/deselected objects. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| Object | object | The ID of the new object. |
| Boolean | doit | Set to False if you don't want the object to be created. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the callback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. Contains the window coordinates of the cursor. |
| float | user_x | The X location of the cursor hot spot in the user coordinate system. |
| float | user_y | The Y location of the cursor hot spot in the user coordinate system. |
Some subclasses of the EditObject widget class define their own callback structures for the callback list specified as the value of the XmNlocatorCallback resource. Instances of the EditObject widget class use the locator callback structure described above.
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the calback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. Contains the window coordinates of the cursor. |
| Object | object | ID of the selected object. |
| Boolean | doit | Set to False to prevent the built-in resource editor from being activated. |
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why the calback was invoked. |
| XEvent * | event | Points to the XEvent that triggered the callback. |
| int | start_x | The X location of the cursor when the rubberband operation started. |
| int | start_y | The Y location of the cursor when the rubberband operation started. |
| int | x_offset | The offset between the current location of the pointer and the original X location. |
| int | y_offset | The offset between the current location of the pointer and the original Y location. |
| Function Name | Description |
|---|---|
| XintCreateEditObject | Creates an EditObject widget. |
| XintDrawCursorFromData | Causes a cross hair cursor to be drawn at a specified location in the EditObject's window. |
| XintEditObjectBack | Moves the current object behind all other objects in the widget. |
| XintEditObjectCopy | Copies the selected objects into the clipboard. |
| XintEditObjectCurrent | Returns the last object selected. |
| XintEditObjectCut | Copies all selected objects into the clipboard and destroys them. |
| XintEditObjectDeselectAll | Deselects all currently selected objects. |
| XintEditObjectDeselectObject | Removes the specified object from the selected list. |
| XintEditObjectDestroyObject | Fast destroy function for objects. |
| XintEditObjectFreeze | Controls the update of an EditObject display. |
| XintEditObjectFront | Moves the current object in front of all other objects in the widget. |
| XintEditObjectGetIntersectList | Returns a list containing all of the objects that are children of the EditObject widget and intersect a specified rectangle. |
| XintEditObjectGetList | Returns a list containing all of the objects that are children of the specified EditObject widget. |
| XintEditObjectGroup | Groups the selected objects. |
| XintEditObjectInsert | Creates and inserts an object interactively. |
| XintEditObjectLower | Moves the current object one place down in the stacking order. |
| XintEditObjectManageResourceDialog | Manages the resource editor panel of the specific object, if one is available. |
| XintEditObjectMove | Allows interactive movement of the selected object. |
| XintEditObjectNew | Destroys all objects belonging the EditObject widget. |
| XintEditObjectOpen | Manages a dialog that allows the loading of an ASCII object description file. |
| XintEditObjectPaste | Pastes the objects in the clipboard into the EditObject widget. |
| XintEditObjectRaise | Moves the current object one place up in the stacking order. |
| XintEditObjectSave | Saves all the objects of and EditObject widget into an ASCII file. |
| XintEditObjectSaveAs | Manages a dialog box that prompts for the name of a file to store an ASCII description of the objects of an EditObject widget. |
| XintEditObjectSelectAll | Selects all the Graphic objects of an EditObject widget. |
| XintEditObjectSelectList | Returns the list of the selected objects. |
| XintEditObjectSelectObject | Adds an object to the list of selected objects. |
| XintEditObjectSetEditMode | Sets the value of resource XmNobjectEditMode. |
| XintEditObjectSize | Allows the interactive sizing of the currently selected object. |
| XintEditObjectUngroup | Ungroups the currently selected group object. |
| XintEditObjectWriteFile | Saves all the objects of an EditObject widget into an ASCII file. |
Widget XintCreateEditObject (...)
| Widget | parent | Parent of new EditObject widget. |
| char * | name | Name of new EditObject widget. |
| ArgList | arglist | List of resource/value items. |
| Cardinal | argcount | Number of items in arglist. |
void XintDrawCursorFromData (...)
| Widget | widget | EditObject widget ID. |
| float | user_x | The horizontal location of where the cursor is to be drawn. |
| float | user_y | The vertical location of where the cursor is to be drawn. |
void XintEditObjectBack (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to move to the back. |
void XintEditObjectCopy (Widget widget)
where widget is the ID of an EditObject widget.
Object XintEditObjectCurrent (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectCut (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectDeselectAll (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectDeselectObject (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to remove from the selected list. |
void XintEditObjectDestroyObject (Object object)
where object is the ID of the object to destroy.
void XintEditObjectFreeze (...)
| Widget | widget | EditObject widget ID. |
| Boolean | state | True to freeze, False to update the display. |
void XintEditObjectFront (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to move to the front. |
Object* XintEditObjectGetIntersectList (...)
| Widget | edit_object | EditObject widget ID. |
| int | x | X value of upper left corner of the intersection rectangle, in pixels. |
| int | y | Y value of upper left corner of the intersection rectangle, in pixels. |
| int | width | Width of the intersection rectangle, in pixels. |
| int | height | Height of the intersection rectangle, in pixels. |
| int * | count | Returned count of objects in the list. |
If the specified EditObject widget has no Graphic objects as children or if the intersection of the specified rectangle and the EditObject widget is empty, then NULL is returned. The list returned must be freed by the application when it has finished with it.
Object* XintEditObjectGetList (...)
| Widget | widget | EditObject widget ID. |
| int * | count | Returned count of objects in the list. |
If the specified EditObject widget has no Graphic objects as children, then NULL is returned. The list returned must be freed by the application when it has finished with it.
Object XintEditObjectGroup (Widget widget)
where widget is the ID of an EditObject widget. The function returns the ID of the new Group object.
void XintEditObjectInsert (...)
| Widget | widget | Specifies the ID of the EditObject widget. |
| ObjectClass | class | Specifies the class of the Graphic object to be created. |
| ArgList | arglist | List of resources to be applied to Graphic object created. |
| Cardinal | argcount | Number of items in arglist. |
Do not specify resources in arglist that have to do with the location and size of the object to be created since those will be set by the end user. Note: The creation of a Graphic object does not take place until the user has specified the object interactively. Resources which are specified using an address must remain allocated until the object is created. For example, all float values which are specified should be declared static. For the same reason, the ID of the new object is not returned by function XintEditObjectInsert. Callback XmNinsertObjectCallback will return the ID of the object when it is created.
void XintEditObjectLower (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to lower. |
void XintEditObjectManageResourceDialog (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object for which to manage the dialog panel. |
void XintEditObjectMove (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectNew (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectOpen (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectPaste (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectRaise (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to raise. |
Boolean XintEditObjectReadFile (...)
| Widget | widget | EditObject widget ID. |
| char * | filename | Name of the file containing the object description. |
The function returns False if it cannot open filename or if filename does not contain a valid object description.
void XintEditObjectSave (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectSaveAs (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectSelectAll (Widget widget)
where widget is the ID of an EditObject widget.
Object * XintEditObjectSelectList (...)
| Widget | widget | EditObject widget ID. |
| int * | count | Number of objects returned in the list. |
The application should free the returned list using function XtFree, after it is no longer needed, if the number of selected objects was not zero.
void XintEditObjectSelectObject (...)
| Widget | widget | EditObject widget ID. |
| Object | object | ID of the object to select. |
void XintEditObjectSetEditMode (...)
| Widget | widget | EditObject widget ID. |
| int | edit_mode | New value of resource XmNobjectEditMode. |
void XintEditObjectSize (Widget widget)
where widget is the ID of an EditObject widget.
void XintEditObjectUngroup (Widget widget)
where widget is the ID of an EditObject widget.
Boolean XintEditObjectWriteFile (...)
| Widget | widget | The ID of the EditObject widget. |
| char * | filename | The name of the file where the Graphic object description is saved. |
| char * | mode | The fopen style mode indicating how to open the file. |
The function returns False if it failed to open the specified file.
| Macro Name | Description |
|---|---|
| XintEditObjectReadFile | Reads an ASCII file containing a description of objects and places them into the EditObject widget. |
Boolean XintEditObjectReadFile (...)
| Widget | widget | EditObject widget ID. |
| char * | filename | Name of the file containing the object description. |
The function returns False if it cannot open filename or if filename does not contain a valid object description.