<<>> <> <> <> <> <> <<>> DIRECTORY Atom USING [PropList], Xl USING [Attributes, Connection, dontUse, Event, Geometry, MatchList, MatchRep, nullVisual, nullWindow, Point, Screen, ScreenDepth, SetOfEvent, Size, TQ, unspecifiedEvents, Visual, Window]; XTk: CEDAR DEFINITIONS ~ BEGIN OPEN Xl; <<>> <> <<>> <> <> <<>> <> <<>> <> <> <<>> <> <> <> <> <> <> <> <<>> <> <> <> <> <> <> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <<>> <> <<>> <> <> <> <> <> <<>> <<>> <> <> Event: TYPE = Xl.Event; TQ: TYPE = Xl.TQ; Widget: TYPE = REF WidgetRep; dontUse: INT = Xl.dontUse; rootLockingOrder: INT = 5; --useful if you create your own rootTQ Mapping: TYPE = {mapped, unmapped, unconfigured, dontUse, unmapIfMapped, mapIfUnmapped, unmapIfUnconfigured, mapIfUnconfigured}; <> <> <> <> WidgetSpec: TYPE = RECORD [ <<--Fields useful for initialization of widgets>> class: Class ¬ NIL, geometry: Xl.Geometry ¬ [], --as requested mapping: Mapping ¬ dontUse, --as requested instName: ATOM ¬ NIL, --key for database lookup; class might overwrite this clientData: REF ¬ NIL --reserved for clients ]; FastAccessState: TYPE = {ok, warned}; <> WindowState: TYPE = {realized, warned, screened, existing, dead}; WidgetRep: TYPE = MONITORED RECORD [ <<--Monitor used for small leaf procedures. The idea is that it this is safer then to have packages use global monitors. This way in case of errors only single widgets wedge and take only a single widgets tree down. This makes debugging easier.>> s: WidgetSpec ¬ [], --public read - write depth: INTEGER ¬ 0, --public read - write visual: Visual ¬ nullVisual, --public read - write attributes: Attributes ¬ [], --public read - write flags: PRIVATE WidgetFlags ¬ ALL[FALSE], --private to prevent unmonitored access parent: <> Widget ¬ NIL, matchListX: PRIVATE LIST OF MatchRep ¬ NIL, --permanent matchList1: PRIVATE MatchList ¬ NIL, --temporary connection: <> Connection ¬ NIL, window: <> Window ¬ nullWindow, screenDepth: <> ScreenDepth ¬ NIL, fastAccessAllowed: <> FastAccessState ¬ warned, -- not monitored. <<--When changed, the new value is automatically set by XTkImpl before class procedures are called. Readonly even to class implementors.>> state: <> WindowState ¬ existing, -- (rootTQ+LX)! <<--When changed, the new value is automatically set by XTkImpl before class procedures are called. Readonly even to class implementors.>> actual: <> Xl.Geometry ¬ [], --final geometry actualMapping: <> Mapping ¬ dontUse, --final visibility (rootTQ) <<--Normally set by class when mapping change is made. >> rootTQ: <> TQ ¬ NIL, --initialized on BindScreen notifiers: PRIVATE REF ¬ NIL, props: PRIVATE REF ¬ NIL, wClassData: PRIVATE SEQUENCE leng: NAT OF REF <<--Every layer in class hierarchy can put some class dependent data here>> ]; CreateWidget: PROC [widgetSpec: WidgetSpec, class: Class ¬ NIL, arguments: Atom.PropList ¬ NIL] RETURNS [Widget]; <> <> <> <> <<>> DestroyWidget: PROC [widget: Widget, startReconfigureParent: BOOL ¬ TRUE]; <> <> <<>> <<>> <> <<>> <> <> WidgetFlagKey: TYPE = {wf0, wf1, wf2, wf3, wf4, wf5, wf6, wf7, wf8, wf9, wf10, wf11, wf12, wf13, wf14, wf15, wf16, wf17, wf18, wf19, wf20, wf21, wf22, wf23, wf24, wf25, wf26, wf27, wf28, wf29, wf30, wf31}; WidgetFlags: TYPE = PACKED ARRAY WidgetFlagKey OF BOOL ¬ ALL[FALSE]; SetWidgetFlag: PROC [widget: Widget, key: WidgetFlagKey, value: BOOL ¬ TRUE]; GetWidgetFlag: PROC [widget: Widget, key: WidgetFlagKey] RETURNS [BOOL] = INLINE { RETURN [widget.flags[key]]; }; mustReConsiderChildren: WidgetFlagKey = wf0; --Set by any child which wants parent to reconsider its children. preferredSizeFromDB: WidgetFlagKey = wf1; --if this flag is set and the window not realized the database is queried for the preferred size of a widget. Otherwise, and, when the database doesn't provide a value the normal class method is used. preferredSizeCurrent: WidgetFlagKey = wf2; --if this flag is set and the window already is realized the specified size of the widget is to be used. Otherwise the normal class method is used. ClassFlagKey: TYPE = {cf0, cf1, cf2, cf3, cf4, cf5, cf6, cf7, cf8, cf9, cf10, cf11, cf12, cf13, cf14, cf15, cf16, cf17, cf18, cf19, cf20, cf21, cf22, cf23, cf24, cf25, cf26, cf27, cf28, cf29, cf30, cf31}; ClassFlags: TYPE = PACKED ARRAY ClassFlagKey OF BOOL ¬ ALL[FALSE]; SetClassFlag: PROC [class: ImplementorClass, key: ClassFlagKey, value: BOOL ¬ TRUE]; GetClassFlag: PROC [class: Class, key: ClassFlagKey] RETURNS [BOOL] = INLINE { RETURN [class.flags[key]]; }; <> <<>> GetWidgetProp: PROC [widget: Widget, key: REF] RETURNS [REF]; <> PutWidgetProp: PROC [widget: Widget, key: REF, value: REF ¬ NIL]; <> <> <<>> <> <<>> <> <> WidgetNotifyProc: TYPE = PROC [widget: Widget, registerData, callData: REF ¬ NIL, event: Event ¬ NIL]; <> <> <> <> RegisterNotifier: PROC [widget: Widget, key: REF, procLX: WidgetNotifyProc, registerData: REF ¬ NIL]; <> <> UnRegisterNotifier: PROC [widget: Widget, key: REF, procLX: WidgetNotifyProc, registerData: REF ¬ NIL]; <> preWindowCreationLRKey: READONLY ATOM; -- ¬ $preWindowCreation preWindowCreationKey: READONLY ATOM; -- ¬ $preWindowCreation <> <> <<>> postWindowCreationLRKey: READONLY ATOM; -- ¬ $postWindowCreation postWindowCreationKey: READONLY ATOM; -- ¬ $postWindowCreation <> <> <<>> postConfigureLRKey: READONLY ATOM; -- ¬ $postConfigure postConfigureKey: READONLY ATOM; -- ¬ $postConfigure <> <> <<>> postWindowDestructionLRKey: READONLY ATOM; -- ¬ $postWindowDestruction postWindowDestructionKey: READONLY ATOM; -- ¬ $postWindowDestruction <> <> <<>> preStopFastAccessKey: READONLY ATOM; -- ¬ $preStopFastAccess <> <> <<>> postStopFastAccessLRKey: READONLY ATOM; -- ¬ $postStopFastAccess postStopFastAccessKey: READONLY ATOM; -- ¬ $postStopFastAccess <> bindScreenLRKey: PUBLIC ATOM; -- ¬ $bindScreen bindScreenKey: PUBLIC ATOM; -- ¬ $bindScreen <> <<>> forgetScreenLRKey: PUBLIC ATOM; -- ¬ $forgetScreen forgetScreenKey: PUBLIC ATOM; -- ¬ $forgetScreen <> <<>> postWidgetDestructionKey: READONLY ATOM; -- ¬ $postWidgetDestruction <> <> <> <<>> <> AddPermanentMatch: PROC [widget: Widget, matchRep: MatchRep, generate: SetOfEvent ¬ unspecifiedEvents]; <> <> <> <> <> AddTemporaryMatch: PROC [widget: Widget, matchRep: MatchRep, generate: SetOfEvent ¬ unspecifiedEvents]; <> <> <> <> <> G: PROC [w, h, b: INT ¬ dontUse] RETURNS [Geometry] = INLINE { RETURN [[pos: [dontUse, dontUse], size: [w, h], borderWidth: b]] }; RootWidget: PROC [widget: Widget] RETURNS [Widget]; <> <> <<>> BorderWidth: PROC [widget: Widget] RETURNS [INT]; <> ScreenBound: PROC [widget: Widget] RETURNS [BOOL]; <> <<>> SynchronizeFastAccess: PROC [widget: Widget, protectTQ: TQ]; <> <> <<>> <> <> <> <<>> OrphanProc: TYPE = PROC [orphan: Widget]; <> <> <> <<>> RegisterOrphanProc: PROC [self: Widget, orphanProcLR: OrphanProc ¬ NIL]; <> <> <<>> <<>> <> HasClass: PROC [widget: Widget, class: Class] RETURNS [BOOL] = <> INLINE {IF HasProperClass[widget, class] THEN RETURN [TRUE] ELSE RETURN [HasSubClass[widget, class]]}; HasProperClass: PROC [widget: Widget, class: Class] RETURNS [BOOL] = <> INLINE {RETURN [widget.s.class=class]}; HasSubClass: PROC [widget: Widget, class: Class] RETURNS [BOOL]; <> <<>> HasClassKey: PROC [widget: Widget, classKey: ATOM] RETURNS [BOOL] = <> INLINE {IF HasProperClassKey[widget, classKey] THEN RETURN [TRUE] ELSE RETURN [HasSubClassKey[widget, classKey]]}; HasProperClassKey: PROC [widget: Widget, classKey: ATOM] RETURNS [BOOL] = <> INLINE {RETURN [widget.s.class.key=classKey]}; HasSubClassKey: PROC [widget: Widget, classKey: ATOM] RETURNS [BOOL]; <> <<>> ClassName: PROC [widget: Widget] RETURNS [ATOM] = INLINE { <> <> RETURN [widget.s.class.className[widget]] }; <<>> <> <<>> NoteChildChange: PROC [widget: Widget]; <> <> <> <<>> NoteChildChangePropagate: PROC [widget: Widget, top: Widget ¬ NIL]; <> <> <<>> NoteGeometryChange: PROC [widget: Widget, geometry: Geometry ¬ []]; <> <> <> <> <<>> NoteGeometryChangePropagate: PROC [widget: Widget, geometry: Geometry ¬ [], top: Widget ¬ NIL]; <> <> <> <> <<>> NoteMappingChange: PROC [widget: Widget, mapping: Mapping ¬ dontUse]; <> <> <> <> <<>> NoteMappingChangePropagate: PROC [widget: Widget, mapping: Mapping ¬ dontUse, top: Widget ¬ NIL]; <> <> <<>> StartReconfigureChildren: PROC [widget: Widget]; <> <> NoteAndStartReconfigure: PROC [widget: Widget, geometry: Geometry ¬ [], mapping: Mapping ¬ dontUse]; <> <> <> <<>> ShallowInternalEnumerateChildren: PROC [widget: Widget, proc: EachChild, data: REF ¬ NIL]; <