<<

Widget Sets Athena Widget Set

• Collection of user interface components • Original, free, extensible • Together with WM, define look&feel of system • Ugly, simple • Several different ones available for X • Simple -- Base class for all other • Athena (original, simple widget set, ca. 20 widgets, 2-, no strong Athena widgets. Does nothing, but associated style guide) — Xaw... prefix adds new resources such as cursor and • (Open Software Foundation, commercial, 2.5-D widget set, border pixmap. >40 widgets, industry standard for X, comes with style guide and • Label -- Draws text and/or a bitmap. UIL)—Xm... prefix • Command -- Momentary push-button • Programming model already given in Intrinsics • Toggle -- Push-button with two states. • Motif just offers convenience functions

Jan Borchers 1 media computing group Jan Borchers 2 media computing group

Athena Athena

Repeater -- Command that repeatedly calls its associated callback - -- Form widget for dialog boxes. function for as long as it's held. - Paned -- Constraint widget which allows user to adjust borders between MenuButton -- Push-button that brings up a menu. - - child widgets. - Grip -- Small widget used to adjust borders in a Paned widget. - Porthole -- widget which allows a larger widget to be - List -- Widget to allow user to select one string from a list. windowed within a smaller window. Often controlled by Panners. - Scrollbar -- Widget to allow user to set a value; typically to scroll another - Viewport -- Constraint widget which acts like a Porthole with scrollbars. widget. - Tree -- Constraint widget which lays its children out in a tree. Panner -- Widget to allow user to scroll in two dimensions. See the - SimpleMenu -- Shell which manages a simple menu. editres program for a good example. - - Sme -- RectObj which contains a simple menu entry (blank). - StripChart -- Widget to display a scrolling graph. - SmeBSB -- Menu entry with a string and optional left & right bitmaps. - Box -- Composite widget which simply lays children out left-to-right. - SmeLine -- Menu entry that draws a seperator line. - Form -- Constraint widget which positions children relative to each other.

Jan Borchers 3 media computing group Jan Borchers 4 media computing group Athena What Is Motif?

- Text -- Base class for all other text classes. - TextSink -- Base class for other text sinks. • Style Guide (book) for application developer - TextSrc -- Base class for other text sources. • Widget set (software ) implementing Style - AsciiText -- Text widget which handles 8-bit or 16-bit text. Guide - AsciiSink -- Helper object which displays 8-bit text. - AsciiSrc -- Helper object which manages text in memory or file. • (mwm) - MultiSink -- Same as AsciiSink, but handles 16-bit text. • UIL (User Interface Language) - MultiSrc -- Same as AsciiSrc, but handles 16-bit text.

Jan Borchers 5 media computing group Jan Borchers 6 media computing group

The Motif Widget Set Programming with Motif

• Initialize Intrinsics • Simple Widgets: XmPrimitive • Connect to server, allocate toolkit resources • XmLabel, XmText, XmSeparator, XmScrollbar,... • Create widgets • Shell Widgets: Shell • Building the dynamic widget tree for application • Widgets talking to Window Manager (root window children) • Tell Intrinsics to manage each widget • Application shells, popup shells,... • Realize widgets • Constraint Widgets: XmManager • Sensitize for input, per default also make visible (map) • Containters like XmDrawingArea, XmRowColumn,... • Register callbacks • Complex widgets like XmFileSelectionBox,... • Specify what app function to call when widgets are triggered • • Just call Intrinsics (XtMainLoop()) – app ends in some callback!

Jan Borchers 7 media computing group Jan Borchers 8 media computing group hello.: A Simple Example #include #include #include Resource files in X #include #include void ExitCB (Widget w, caddr_t client_data, XmAnyCallbackStruct • Where does the title for the PushButton come from? *call_data) { • ! Resource file specifies settings for application XtCloseDisplay (XtDisplay (w)); exit (0); • Syntax: Application.PathToWidget.Attribute: Value } • Resource Manager reads and merges several resource files void main(int argc, char *argv[]) { (system-, app- and user-specific) at startup (with priorities Widget toplevel, pushbutton; as discussed in reference model) toplevel = XtInitialize (argv [0], "Hello", NULL, 0, &argc, argv); pushbutton = XmCreatePushButton (toplevel, "pushbutton", NULL, 0); File "Hello": XtManageChild (pushbutton); Hello.pushbutton.labelString:! Hello World XtAddCallback (pushbutton, XmNactivateCallback, (void *) ExitCB, NULL); Hello.pushbutton.width:!! 100 Hello.pushbutton.height:!! 20 XtRealizeWidget (toplevel); XtMainLoop (); }

Jan Borchers 9 media computing group Jan Borchers 10 media computing group

User Interface Language UIL X/Motif: Evaluation

• Resource files specify late refinement of widget • Availability: high (server portability), standard WS for attributes, but cannot add widgets • Idea: specify actual widget tree of an application • Productivity: low for Xlib-based and widget outside C source code, in UIL text file development, but high using widget set, esp. Motif • C source code only contains application-specific callbacks, and • Parallelism: external yes, internal no - in original simple stub for user interface design, one app can freeze server with big request • UIL text file is translated with separate compiler • Performance: fairly high (basic graphics were faster • At runtime, Motif Resouce Manager reads compiled UIL file to than Windows on same hardware), widget sets add construct dynamic widget tree for app graphical and layout overhead, but can hold client-side • Advantage: UI clearly separated from app code resources Decouples development

Jan Borchers 11 media computing group Jan Borchers 12 media computing group X/Motif: Evaluation X/Motif: Evaluation

• Graphics model: RasterOp • Style: exchangeable through widget set and WM • API structure: Xlib procedural, Xt/widget set OO • Note: apps cannot rely on a certain WM functionality • Graphics apps need to use both APIs! • Extensibility: low • API comfort: high with Motif (even UIDS available) • Requires modifying Xlib source, usually also Xt and widget set source, applications using extension not backwards compatible and • Independence: low with Xlib (visuals), high with Motif portable anymore • Communicating apps: via RIDs in server for • Adaptability: very high (multiple resource files, UIL) resources, clipboard for text & graphics • Resource sharing: possible via RIDs • Distribution: yes, BWS, WM & apps on different machines

Jan Borchers 13 media computing group Jan Borchers 14 media computing group