DIRECTORY EBTypes, Rope, ViewerClasses; EBButtonClasses: CEDAR DEFINITIONS = BEGIN ActiveButton: TYPE = EBTypes.ActiveButton; ActiveDoc: TYPE = EBTypes.ActiveDoc; ButtonInfo: TYPE = EBTypes.ButtonInfo; Event: TYPE = EBTypes.Event; ROPE: TYPE = Rope.ROPE; Viewer: TYPE = ViewerClasses.Viewer; RegisterButtonClass: PROC [buttonClassName: ATOM, buttonClass: ButtonClass]; ListButtonClasses: PROC [] RETURNS [buttonClasses: LIST OF ATOM]; MarkButtonAsChanged: PROC [buttonInfo: ButtonInfo]; ButtonClass: TYPE = REF ButtonClassObj; ButtonClassObj: TYPE = RECORD [ name: ATOM, instantiate: InstantiateProc, unparseInstanceData: UnparseInstanceDataProc, handleEvent: HandleEventProc, getValue: GetValueProc, setValue: SetValueProc, defaultBehavior: DefaultBehaviorProc]; InstantiateProc: TYPE = PROC [buttonInfo: ButtonInfo, language: ATOM, languageVersion: NAT, initFeedback: BOOL ¬ FALSE] RETURNS [instance: REF]; UnparseInstanceDataProc: TYPE = PROC [instanceData: REF, buttonInfo: ButtonInfo ¬ NIL, language: ATOM ¬ NIL, languageVersion: NAT ¬ 0] RETURNS [ROPE ¬ NIL]; HandleEventProc: TYPE = PROC [event: Event, instanceData: REF, buttonInfo: ButtonInfo]; GetValueProc: TYPE = PROC[instanceData: REF, buttonInfo: ButtonInfo] RETURNS [value: REF]; SetValueProc: TYPE = PROC[instanceData: REF, value: REF, buttonInfo: ButtonInfo] RETURNS[changed: BOOL ¬ FALSE]; DefaultBehaviorProc: TYPE = PROC[instanceData: REF, buttonInfo: ButtonInfo]; END. Δ EBButtonClasses.mesa Copyright Σ 1988, 1989, 1991, 1992 by Xerox Corporation. All rights reserved. Goodisman, August 13, 1989 8:31:37 pm PDT Bier, August 28, 1991 12:43 pm PDT Doug Wyatt, April 15, 1992 2:31 pm PDT Contents: Button Classes' interface to EmbeddedButtons, a framework for adding standardized behaviors to any application that is willing to support a set of button objects and to implement the behavior access routines. To register a new button class, implement the procedures the make up the ButtonClass record. Then call RegisterButtonClass using a new buttonClassName. To find out what button class names are in use, call ListButtonClasses from the interpreter. Called by the implementation of a button class. The ButtonClass record and the types of its procedures Note: A button class's unparseInstanceData may be NIL if the button class guarantees that the instance data for a button of this class will never change, especially if its setValue is also NIL. Returns the runtime ButtonData corresponding to buttonData. If initFeedback is TRUE, causes the feedback on button in doc appropriate to this button being initialized. Depending on the language and languageVersion, either returns the rope version of the instanceData or sets the field values of the buttonInfo to the rope versions of the fields of the instanceData. Handles the event by causing the button's behavior (changing state, popping up a menu, etc.), feedback (through FeedbackNotify), and function (through PassEventToApplication). If the buttonClass provides for each button to have a value, returns the button's value. If the buttonClass does not provide for a value, returns NIL. If the ButtonClass provides for each button to have a name and value, sets the value of button to val if button's name is "name". Returns TRUE if the button's value has actually changed. In conditions where the default behavior of a button is appropriate, EmbeddedButtons will call this routine. Κ¨–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ ΟeœB™NKšœ)™)K™"K™&—K˜KšΟnœΣ™ΫK™šΟk ˜ K˜—K˜šžœŸœŸ œŸ˜*K˜KšœŸœ˜*Kšœ Ÿœ˜$Kšœ Ÿœ˜&KšœŸœ˜KšŸœŸœŸœ˜KšœŸœ˜$—Iblockšœφ™φK˜šžœŸœŸœ˜LK™/K™—Kš žœŸœŸœŸœŸœŸœ˜AKšžœŸœ˜3K˜K™6K™Kšž œŸœŸœ˜'šœŸœŸœ˜KšœŸœ˜ Kšœ˜Kšœ-˜-K˜K˜K˜K˜&K™Β—K˜šžœŸœŸœ$ŸœŸœŸœŸœŸœ Ÿœ˜KšœPŸœT™¨K˜—šžœŸœŸœŸœŸœ ŸœŸœŸœŸœŸœŸœ˜œKšœΕ™ΕK™—šžœŸœŸœŸœ˜WK™―K™—š ž œŸœŸœŸœŸœ Ÿœ˜ZKšœ—™—K™—šž ΟbŸœŸœŸœ ŸœŸœ ŸœŸœ˜pK™ΊK™—šžœŸœŸœŸœ˜LK™l™K˜——KšŸœ˜—…—ͺ