Widget drawing_a;
drawing_a = XtVaCreateManagedWidget ("name",
xmDrawingAreaWidgetClass, parent,
resource−value−list,
NULL);
The parent of a DrawingArea must be either some type of Shell or a manager widget. It is quite common to find a
DrawingArea widget as a child of a ScrolledWindow or a MainWindow, since drawing surfaces tend to be quite large,
or at least dynamic in their growth potential.
If the DrawingArea widget is to have children, you might want to follow the guidelines set forth in Chapter 8,
Manager Widgets, about creating the widget in an unmanaged state. The widget can be managed with a call to
XtManageChild() after its children have been created. We do not demonstrate this technique, since we are not
going to use the widget as a traditional manager and there is not going to be a great deal of parent−child interaction
involving geometry management.
11.2 Using DrawingArea Callback Functions
The DrawingArea widget provides virtually no visual resources and very few functional ones. The most important
resources are those that allow you to provide callback functions for handling expose, resize, and input events. The
DrawingArea is typically input−intensive and, unlike most of the other Motif widgets, requires the application to
provide all of the necessary redrawing.
The callback routine for the XmNexposeCallback is invoked whenever an Expose event is generated for the
widget. In this callback function, an application must repaint all or part of the contents of the DrawingArea widget. ...