Cursors.mesa; Last Edited by McGregor, June 9, 1982 3:01 pm
Last Edited by: Maxwell, January 3, 1983 12:11 pm
DIRECTORY
Interminal USING [CursorArray, GetMousePosition, MousePosition];
Cursors: CEDAR DEFINITIONS IMPORTS Interminal = BEGIN
Types:
CursorArray: TYPE = Interminal.CursorArray;
CursorHandle: TYPE = REF CursorRec; -- use these for user-defined cursors
CursorRec:
TYPE =
RECORD [
info: CursorInfo,
bits: CursorArray];
CursorInfo:
TYPE =
RECORD [
type: CursorType, -- the unique cursor type
hotX: INTEGER ← 0, -- these define a logical "hot-spot", or "activation point" for a cursor
hotY: INTEGER ← 0,
inverted: BOOL ← FALSE];
CursorType:
TYPE =
MACHINE
DEPENDENT {
activate(0), blank(1), bullseye(2), confirm(3), crossHairsCircle(4),
ftp(5), typeKey(6), hourGlass(7), move(8), menu(9), mouseRed(10),
mouseYellow(11), mouseBlue(12), grow(13), pointDown(14), pointLeft(15),
pointRight(16), pointUp(17), questionMark(18), retry(19), scrollDown(20),
scrollLeft(21), scrollLeftRight(22), scrollRight(23), scrollUp(24),
scrollUpDown(25), textPointer(26), last(64)};
PredefinedCursor: TYPE = CursorType[activate..textPointer];
ClientCursor: TYPE = CursorType(textPointer..last);
Procedural Interface:
SetCursor: PROC [CursorType]; -- force bits into cursor bitmap (WMgr use only)
InvertCursor: PROC;
GetCursor: PROC RETURNS [CursorType] = INLINE {RETURN[globalInfo.type]};
GetCursorInfo:
PROC
RETURNS [CursorInfo] =
INLINE {
RETURN[globalInfo]};
For info on the currently displayed cursor
globalInfo: PRIVATE CursorInfo;
NewCursor:
PROC [bits: CursorArray, hotX, hotY:
INTEGER ← 0]
RETURNS [CursorType];
To roll your own cursors; allocates a new unique type
CornerSide:
TYPE = {upperSide, lowerSide, leftSide, rightSide, upperLeft, upperRight,
lowerLeft, lowerRight};
AddCursorCorner:
PUBLIC
PROC [cornerSide: CornerSide] ;
Adds lines on top, sides, or both to currently displayed cursor
GetCursorCoords:
PROC
RETURNS [Interminal.MousePosition] =
TRUSTED INLINE
{RETURN[Interminal.GetMousePosition[]]};
Reads hardware mouse locs, mapping through hot spot of current cursor. Note that this reads the real-time value of the cursor and extreme caution should be used when interacting with clients of Inscripts, since they may be currently reading events long passed.
END.