EditObject Widget Class


Overview

The EditObject widget class provides support for displaying, editing, and storing/ retrieving graphic objects based on the Graphic object class. Any widget class that is a subclass of the EditObject widget class inherits the ability to display, edit, and store/ retrieve graphic objects.

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).


Coordinate System

The EditObject class defines a linear coordinate system that is between 0 and 100, both horizontally and vertically. You can use the functions provided in the CompBase widget class to do transformations between pixel values and the EditObject coordinate system.

Object Selection

Once an object is created, it can be selected using BSelect. Handles are displayed around the edges of a selected object (or group of objects) to indicate it has been selected. Multiple selection and grouping/ungrouping of objects is also supported.

Object Editing

Objects can be moved, sized and shaped interactively. Size and Shape operations are identical for all rectangular Graphic objects (such as Oval and Text). For objects instantiated using subclasses of the MultiPoint class (such as PolyLine and Wavelet), the Shape operation is equivalent to a Move point operation. The Move, Size and Shape operations are activated using BSelect Drag and terminated using BSelect Release. A special operation, called Adjust, combines the Shape and Move operations into one action. If the user performs BSelect Drag close to a handle, a Shape operation will be performed, otherwise a Move operation is performed. Finally, a specific set of actions is provided to interactively add or remove points for MultiPoint based objects.

Objects can also be edited from the program, just like any other Motif widget, using the XtSetValues or XtVaSetValues calls.


Object Display

Objects are displayed in the order they have been created. The object created first is drawn first, while the object created last is drawn last and thus will appear to be on top of the other objects. A set of convenience functions allows the application to move objects forward or backward in the display order.

Input/Output

The EditObject widget class provides a set of convenience functions to write a list of objects into a file and to retrieve them later on. The objects in an object description file can be read by any widget created from a subclass of the EditObject widget class.

Clipboard

A clipboard mechanism is implemented for Cut, Copy and Paste operations on Graphic objects. The clipboard mechanism provides cut/copy/paste operations among EditObject widgets inside the current application or between two different applications. For example, it is possible to Cut an object from an EditObject widget in one application and Paste it into an EditObject widget belonging to another application.

Locator

The EditObject provides a callback and a set of actions that allow the application to track the cursor location.

EditObject Widget Appearance

The EditObject widget appears as an empty rectangular window. In the illustration below, a Chart object and various Graphic objects have been created in an EditObject widget.


Figure 10: Example of an EditObject widget containing a Chart and various Graphic objects.