-- VTables.mesa, Viewer Tables class -- Russ Atkinson, September 20, 1982 8:04 pm DIRECTORY Buttons USING [ButtonProc], Rope USING [ROPE], VFonts USING [Font], ViewerClasses USING [Viewer]; VTables: CEDAR DEFINITIONS = BEGIN OPEN Rope, ViewerClasses; VTable: TYPE = Viewer; Border: TYPE = RECORD [up,down,left,right: BOOL]; FullBorder: Border = [TRUE, TRUE, TRUE, TRUE]; NullBorder: Border = [FALSE, FALSE, FALSE, FALSE]; Create: PROC [columns, rows: INTEGER _ 1, name: ROPE _ NIL, parent: Viewer _ NIL, xRuleWidth: INTEGER _ 1, yRuleWidth: INTEGER _ 1, x, y, w, h: INTEGER _ 0, scrollable: BOOL _ FALSE] RETURNS [table: VTable]; -- create an empty table instance from the given parameters -- if columns <= 0 or rows <= 0, NIL will be returned -- if parent = NIL, a container will be created -- (and will be used as the parent) -- IF w = 0 and h = 0 -- THEN the table width and height will be adjusted dynamically Install: PROC [table: VTable, paint: BOOL _ TRUE]; -- install changes to the table -- this will adjust the positions and sizes of the entries -- after operations beginning with "Set" or "Exchange" -- repainting will be inhibited until Install is performed -- (SetEntryBorder, SetRowsAndColumns, SetTableEntry, SetEntryOffset) GetTableEntry: PROC [table: VTable, row, column: NAT _ 0] RETURNS [Viewer]; -- get the current table entry at the given row and column SetTableEntry: PROC [table: VTable, row, column: NAT _ 0, name: ROPE _ NIL, flavor: ATOM _ NIL, proc: Buttons.ButtonProc _ NIL, clientData: REF _ NIL, w, h: NAT _ 0, xoff, yoff: INTEGER _ 0, border: Border _ FullBorder, font: VFonts.Font _ NIL, displayStyle: ATOM _ NIL, useMaxSize: BOOL _ FALSE]; -- set a table entry (requires installation afterwards) -- (invalid row and column specs cause bounds faults) -- if flavor = $Viewer, then clientData is a pre-existing viewer -- (which had better have table as a parent!) -- otherwise, a new viewer of the appropriate flavor is created -- (appropriate arguments are passed through to CreateChild) -- if flavor = NIL, flavor = $Label will be assumed -- if proc # NIL, flavor = $Button will be forced -- xoff and yoff give offset within entry -- useMaxSize governs setting of entry size to max -- of row and column sizes SwapTableEntries: PUBLIC PROC [table: VTable, row1, column1, row2, column2: NAT _ 0, swapBorders: BOOL _ FALSE]; -- swap the given table entries -- reinstallation is required GetEntryBorder: PROC [table: VTable, row, column: NAT _ 0] RETURNS [Border]; -- get the current table border at the given row and column -- if remove is TRUE, NIL is placed in the entry, -- BUT the entry is not destroyed SetEntryBorder: PROC [table: VTable, row, column: NAT _ 0, border: Border _ FullBorder]; -- set the current table border at the given row and column -- reinstallation is required GetEntryOffset: PROC [table: VTable, row, column: NAT _ 0] RETURNS [xoff,yoff: INTEGER]; -- get the current offsets of the given entry SetEntryOffset: PROC [table: VTable, row, column: NAT _ 0, xoff,yoff: INTEGER _ 0]; -- sets the current offsets of the given entry -- reinstallation is required GetRowsAndColumns: PROC [table: VTable] RETURNS [rows, columns: NAT]; -- get the number of rows and columns SetRowsAndColumns: PROC [table: VTable, rows, columns: NAT _ 0]; -- sets the number of rows and columns -- can be used to either grow or shrink the table -- reinstallation is required ExchangeRows: PROC [table: VTable, row1,row2: NAT _ 0]; -- exchange the two given rows -- reinstallation is required ExchangeColumns: PROC [table: VTable, column1,column2: NAT _ 0]; -- exchange the two given columns -- reinstallation is required END. ΚC– "Mesa" style˜Iprocš†ΟcRœΟk œ žœžœžœ žœžœžœž œžœžœ#žœžœžœžœžœžœžœžœžœžœžœžœΟnœžœžœžœžœžœžœžœžœžœžœ žœ<œ6œ0œ$œœCœ Ÿœžœžœžœ œ;œ7œ;œHœŸ œžœ$žœžœ<œŸ œžœ.žœžœžœžœžœ&žœžœžœžœžœAžœžœžœžœžœ8œ9œAœ1œ@œ@œ4œ2œ*œ3œœŸœžœžœ5žœžœžœCœŸœžœ$žœžœ<œ2œ#œŸœžœ$žœ(_œŸœžœ$žœžœ žœ/œŸœžœ$žœžœ SœŸœžœžœžœ'œŸœžœ žœ 'œUœŸ œžœžœ BœŸœžœ"žœ Eœžœ˜‘ —…—$m