Package Name: textedit
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions; use Interfaces.C.Extensions;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Types; use Types;
with Quickdraw; use Quickdraw;
package TextEdit is
--
-- File: TextEdit.h
--
-- Contains: TextEdit Interfaces.
--
-- Version: Technology: System 7.5
-- Package: Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
--
-- Copyright: © 1984-1995 by Apple Computer, Inc.
-- All rights reserved.
--
subtype WordBreakUPP is UniversalProcPtr;
subtype TEClickLoopUPP is UniversalProcPtr;
subtype HighHookUPP is UniversalProcPtr;
subtype CaretHookUPP is UniversalProcPtr;
type Short_Integer_Vec_16001 is array (0 .. 16000) of Short_Integer;
type TERec is
record
destRect : Rect;
viewRect : Rect;
selRect : Rect;
lineHeight : Short_Integer;
fontAscent : Short_Integer;
selPoint : Point;
selStart : Short_Integer;
selEnd : Short_Integer;
active : Short_Integer;
wordBreak : WordBreakUPP;
clickLoop : TEClickLoopUPP;
clickTime : Long_Integer;
clickLoc : Short_Integer;
caretTime : Long_Integer;
caretState : Short_Integer;
just : Short_Integer;
teLength : Short_Integer;
hText : Handle;
hDispatchRec : Long_Integer; -- added to replace recalBack & recalLines. it's a handle anyway
clikStuff : Short_Integer;
crOnly : Short_Integer;
txFont : Short_Integer;
txFace : Style; -- txFace is unpacked byte
filler : SInt8;
txMode : Short_Integer;
txSize : Short_Integer;
inPort : GrafPtr;
highHook : HighHookUPP;
caretHook : CaretHookUPP;
nLines : Short_Integer;
lineStarts : Short_Integer_Vec_16001;
end record;
type TEPtr is Access TERec;
type TEHandle is Access TEPtr;
type HighHookProcPtr is Access procedure
(r : access Rect;
pTE : in TEPtr);
type EOLHookProcPtr is access function
(theChar : in char;
pTE : in TEPtr;
hTE : in TEHandle)
return Boolean;
type CaretHookProcPtr is Access procedure
(r : access Rect;
pTE : in TEPtr);
type WidthHookProcPtr is access function
(textLen : in unsigned_short;
textOffset : in unsigned_short;
textBufferPtr : in Void_Ptr;
pTE : in TEPtr;
hTE : in TEHandle)
return unsigned_short;
type TextWidthHookProcPtr is access function
(textLen : in unsigned_short;
textOffset : in unsigned_short;
textBufferPtr : in Void_Ptr;
pTE : in TEPtr;
hTE : in TEHandle)
return unsigned_short;
type NWidthHookProcPtr is access function
(styleRunLen : in unsigned_short;
styleRunOffset : in unsigned_short;
slop : in Short_Integer;
direction : in Short_Integer;
textBufferPtr : in Void_Ptr;
lineStart : access Short_Integer;
pTE : in TEPtr;
hTE : in TEHandle)
return unsigned_short;
type DrawHookProcPtr is Access procedure
(textOffset : in unsigned_short;
drawLen : in unsigned_short;
textBufferPtr : in Void_Ptr;
pTE : in TEPtr;
hTE : in TEHandle);
type HitTestHookProcPtr is access function
(styleRunLen : in unsigned_short;
styleRunOffset : in unsigned_short;
slop : in unsigned_short;
textBufferPtr : in Void_Ptr;
pTE : in TEPtr;
hTE : in TEHandle;
pixelWidth : access unsigned_short;
charOffset : access unsigned_short;
pixelInChar : access Boolean)
return Boolean;
type TEFindWordProcPtr is Access procedure
(currentPos : in unsigned_short;
caller : in Short_Integer;
pTE : in TEPtr;
hTE : in TEHandle;
wordStart : access unsigned_short;
wordEnd : access unsigned_short);
type TERecalcProcPtr is Access procedure
(pTE : in TEPtr;
changeLength : in unsigned_short;
lineStart : access unsigned_short;
firstChar : access unsigned_short;
lastChar : access unsigned_short);
type TEDoTextProcPtr is Access procedure
(pTE : in TEPtr;
firstChar : in unsigned_short;
lastChar : in unsigned_short;
selector : in Short_Integer;
currentGrafPort : access GrafPtr;
charPosition : access Short_Integer);
subtype EOLHookUPP is UniversalProcPtr;
subtype WidthHookUPP is UniversalProcPtr;
subtype TextWidthHookUPP is UniversalProcPtr;
subtype NWidthHookUPP is UniversalProcPtr;
subtype DrawHookUPP is UniversalProcPtr;
subtype HitTestHookUPP is UniversalProcPtr;
subtype TEFindWordUPP is UniversalProcPtr;
subtype TERecalcUPP is UniversalProcPtr;
subtype TEDoTextUPP is UniversalProcPtr;
type char_Vec_32001 is array (0 .. 32000) of char;
subtype Chars is char_Vec_32001;
subtype CharsPtr is Chars_Ptr;
type CharsHandle is Access CharsPtr;
type StyleRun is
record
startChar : Short_Integer; -- starting character position
styleIndex : Short_Integer; -- index in style table
end record;
type StyleRun_Vec_8001 is array (0 .. 8000) of StyleRun;
type STElement is
record
stCount : Short_Integer; -- number of runs in this style
stHeight : Short_Integer; -- line height
stAscent : Short_Integer; -- font ascent
stFont : Short_Integer; -- font (family) number
stFace : Style; -- character Style
filler : SInt8; -- stFace is unpacked byte
stSize : Short_Integer; -- size in points
stColor : RGBColor; -- absolute (RGB) color
end record;
type STPtr is Access STElement;
type STHandle is Access STPtr;
type STElement_Vec_1777 is array (0 .. 1776) of STElement;
subtype TEStyleTable is STElement_Vec_1777;
type LHElement is
record
lhHeight : Short_Integer; -- maximum height in line
lhAscent : Short_Integer; -- maximum ascent in line
end record;
type LHPtr is Access LHElement;
type LHHandle is Access LHPtr;
type LHElement_Vec_8001 is array (0 .. 8000) of LHElement;
subtype LHTable is LHElement_Vec_8001;
type ScrpSTElement is
record
scrpStartChar : Long_Integer; -- starting character position
scrpHeight : Short_Integer; -- starting character position
scrpAscent : Short_Integer;
scrpFont : Short_Integer;
scrpFace : Style; -- unpacked byte
filler : SInt8; -- scrpFace is unpacked byte
scrpSize : Short_Integer;
scrpColor : RGBColor;
end record;
type ScrpSTElement_Vec_1601 is array (0 .. 1600) of ScrpSTElement;
subtype ScrpSTTable is ScrpSTElement_Vec_1601;
type StScrpRec is
record
scrpNStyles : Short_Integer; -- number of styles in scrap
scrpStyleTab : ScrpSTTable; -- table of styles for scrap
end record;
type StScrpPtr is Access StScrpRec;
type StScrpHandle is Access StScrpPtr;
type NullStRec is
record
teReserved : Long_Integer; -- reserved for future expansion
nullScrap : StScrpHandle; -- handle to scrap style table
end record;
type NullStPtr is Access NullStRec;
type NullStHandle is Access NullStPtr;
type TEStyleRec is
record
nRuns : Short_Integer; -- number of style runs
nStyles : Short_Integer; -- size of style table
styleTab : STHandle; -- handle to style table
lhTab : LHHandle; -- handle to line-height table
teRefCon : Long_Integer; -- reserved for application use
nullStyle : NullStHandle; -- Handle to style set at null selection
runs : StyleRun_Vec_8001; -- ARRAY [0..8000] OF StyleRun
end record;
type TEStylePtr is Access TEStyleRec;
type TEStyleHandle is Access TEStylePtr;
type TextStyle is
record
tsFont : Short_Integer; -- font (family) number
tsFace : Style; -- character Style
filler : SInt8; -- tsFace is unpacked byte
tsSize : Short_Integer; -- size in point
tsColor : RGBColor; -- absolute (RGB) color
end record;
type TextStylePtr is Access TextStyle;
type TextStyleHandle is Access TextStylePtr;
subtype TEIntHook is Short_Integer;
function TEScrapHandle
return Handle;
pragma Import (C, TEScrapHandle, "TEScrapHandle", "TEScrapHandle");
function TEGetScrapLength
return Long_Integer;
pragma Import (C, TEGetScrapLength, "TEGetScrapLength", "TEGetScrapLength");
procedure TEInit;
pragma Import (C, TEInit, "TEInit", "TEInit");
function TENew
(destRect : access Rect;
viewRect : access Rect)
return TEHandle;
pragma Import (C, TENew, "TENew", "TENew");
procedure TEDispose
(hTE : in TEHandle);
pragma Import (C, TEDispose, "TEDispose", "TEDispose");
procedure TESetText
(text : in Void_Ptr;
length : in Long_Integer;
hTE : in TEHandle);
pragma Import (C, TESetText, "TESetText", "TESetText");
function TEGetText
(hTE : in TEHandle)
return CharsHandle;
pragma Import (C, TEGetText, "TEGetText", "TEGetText");
procedure TEIdle
(hTE : in TEHandle);
pragma Import (C, TEIdle, "TEIdle", "TEIdle");
procedure TESetSelect
(selStart : in Long_Integer;
selEnd : in Long_Integer;
hTE : in TEHandle);
pragma Import (C, TESetSelect, "TESetSelect", "TESetSelect");
procedure TEActivate
(hTE : in TEHandle);
pragma Import (C, TEActivate, "TEActivate", "TEActivate");
procedure TEDeactivate
(hTE : in TEHandle);
pragma Import (C, TEDeactivate, "TEDeactivate", "TEDeactivate");
procedure TEKey
(key : in Short_Integer;
hTE : in TEHandle);
pragma Import (C, TEKey, "TEKey", "TEKey");
procedure TECut
(hTE : in TEHandle);
pragma Import (C, TECut, "TECut", "TECut");
procedure TECopy
(hTE : in TEHandle);
pragma Import (C, TECopy, "TECopy", "TECopy");
procedure TEPaste
(hTE : in TEHandle);
pragma Import (C, TEPaste, "TEPaste", "TEPaste");
procedure TEDelete
(hTE : in TEHandle);
pragma Import (C, TEDelete, "TEDelete", "TEDelete");
procedure TEInsert
(text : in Void_Ptr;
length : in Long_Integer;
hTE : in TEHandle);
pragma Import (C, TEInsert, "TEInsert", "TEInsert");
procedure TESetAlignment
(just : in Short_Integer;
hTE : in TEHandle);
pragma Import (C, TESetAlignment, "TESetAlignment", "TESetAlignment");
procedure TEUpdate
(rUpdate : access Rect;
hTE : in TEHandle);
pragma Import (C, TEUpdate, "TEUpdate", "TEUpdate");
procedure TETextBox
(text : in Void_Ptr;
length : in Long_Integer;
box : access Rect;
just : in Short_Integer);
pragma Import (C, TETextBox, "TETextBox", "TETextBox");
procedure TEScroll
(dh : in Short_Integer;
dv : in Short_Integer;
hTE : in TEHandle);
pragma Import (C, TEScroll, "TEScroll", "TEScroll");
procedure TESelView
(hTE : in TEHandle);
pragma Import (C, TESelView, "TESelView", "TESelView");
procedure TEPinScroll
(dh : in Short_Integer;
dv : in Short_Integer;
hTE : in TEHandle);
pragma Import (C, TEPinScroll, "TEPinScroll", "TEPinScroll");
procedure TEAutoView
(fAuto : in Boolean;
hTE : in TEHandle);
pragma Import (C, TEAutoView, "TEAutoView", "TEAutoView");
procedure TECalText
(hTE : in TEHandle);
pragma Import (C, TECalText, "TECalText", "TECalText");
function TEGetOffset
(pt : in Point;
hTE : in TEHandle)
return Short_Integer;
pragma Import (C, TEGetOffset, "TEGetOffset", "TEGetOffset");
function TEGetPoint
(offset : in Short_Integer;
hTE : in TEHandle)
return Point;
pragma Import (C, TEGetPoint, "TEGetPoint", "TEGetPoint");
procedure TEClick
(pt : in Point;
fExtend : in Boolean;
h : in TEHandle);
pragma Import (C, TEClick, "TEClick", "TEClick");
function TEStyleNew
(destRect : access Rect;
viewRect : access Rect)
return TEHandle;
pragma Import (C, TEStyleNew, "TEStyleNew", "TEStyleNew");
procedure TESetStyleHandle
(theHandle : in TEStyleHandle;
hTE : in TEHandle);
pragma Import (C, TESetStyleHandle, "TESetStyleHandle", "TESetStyleHandle");
function TEGetStyleHandle
(hTE : in TEHandle)
return TEStyleHandle;
pragma Import (C, TEGetStyleHandle, "TEGetStyleHandle", "TEGetStyleHandle");
procedure TEGetStyle
(offset : in Short_Integer;
theStyle : access TextStyle;
lineHeight : access Short_Integer;
fontAscent : access Short_Integer;
hTE : in TEHandle);
pragma Import (C, TEGetStyle, "TEGetStyle", "TEGetStyle");
procedure TEStylePaste
(hTE : in TEHandle);
pragma Import (C, TEStylePaste, "TEStylePaste", "TEStylePaste");
procedure TESetStyle
(mode : in Short_Integer;
newStyle : access TextStyle;
fRedraw : in Boolean;
hTE : in TEHandle);
pragma Import (C, TESetStyle, "TESetStyle", "TESetStyle");
procedure TEReplaceStyle
(mode : in Short_Integer;
oldStyle : access TextStyle;
newStyle : access TextStyle;
fRedraw : in Boolean;
hTE : in TEHandle);
pragma Import (C, TEReplaceStyle, "TEReplaceStyle", "TEReplaceStyle");
function TEGetStyleScrapHandle
(hTE : in TEHandle)
return StScrpHandle;
pragma Import (C, TEGetStyleScrapHandle, "TEGetStyleScrapHandle", "TEGetStyleScrapHandle");
procedure TEStyleInsert
(text : in Void_Ptr;
length : in Long_Integer;
hST : in StScrpHandle;
hTE : in TEHandle);
pragma Import (C, TEStyleInsert, "TEStyleInsert", "TEStyleInsert");
function TEGetHeight
(endLine : in Long_Integer;
startLine : in Long_Integer;
hTE : in TEHandle)
return Long_Integer;
pragma Import (C, TEGetHeight, "TEGetHeight", "TEGetHeight");
function TEContinuousStyle
(mode : access Short_Integer;
aStyle : access TextStyle;
hTE : in TEHandle)
return Boolean;
pragma Import (C, TEContinuousStyle, "TEContinuousStyle", "TEContinuousStyle");
procedure TEUseStyleScrap
(rangeStart : in Long_Integer;
rangeEnd : in Long_Integer;
newStyles : in StScrpHandle;
fRedraw : in Boolean;
hTE : in TEHandle);
pragma Import (C, TEUseStyleScrap, "TEUseStyleScrap", "TEUseStyleScrap");
procedure TECustomHook
(which : in TEIntHook;
addr : access UniversalProcPtr;
hTE : in TEHandle);
pragma Import (C, TECustomHook, "TECustomHook", "TECustomHook");
function TENumStyles
(rangeStart : in Long_Integer;
rangeEnd : in Long_Integer;
hTE : in TEHandle)
return Long_Integer;
pragma Import (C, TENumStyles, "TENumStyles", "TENumStyles");
function TEFeatureFlag
(feature : in Short_Integer;
action : in Short_Integer;
hTE : in TEHandle)
return Short_Integer;
pragma Import (C, TEFeatureFlag, "TEFeatureFlag", "TEFeatureFlag");
function TEGetHiliteRgn
(region : in RgnHandle;
hTE : in TEHandle)
return OSErr;
pragma Import (C, TEGetHiliteRgn, "TEGetHiliteRgn", "TEGetHiliteRgn");
procedure TESetScrapLength
(length : in Long_Integer);
pragma Import (C, TESetScrapLength, "TESetScrapLength", "TESetScrapLength");
function TEFromScrap
return OSErr;
pragma Import (C, TEFromScrap, "TEFromScrap", "TEFromScrap");
function TEToScrap
return OSErr;
pragma Import (C, TEToScrap, "TEToScrap", "TEToScrap");
procedure TESetClickLoop
(clikProc : in TEClickLoopUPP;
hTE : in TEHandle);
pragma Import (C, TESetClickLoop, "TESetClickLoop", "TESetClickLoop");
procedure TESetWordBreak
(wBrkProc : in WordBreakUPP;
hTE : in TEHandle);
pragma Import (C, TESetWordBreak, "TESetWordBreak", "TESetWordBreak");
end TextEdit;