DIRECTORY IO USING [STREAM], Rope USING [ROPE], Xl USING [BOOL3, Connection, Event, Font, Geometry, nullWindow, Size, TQ, TimeStamp, Window], XTk USING [Mapping, Widget, WidgetNotifyProc, WidgetSpec], XTkCommon USING [ChoiceElement, RepaintMode, StyleSpec], XTkShellWidgetTypes USING [ICCCMHints]; XTkWidgets: CEDAR DEFINITIONS ~ BEGIN OPEN Xl; ROPE: TYPE = Rope.ROPE; Geometry: TYPE = Xl.Geometry; Widget: TYPE = XTk.Widget; WidgetNotifyProc: TYPE = XTk.WidgetNotifyProc; WidgetSpec: TYPE = XTk.WidgetSpec; queryDBFont: READONLY Font; --this "Font" can not be used for drawing CreateBareWidget: PROC [widgetSpec: WidgetSpec ¬ []] RETURNS [Widget]; ShellWidget: TYPE = Widget; CreateShell: PROC [widgetSpec: WidgetSpec ¬ [], child: Widget ¬ NIL, windowHeader: ROPE ¬ NIL, iconName: ROPE ¬ NIL, className: ATOM ¬ NIL, packageName: ROPE ¬ NIL, shortName: ROPE ¬ NIL, rootTQ: Xl.TQ ¬ NIL, dontQueryGeometry: BOOL ¬ FALSE, deletionProtocol: BOOL ¬ TRUE, focusProtocol: BOOL ¬ TRUE, standardMigration: BOOL ¬ TRUE] RETURNS [ShellWidget]; BindScreenShell: PROC [shell: ShellWidget, connection: REF ¬ NIL, parentWindow: Xl.Window ¬ Xl.nullWindow]; ForgetScreenShell: PROC [shell: ShellWidget]; RegisterCallWMDeleteWindow: PROC [shell: ShellWidget, proc: WidgetNotifyProc, registerData: REF ¬ NIL]; RegisterCallConnectionDied: PROC [shell: ShellWidget, proc: WidgetNotifyProc, registerData: REF ¬ NIL]; RegisterCallWindowDied: PROC [shell: ShellWidget, proc: WidgetNotifyProc, registerData: REF ¬ NIL]; SetShellChild: PROC [shell: ShellWidget, child: Widget]; RealizeShell: PROC [shell: ShellWidget, geometry: Xl.Geometry ¬ [], mapping: XTk.Mapping ¬ mapped, reConsiderChildren: BOOL ¬ TRUE]; ForkRealizeShell: PROC [shell: ShellWidget, geometry: Xl.Geometry ¬ [], mapping: XTk.Mapping ¬ mapped, reConsiderChildren: BOOL ¬ TRUE]; DestroyShell: PROC [shell: ShellWidget]; SetFocusMethod: PROC [shell: ShellWidget, focusProtocol, inputHint: Xl.BOOL3 ¬ illegal]; SetFocus: PROC [shell: ShellWidget, time: Xl.TimeStamp, child: REF ¬ NIL]; SetFocusTarget: PROC [shell: ShellWidget, child: REF ¬ NIL, time: Xl.TimeStamp ¬ [0]]; FocusTime: PROC [shell: ShellWidget] RETURNS [Xl.TimeStamp]; OpenIcon: PROC [shell: ShellWidget]; Iconify: PROC [shell: ShellWidget]; WithDraw: PROC [shell: ShellWidget]; TrackColorMap: PROC [shell: ShellWidget, w: Widget]; GetHints: PROC [shell: ShellWidget] RETURNS [REF ICCCMHints]; UpdateHints: PROC [shell: ShellWidget]; ICCCMHints: TYPE = XTkShellWidgetTypes.ICCCMHints; CreateInteroperabilityShell: PROC [widgetSpec: WidgetSpec ¬ [], child: Widget ¬ NIL, className: ATOM ¬ NIL, rootTQ: Xl.TQ ¬ NIL] RETURNS [ShellWidget]; BindInteroperabilityShell: PROC [shell: ShellWidget, connection: Xl.Connection, foreignParent: Xl.Window]; ContainerWidget: TYPE = Widget; CreateYStack: PROC [widgetSpec: WidgetSpec ¬ [], stack: LIST OF Widget ¬ NIL, force: INT ¬ -1] RETURNS [ContainerWidget]; CreateXStack: PROC [widgetSpec: WidgetSpec ¬ [], stack: LIST OF Widget ¬ NIL, force: INT ¬ -1] RETURNS [ContainerWidget]; CreateContainer: PROC [widgetSpec: WidgetSpec ¬ [], children: LIST OF Widget ¬ NIL] RETURNS [ContainerWidget]; AppendChild: PROC [container: ContainerWidget, child: Widget, startReconfigure: BOOL ¬ TRUE]; AppendChildren: PROC [container: ContainerWidget, children: LIST OF Widget, startReconfigure: BOOL ¬ TRUE]; RemoveChild: PROC [container: ContainerWidget, child: Widget, destroyChild: BOOL ¬ TRUE, startReconfigure: BOOL ¬ TRUE]; SetForce: PROC [container: ContainerWidget, force: INT]; TextWidget: TYPE = Widget; StyleSpec: TYPE = XTkCommon.StyleSpec; ButtonHitProcType: TYPE = XTk.WidgetNotifyProc; CreateLabel: PROC [widgetSpec: WidgetSpec ¬ [], text: Rope.ROPE ¬ NIL, style: StyleSpec ¬ []] RETURNS [TextWidget]; CreateButton: PROC [widgetSpec: WidgetSpec ¬ [], text: Rope.ROPE ¬ NIL, style: StyleSpec ¬ [], hitProc: XTk.WidgetNotifyProc ¬ NIL, registerData, callData: REF ¬ NIL, tq: TQ ¬ NIL, help: Rope.ROPE ¬ NIL] RETURNS [TextWidget]; CreateField: PROC [widgetSpec: WidgetSpec ¬ [], text: Rope.ROPE ¬ NIL, style: StyleSpec ¬ []] RETURNS [TextWidget]; CreateLabeledField: PROC [widgetSpec: WidgetSpec ¬ [], label, init: ROPE ¬ NIL, style: StyleSpec ¬ [], labelWidth, fieldWidth: INT ¬ 0] RETURNS [TextWidget]; GetText: PROC [widget: TextWidget] RETURNS [ROPE]; RepaintMode: TYPE = XTkCommon.RepaintMode; SetText: PROC [widget: TextWidget, text: ROPE, repaint: RepaintMode ¬ immediately]; SetFont: PROC [widget: TextWidget, font: Font, repaint: RepaintMode ¬ immediately]; SetStyleKey: PROC [widget: TextWidget, style: ATOM, repaint: RepaintMode ¬ immediately]; ChoiceWidget: TYPE = Widget; ChoiceElement: TYPE = XTkCommon.ChoiceElement; ChoiceList: TYPE = LIST OF ChoiceElement; CurrentChoice: PROC [widget: ChoiceWidget] RETURNS [REF ANY]; Choose: PROC [widget: ChoiceWidget, ce: ChoiceElement]; CreateChoices: PROC [widgetSpec: WidgetSpec ¬ [], choices: ChoiceList, horizontal: BOOL ¬ TRUE, hitProc: XTk.WidgetNotifyProc ¬ NIL, registerData: REF ¬ NIL, tq: TQ ¬ NIL, style: StyleSpec ¬ []] RETURNS [ChoiceWidget]; CreateToggle: PROC [widgetSpec: WidgetSpec ¬ [], choices: ChoiceList, hitProc: XTk.WidgetNotifyProc ¬ NIL, registerData: REF ¬ NIL, tq: TQ ¬ NIL, style: StyleSpec ¬ []] RETURNS [ChoiceWidget]; CreateRuler: PROC [widgetSpec: WidgetSpec ¬ []] RETURNS [Widget]; HRule: PROC [height: INT _ 1] RETURNS [XTk.Widget]; VRule: PROC [width: INT _ 1] RETURNS [XTk.Widget]; CreateSpace: PROC [widgetSpec: XTk.WidgetSpec ¬ []] RETURNS [XTk.Widget]; HSpace: PROC [width: INT _ 1] RETURNS [XTk.Widget]; VSpace: PROC [height: INT _ 1] RETURNS [XTk.Widget]; CreateStreamWidget: PROC [widgetSpec: WidgetSpec ¬ [], widgetStream: IO.STREAM ¬ NIL] RETURNS [Widget]; CreateStream: PROC [w: Widget ¬ NIL] RETURNS [widgetStream: IO.STREAM]; BindStream: PROC [w: Widget, widgetStream: IO.STREAM]; END. œXTkWidgets.mesa Copyright Σ 1988, 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, October 18, 1988 10:46:22 am PDT Christian Jacobi, April 8, 1992 3:28 pm PDT Implements some simple widget classes Bare widgets Creates a widget with no other semantics as just an X window Usefull to have a bare X window for applications wanting to paint directly. Could even be used to pass to an other application... Shell widgets Shell widgets are widgets which do not have normal parent widgets. The typical shell widgets are those which do the window manager conventions. ShellWidget won't be garbage collected between realization and destruction Creates a shell widget, subject to window management. rootTQ: if not defaulted must watch locking order! shortName: used for look ups packageName: e.g. used for finding files deletionProtocol: interactive enable of DestroyShell [using WM DELETE WINDOW protocol]. focusProtocol: enables FocusTarget [using WM TAKE FOCUS protocol]. Creates connection and binds screen. connection: If not a Xl.Connection, one is made up. atom, NIL: Check external for a server name and create connection. rope: Create connection to this server. May raise Xl.connectionNotCreated. Unrealizes shell and forgets screen. Registers proc to be called in case of a window manager request to delete the window. Default behaviour is to destroy the widget; but note that this is invoked only when deletionProtocol is TRUE. Procedure may deny the deletion. Unregisters previous proc. Not monitored. callData=$wmDeleteWindow Registers proc to be called on rootTQ in case of unexpected dying connection (after stopping interactions). Default behaviour is to destroy the widget. Procedure must forget the screen. Unregisters previous proc. Not monitored. callData=Xl.Connection Registers proc to be called on rootTQ in case of unexpected destroyWindow event (after stopping interactions). Default behaviour is to destroy the widget. Procedure must forget the screen. Unregisters previous proc. Not monitored. callData=$destroyNotify Do not call this from inside a configure procedure. Any thread. Set child Acquires lock and builds the widget tree (starts configuration). If no screen has been bound, one is made up. Then may raise Xl.connectionNotCreated. Forks and calls RealizeShell (start configuration). Destroys the widget tree Critical part is forked! Input Focus according to ICCCM Sets the input method hints according to ICCCM focusProtocol: Usage of WM_TAKE_FOCUS protocol inputHint: WM_HINTS InputHint flag No input: No keyboard input expected (focusProtocol: false, inputHint: false) Passive: Expects input but does not set input focus (focusProtocol: false, inputHint: true) Locally active: Client sets input focus when it is in one of his windows (focusProtocol: true, inputHint: true) Globally active: Client sets input focus even when it belonged to another clients window (focusProtocol: true, inputHint: false) Some window managers read flags only on transition from withdrawn state. Actively sets the input focus to child if time is valid and advances time. child a Widget, REF Window or NIL (child=NIL: use current focus target of shell) (child#NIL: set focus target of shell and input focus) Delayed: If shell gets WM_TAKE_FOCUS message (or a SetFocus with NIL child) shell will then set (forward) focus to child. child a Widget, REF Window or NIL time: If used then restricts operation to valid times. Time is not advanced. Useful only if ICCCM WM_TAKE_FOCUS protocol is enabled. Returns TimeStamp of last WM_TAKE_FOCUS message or SetFocus to shell. Window state according to ICCCM Top level windows are in either normal state (open) Iconic state or withdrawn state. These routines do not cache the state and therefore might generate request to the server even if not absolutely necessary. Don't rely on result: Interactive actions of user through window manager could change state at any time. Opens iconic or withdrawn widget. Fancy map request. Iconifies open or withdrawn widget. Puts open or iconic window into withdrawn state. Fancy unmap request. Withdrawn state is particularly interesting since on transition from it the window manager really must read the windows properties. Other ICCCM stuff Makes the necessary ICCCM compliant mumbojumbo so window managers will know to install w's color map. Returns associated fields for ICCCM hints. Cache for properties! Will be put onto property before first mapping. Cedar convention: whenever data covered by ICCCMHints is modified, change it also in hints (So next client will set all the fields correctly). Eventually makes sure ICCCMHints are forwarded to server Interoperability widgets Creates an interoperability shell widget. Grafting interoperability shell as child of an X window of an unknown connection. Warning: there is no control whether foreignParent just disappears with or without its connection... Container widgets Container which abuts children in Y direction force: force children height; -1 to leave individual; 0 to split equal Container which abuts children in X direction force: force children width; -1 to leave individual; 0 to split equal Container which draws children at their requested size and position Append child as last child to ContainerWidget Callable from any thread Append children to ContainerWidget Callable from any thread Removes child from ContainerWidget. Callable from any thread force: forces children height in stacks. -1 to leave individual; 0 to split equal. Delayed until next reconfigure. Text widgets Creates a label. A label is a piece of text which can not be directly changed by editing operations. Creates a button. A button is a piece of text which can not be edited, but which calls hitProc [on thread] when interactively poked at. [A NIL thread causes the hitProc to fork.] Creates a field. A field is a piece of text which can be edited. Creates a widget which contains a label and a field. GetText/SetText operates on field but not on label. Returns current text in widget. Replaces text displayed with widget; does not change size. repaint: forces window to repaint. From any thread. Replaces font of displayed text. repaint: forces window to repaint. From any thread. Replaces style of displayed text. repaint: forces window to repaint. Possible styles [see also doc]: NIL, $WhiteOnBlack. From any thread. Choice widgets Returns key field of current choice Selects the feedback choice of a ChoiceWidget; Like interactive action, except the hitProc is not called. It is ok if only text or only key in ChoiceElement is defined. Use this for initializations. ChoiceWidget displays choices but marks the currently selected one. choices must not be NIL. The hitProc procedure is executed on thread [forked if NIL]. style: applied to all elements choices with NIL key can not be selected; all choices are visible. ChoiceWidget displays current options but can be toggled through choices. Ruler and spaces Creates a recangle. A quite heavy weight method of painting rectangles. Define the geometry field! a defaulted value means all the way if the parent supports that. Short cuts for CreateRuler Creates a widget with no other semantics as just using up space Short cuts for CreateSpace Output stream widgets Creates a stream widget, enabling ascii output. If widgetStream is not NIL, its output will be directed to the created widget. Creates a new widgetStream stream which can direct its output into arbitrary stream-widgets. If w is not NIL the new stream will direct its output into w. Stream might discard characters until widget is attached, created and widget is realized. Further output into widgetStream is directed into w. Κ Ο•NewlineDelimiter –(cedarcode) style˜codešœ™Kšœ ΟeœI™TKšœ=™=K™+K™—šΟk œ˜ Kšžœžœžœ˜Kšœžœžœ˜Kšœžœžœ7žœ˜^Kšœžœ1˜:Kšœ žœ)˜8Kšœžœ˜'K˜—KšΟn œžœž ˜Kšœžœžœ˜K™™%K˜Kšžœžœžœ˜Kšœ žœ˜Kšœžœ˜Kšœžœ˜.Kšœ žœ˜"Kšœ žœΟc)˜EK˜—K˜šΟb ™ K˜šŸœžœžœ ˜FKš <™Οzœ’œ™WKšœ-’œ’œ™CK™—šŸœžœ"žœžœ+˜kKšœ$™$šœ5™5K™CK™(Kšœ"™"—K™—šŸœžœ˜-Kšœ$™$K™—šŸœžœ<žœžœ˜gKšœ œœ Bœ œ  ™¬K™—šŸœžœ<žœžœ˜gKš œ —‘ *œ œ   œ™€K™—šŸœžœ<žœžœ˜cKš œ š‘ *œ œ   œ ™„—K˜šŸ œžœ%˜8Kšœ2 ™@Kš  ™ K˜—šŸ œžœežœžœ˜„Kš @™@Kš =œ ™UK™—šŸœžœežœžœ˜ˆKš Ÿ  ™3K™—šŸ œžœ˜(Kšœ™Kšœ™—K™K˜š‘ Ÿ™K˜šŸœžœ3žœ ˜Xšœ.™.Jšœ.™.Jšœ#™#—šœ ™ Jšœ™J™(—šœ ™ Jšœ+™+J™'—šœ™Kšœ9™9K™&—šœ™JšœI™IJ™'—J™IK˜—šŸœžœ1žœžœ˜JJšœJ™Jšœ"™"Jšœ.™.Jšœ6™6—J™—šŸœžœžœžœ˜VJšœz™zJšœ!™!JšœM™MJšœ8™8J™—šŸ œžœžœ˜œ  ™QKšœd™d—K˜—K˜š‘™K˜šœžœ ˜K˜—šŸ œžœ&žœžœ žœ žœžœ˜yKš -™-Kš F™FK˜—šŸ œžœ&žœžœ žœ žœžœ˜yKš -™-Kš E™EK˜—š Ÿœžœ)žœžœ žœžœ˜nKš C™CK˜—šŸ œžœ?žœžœ˜]Kš œ ™.Kš ™K˜—š Ÿœžœ(žœžœžœžœ˜kKš œ ™#Kš ™K™—š Ÿ œžœ;žœžœžœžœ˜xKš œ ™$Kš ™—K™šŸœžœ%žœ˜8Kš (™(Kš )™)Kš ™—K˜—K˜š‘ ™ K˜Kšœ žœ ˜Kšœ žœ˜&Kšœžœ˜/K˜š Ÿ œžœ*žœžœžœ˜sKš ™Kš S™SK˜—šŸ œžœ*žœžœ9žœžœžœžœžœ žœžœžœ˜αKš ™Kš X™XKš H™HK™—š Ÿ œžœ*žœžœžœ˜sKš ™Kš /™/—K˜š Ÿœžœ,žœžœ1žœžœ˜Kš 4™4K™3K™—šŸœžœžœžœ˜2Kš ™K˜—Kšœ žœ˜*K˜šŸœžœžœ&˜SKšœ œ™:Kšœ"™"Kšœ™K™—šŸœžœF˜SKš  ™ Kš "™"Kšœ™K˜—šŸ œžœžœ&˜XKš !™!Kš "™"Kšœ3™3Kšœ™K™——K™š‘™K™šœžœ ˜K˜—Kšœžœ˜.Kšœ žœžœžœ˜)K˜š Ÿ œžœžœžœžœ˜=Kšœ#™#—K˜šŸœžœ+˜7Jšœ/™/Jšœ;™;Jšœ>™>Jšœ™J™—šŸ œžœ@žœžœ"žœžœžœžœžœžœ˜ΪKšœC™CKšœž™Kšœ7žœ™KšœY™YK™—šŸ œžœžœžœ˜6Kš œ  œ™4——K˜Kšžœ˜K˜K˜—…—ώAi