Specifications
Athena Widget Set libXaw 1.0.7
Chapter 2
Using Widgets
Widgets serveasthe primary tools for building a user interface or application environment. The
Athena widget set consists of primitive widgets that contain no children (for example, a command
button) and composite widgets which may contain one or more widget children (for example, a
Box widget).
The remaining chapters explain the widgets that are provided by the Athena widget set. These
user-interface components serveasaninterface for application programmers who do not want to
implement their own widgets. In addition, theyserveasastarting point for those widget pro-
grammers who, using the Intrinsics mechanisms, want to implement alternative application pro-
gramming interfaces.
This chapter is a brief introduction to widget programming. The examples provided use the
Athena widgets, though most of the concepts will apply to all widget sets. Although there are
several programming interfaces to the X Toolkit, only one is described here. Afull description of
the programming interface is provided in the document XToolkit Intrinsics — C Language Inter-
face.
2.1. Setting the Locale
If it is desirable that the application takeadvantage of internationalization (i18n), you must estab-
lish locale with XtSetLanguageProc before XtDisplayInitialize or XtAppInitialize is called.
Forfull details, please refer to the document XToolkit Intrinsics — C Language Interface,section
2.2. However, the following simplest-case call is sufficient in manyormost applications.
XtSetLanguageProc(NULL, NULL, NULL);
Most notably,this will affect the Standard C locale, determine which resource files will be loaded,
and what fonts will be required of FontSet specifications. In manycases, the addition of this line
is the only source change required to internationalize Xawprograms, and will not disturb the
function of programs in the default "C" locale.
2.2. Initializing the Toolkit
Youmust call a toolkit initialization function before invoking anyother toolkit routines (besides
locale setting, above). XtAppInitialize opens the X server connection, parses the command line,
and creates an initial widget that will serveasthe root of a tree of widgets created by this applica-
tion.
Widget XtAppInitialize(app_context_return, application_class, options, num_options,
argc_in_out, argv_in_out, fallback_resources, args, num_args)
XtAppContext *app_context_return;
String application_class;
XrmOptionDescRec options[];
Cardinal num_options;
int *argc_in_out;
String *argv_in_out[];
String *fallback_resources;
ArgList args;
Cardinal num_args;
6