The AxisObject is used by the chart class to define a new coordinate system that matches the user coordinate system inside the plot area.

The Chart object and all the specialized sub-objects used to build a Chart are also based on a similar hierarchy that is described later in this Chapter.
Widget XtCreateWidget (String, WidgetClass, ArgList,
Cardinal);
Widget XtVaCreateWidget (String, WidgetClass,...);
Additionally, a creation convenience function is provided by each object class.
For example, you can create a line object using the Xt creation function as follows:
Object line_object;
XintLine line;
line_object = (Object) XtVaCreateWidget ("line",
(WidgetClass)xintLineObjectClass,
parent,
XmNline, &line,
NULL);
or, using the creation function provided by the Line class:
n = 0;
XtSetArg (arg[n], XmNline, &line); n++;
line_object = XintCreateLine (parent, "line", arg, n);
If you use the Xt creation function you must cast the return type to Object and the object class name to WidgetClass for ANSI style compilers.
Note: DO NOT manage objects; this will cause the object record to be corrupted.
Changing object attributes can be accomplished with the Xt functions:
void XtSetValues (Widget, ArgList, Cardinal);
void XtVaSetValues (Widget,...);
For example, the following code sample changes the line style of a line object:
XtVaSetValues ((Widget) line_object,
XmNlineStyle, XintLINE_ON_OFF_DASH,
NULL);
Finally, to destroy an object you can use functions:
void XtDestroyWidget(Widget);
void XintEditObjectDestroyObject(Object);
Both functions are equivalent, but the second one is faster.
Functions XtSetValues and XtVaSetValues, when applied to a pointer resource, return the pointer to the internal widget or object data. You should not modify this data directly. This is a common error that often occurs when trying to modify a resource. The following example, which applies a horizontal translation to a rectangle object, illustrates the problem.
Object rect_object;
XintRectangle *rectangle, new_rectangle;
...
XtVaGetValues((Widget) rect_object, XmNrectangle, &rectangle, NULL);
/* DON'T modify structure rectangle directly; copy data first...*/
new_rectangle = *rectangle;
/* apply translation */
new_rectangle.x1 += tx;
new_rectangle.x2 += tx;
XtVaSetValues((Widget) rect_object,
XmNrectangle, &new_rectangle,
NULL);
...
#include
#include
main (argc, argv)
int argc;
char *argv[];
{
XtAppContext app_context;
Widget top_level;
Widget edit;
Object text;
XintTextLocation text_location;
top_level = XtAppInitialize(&app_context, "hello_world",
(XrmOptionDescList)NULL, 0,
&argc, argv,
NULL, NULL, 0);
/* Create an EditObject widget */
edit = XtVaCreateManagedWidget("edit_object",
xintEditObjectWidgetClass, top_level,
XmNwidth, 400,
XmNheight, 400,
NULL);
/* Create the Text object */
text_location.x = 50;
text_location.y = 50;
text = (Object) XtVaCreateWidget("Hello World",
(WidgetClass)xintTextObjectClass,
edit,
XmNtextLocation, &text_location,
XmNtextAnchor, XintCENTER,
XmNtextString, "Hello World",
XmNfontSize, 18,
XmNroundEdge, True,
XmNfillStyle, XintFILL_SOLID,
XmNlineStyle, XintLINE_SOLID,
NULL);
/* Loop */
XtRealizeWidget(top_level);
XtAppMainLoop(app_context);
}
The output from this example is shown below:

Figure 3: Hello World Example