XTkLabels.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, July 2, 1991 1:58 pm PDT
Christian Jacobi, April 7, 1992 11:37 am PDT
Implements a label widget class.
A label is a piece of text which can not be directly changed by editing operations.
DIRECTORY
Rope USING [ROPE],
Xl USING [Connection, Font, Size],
XTk USING [Class, ImplementorClass, Widget, WidgetSpec],
XTkCommon USING [RepaintMode, StyleSpec];
XTkLabels: CEDAR DEFINITIONS ~
BEGIN
Client accessible functions
TextWidget: TYPE = XTk.Widget;
StyleSpec: TYPE = XTkCommon.StyleSpec;
RepaintMode: TYPE = XTkCommon.RepaintMode;
Parameter used in procedures modifying a TextWidget to specify optional repaint.
CreateLabel: PROC [widgetSpec: XTk.WidgetSpec ¬ [], text: Rope.ROPE ¬ NIL, style: StyleSpec ¬ []] RETURNS [TextWidget];
Creates a label widget.
GetText: PROC [widget: TextWidget] RETURNS [Rope.ROPE];
Returns current text in widget.
GetStyleSpec: PROC [widget: TextWidget] RETURNS [StyleSpec];
Returns current style of widget.
SetText: PROC [widget: TextWidget, text: Rope.ROPE, repaint: RepaintMode ¬ immediately];
Replaces text displayed with widget; This does not cause a size change.
SetStyleSpec: PROC [widget: TextWidget, style: StyleSpec, repaint: RepaintMode ¬ immediately];
Replaces style of displayed text.
SetStyleKey: PROC [widget: TextWidget, styleKey: ATOM ¬ NIL, repaint: RepaintMode ¬ immediately];
Replaces style of displayed text.
Functions which allow subclassing.
labelClass: READONLY XTk.Class;
GetTextProc: TYPE = PROC [widget: TextWidget] RETURNS [text: Rope.ROPE];
SetTextProc: TYPE = PROC [widget: TextWidget, text: Rope.ROPE, repaint: RepaintMode];
GetStyleSpecProc: TYPE = PROC [widget: TextWidget] RETURNS [style: StyleSpec];
SetStyleSpecProc: TYPE = PROC [widget: TextWidget, style: StyleSpec, repaint: RepaintMode];
SetStyleKeyProc: TYPE = PROC [widget: TextWidget, style: ATOM, repaint: RepaintMode];
LabelClassRec: TYPE = RECORD [
getText: GetTextProc,
setText: SetTextProc,
getStyleSpec: GetStyleSpecProc,
setStyleSpec: SetStyleSpecProc,
setStyleKey: SetStyleKeyProc
];
NewLabelClassPart: PROC [subClass: XTk.ImplementorClass] RETURNS [REF LabelClassRec];
Modifies subClass to use a new copy of the LabelClassRec. Returns a ref to the new copy which can be changed safely. (The new copy replaces the default original LabelClassRec used for further sub-sub-classes).
Generic procedures
Might be handy for other applications too.
GetDefaultFont: PROC [c: Xl.Connection] RETURNS [font: Xl.Font];
Get default font (from cache, or, using database query).
END.