Line Object Class


Overview

The Line object class draws a line between two points. Arrows can be drawn on each of the end points of the Line object. Most of the graphic attributes specifying the line color, size and style are set using resources defined in Line's superclass, the Graphic object class. The Line end points are specified by passing a pointer to a data structure of type XintLine.

Arrow Shape

The shape of the arrow is described using three resources, XmNbaseAngle to specify the base angle, XmNtipAngle to specify the tip angle and XmNarrowLength to specify the length of the arrow. The meaning of those resources is illustrated below.



Inherited Behavior and Resources

The Line object class inherits behavior and resources from the Xt Object and Graphic classes.
The following resources are defined by the Line object class.
NameTypeDefaultAccess
XmNarrowLengthint8CSG
XmNarrowStyleintXintFILLEDCSG
XmNbaseAngleint45CSG
XmNlineXintLine *{{0,0}, {1,1}}CSG
XmNlineEndintXintNO_ARROWCSG
XmNtipAngleint25CSG


XmNarrowLength

Specifies the length of the arrow in pixel units. This resource only applies if resource XmNlineEnd is not set to XintNO_ARROW.

XmNarrowStyle

Specifies the style of arrowhead to draw. This resource only applies if resource XmNlineEnd is not set to XintNO_ARROW. You can specify one of the following constants:


XmNbaseAngle

Specifies the arrow base angle in degrees. This resource only applies if resource XmNlineEnd is not set to XintNO_ARROW.

XmNline

Specifies the end points in user coordinates. This resource is specified as a pointer to a data structure of type XintLine which takes the following form:

    typedef struct {
	    float start_x;
	    float start_y;
	    float end_x;
	    float end_y;
    } XintLine;

where

MemberDescription
start_x, start_yCoordinates of the line starting point.
end_x, end_yCoordinates of the line ending point.


XmNlineEnd

Specifies whether arrows are drawn at the ends of the Line object or not. You can specify one of the following constants:

Resource ValueDescription
XintNO_ARROWNo arrow is drawn.
XintDOUBLE_ARROWAn arrow on each end of the line is drawn.
XintEND_ARROWAn arrow on the line ending point is drawn.
XintSTART_ARROWAn arrow on the line starting point is draw.


XmNtipAngle

Specifies the tip angle of the arrow in degrees. This resource only applies when the resource XmNlineEnd is not set to XintNO_ARROW.

Line Callbacks

The Line object class does not define any new callbacks. However, the callback structure returned with callback XmNverifyCallback (see class Graphic) is redefined. The following ordered table lists the members of the callback structure XintLineVerifyCallbackStruct.

Data TypeMemberDescription
intreasonIndicates why the callback was invoked.
XEvent *eventPoints to the XEvent that triggered the callback.
BooleandoitSet to False to cancel the operation on the Line object.
XintLine *old_lineCurrent end points for the line.
XintLine *new_lineProposed new end points for the line.


Line Functions

Function XintCreateLine creates a Line object.

     Object XintCreateLine (...)

WidgetparentParent of new Line object.
char *nameName of new Line object.
ArgListarglistList of resource/value items.
CardinalargcountNumber of items in arglist.


Macros

Macro XintIsLine returns True if the specified object is a Line object.

     Boolean XintIsLine (Object object)