NOTICE WIDGET(3W) — OLIT
WIDGET CLASS NAME
NoticeShell
SYNOPSIS
#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <Notice.h>
static Widget notice, textarea, controlarea, w;
Arg args[2];
notice = XtCreatePopupShell(name, noticeShellWidgetClass, ...);
XtSetArg(args[0], XtNtextArea, &textarea);
XtSetArg(args[1], XtNcontrolArea, &controlarea);
XtGetValues(notice, args, 2);
w = XtCreateWidget(name, widget-class, controlarea, ...);
.
.
.
XtPopup(notice, XtGrabExclusive);
DESCRIPTION
Notice Components
The Notice widget has three components: a Text Area where the message to the end user is displayed; a Control Area containing one or more widgets that the end user uses to control how to continue with an application; and a Default Button ( see the diagram Notice Widget). Another important element is the Emanate Widget, which is typically the control activated by the end user that requires immediate attention. The application identifies the Emanate Widget to the Notice widget.
Sub-class of the Shell Widget
The Notice widget is a sub-class of the Shell widget. Therefore, as the SYNOPSIS shows, the XtCreatePopupShell() routine is used to create a notice instead of the normal XtCreateWidget(). Popping the Notice Up/Down
The application controls when the Notice widget is to be displayed or popped up. As shown in the SYNOPSIS, the XtPopup() routine can be used for this.
However, the application does not need to control when the Notice widget is to be popped down. The widget itself detects when to pop down: the end user clicks SELECT on an OblongButton widget in the Control Area. This behavior requires that there be at least one OblongButton widget in the Control Area. If other types of controls are used instead, the application can "manually" pop the notice down using a routine such as XtPopdown(). Busy Button, Busy Application
When the Notice pops up, it "freezes" the entire application except the Notice to prevent the end user from interacting with any other part of the application. As feedback of this to the user, the Notice causes the headers of all the base windows and pop-up windows to be stippled in the "busy" pattern, and causes a stipple pattern in the Emanate Widget. The latter stipple pattern is caused by setting the XtNbusy resource to TRUE in the Emanate Widget. If the widget does not recognize this resource, nothing will happen.
On popping down, the Notice widget clears all stipple patterns and "unfreezes" the application.
Figure 1 Notice Widget
Text and Control Areas
The Text and Control Areas are handled by separate widget interfaces. The SYNOPSIS shows how the widget IDs of the Text Area (textarea) and the Control Area (controlarea) are obtained from the Notice widget.
The Text and Control Areas abut so that there is no space between the two. An application can control the distance between the text and the controls by setting margins in the Control Area.
Notice Coloration
The diagram Notice Coloration illustrates the resources that affect the coloration of the Notice widget.
Figure 2 Notice Coloration
SUBSTRUCTURE
Control Area component
Name: controlarea
Class: ControlArea
Table 1 Control Area application Resources Control Area Application Resources
Name Type Default Access
XtNhPad Dimension 0 I
XtNhSpace Dimension 4 I XtNmeasure int 1 I
XtNvPad Dimension 0 I
XtNvSpace Dimension 4 I See the ControlArea widget for the descriptions of these resources. Text Area component
Name: textarea
Class: StaticText
Table 2 Text Area Resources Text Area Application Resources\\∗(cO
Name Type Default Access
XtNfont XFontStruct ∗ (OPEN LOOK font) SI XtNfontColor Pixel Black∗ SGI XtNlineSpace int 0 I
XtNstring String NULL I
XtNstrip Boolean TRUE I
XtNwrap Boolean TRUE I See the StaticText widget for the descriptions of these resources.
RESOURCES
Table 3 Notice Widget Resource Set Notice Resource Set
Name Type Default Access
XtNallowShellResize Boolean TRUE SGI
XtNancestorSensitive Boolean TRUE G∗
XtNbackground Pixel White SGI†
XtNbackgroundPixmap Pixmap (none) SGI†
XtNborderColor Pixel White SGI†
XtNborderPixmap Pixmap (none) SGI†
XtNcontrolArea Widget (none) G XtNcreatePopupChildProc XtCreatePopupChildProc NULL SGI
XtNdepth int (parent’s) GI
XtNdestroyCallback XtCallbackList NULL SI
XtNemanateWidget Widget (parent’s) SGI
XtNgeometry String NULL GI
Notice Resource Set
Name Type Default Access
XtNheight Dimension (calculated) SGI XtNpopdownCallback XtCallbackList NULL SI
XtNpopupCallback XtCallbackList NULL SI
XtNsaveUnder Boolean FALSE SGI
XtNsensitive Boolean TRUE GI∗
XtNtextArea Widget (none) G
XtNuserData XtPointer NULL SGI
XtNwidth Dimension (calculated) SGI
XtNx Position 0 SGI
XtNy Position 0 SGI XtNcontrolArea
This is the widget ID of the ControlArea class composite child widget where controls can be attached; its value is available once the Notice widget has been created.
Any widgets of the class OblongButton added to the Control Area are assumed to be window disposition controls; that is, when the end user activates one of them, the Notice widget pops itself down. XtNemanateWidget
Range of Values:
(ID of existing widget)
This resource identifies the Emanate Widget. On popping up, the Notice widget attempts to set this widget to be busy, by making its XtNbusy resource TRUE; if the widget doesn’t recognize the resource, nothing happens. On popping down, the Notice widget clears the XtNbusy resource.
When the Notice widget pops up, it tries not to cover this widget; this may fail depending on its location and the size of the Notice widget.
The default for this resource is the parent. The parent, however, cannot be a Gadget (OblongButtonGadget, for instance). To emanate a Notice from a Gadget, specify another widget as the parent and set XtNemanateWidget to the Gadget. XtNemanateWidget to the Gadget. XtNtextArea
This is the widget ID of the StaticText class child widget that controls the Text Area; its value is available once the Notice widget has been created.
Sun Release 4.1 — Last change: 1/8/90