<> <> <> <<>> DIRECTORY Menus USING [MenuProc], TextNode USING [Ref], TiogaOps USING [Location, Ref], TiogaFileOps USING [Ref], ViewerClasses USING [ViewerRec, Viewer], Rope USING [ROPE]; TiogaButtons: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; <<>> <> TiogaButton: TYPE = REF TiogaButtonRec; TiogaButtonRec: TYPE = RECORD [ startLoc: TiogaOps.Location, endLoc: TiogaOps.Location, proc: TiogaButtonProc, clientData: REF ANY, fork: BOOLEAN]; <> TiogaButtonList: TYPE = LIST OF TiogaButton; TiogaButtonProc: TYPE = Menus.MenuProc; <> <> <> <> CreateViewer: PROC [info: ViewerClasses.ViewerRec] RETURNS [v: ViewerClasses.Viewer]; <<... creates a $TiogaButtons class viewer.>> <> <<>> LoadViewer: PROC [viewer: ViewerClasses.Viewer, fileName: ROPE]; <<... loads an existing document into a TiogaButtons viewer>> <<>> CreateButton: PROC [viewer: ViewerClasses.Viewer, rope: ROPE _ NIL, format: ROPE _ NIL, looks: ROPE _ NIL, proc: TiogaButtonProc _ NIL, clientData: REF ANY _ NIL, fork: BOOLEAN _ TRUE] RETURNS [button: TiogaButton]; <<... creates a button as the last child of the document in viewer.>> <<(Client must provide nesting through TiogaOps)>> <> WrongViewerClass: ERROR; CreateButtonFromNode: PROC [node: TiogaOps.Ref, start: INT _ 0, end: INT _ INT.LAST, proc: TiogaButtonProc _ NIL, clientData: REF ANY _ NIL, fork: BOOLEAN _ TRUE] RETURNS [button: TiogaButton]; <<... creates a button from the node and the offsets provided. If the start and end offsets are defaulted then the button refers to the node itself.>> <> <<>> AppendToButton: PROC [button: TiogaButton, rope: ROPE _ NIL, looks: ROPE _ NIL, proc: TiogaButtonProc _ NIL, clientData: REF ANY _ NIL, fork: BOOLEAN _ TRUE] RETURNS [TiogaButton]; <<... appends the formatted rope to an existing button and creates a new button for the appended text.>> <> <> <<>> DeleteButton: PROC [button: TiogaButton]; <<... deletes the button.>> <> <> <> <<>> FindTiogaButton: PROC [this: ViewerClasses.Viewer, loc: TiogaOps.Location] RETURNS [button: TiogaButton]; <<... returns the button at that location in the viewer, or NIL>> <<>> GetRope: PROC [button: TiogaButton] RETURNS [rope: ROPE]; <<... provides the text of the button. Can be used in place of clientData for many purposes.>> <<>> SetStyleFromRope: PROC [v: ViewerClasses.Viewer, styleRope: ROPE]; <<... sets a local style for the viewer via the StyleDef property>> <<>> ChangeButtonLooks: PUBLIC PROC [button: TiogaButton, addLooks, removeLooks: ROPE _ NIL]; <<... change the looks for the button starting at the start offset>> <<>> MarkViewerNotEdited: PROC [root: TiogaOps.Ref]; <<... marks all the viewers displaying this document as not edited>> <> TextNodeRef: PROC [ref: REF] RETURNS [TextNode.Ref]; TiogaOpsRef: PROC [ref: REF] RETURNS [TiogaOps.Ref]; TiogaFileOpsRef: PROC [ref: REF] RETURNS [TiogaFileOps.Ref]; END.