Important: The information in this document is obsolete and should not be used for new development.
A function identified as deprecated has been superseded and may become unsupported in the future.
Disposes of a universal procedure pointer (UPP) to a caret-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeCaretHookUPP ( CaretHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a draw-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeDrawHookUPP ( DrawHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to an EOL-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeEOLHookUPP ( EOLHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a high-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeHighHookUPP ( HighHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a hit-test hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeHitTestHookUPP ( HitTestHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeNWidthHookUPP ( NWidthHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a click-loop callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTEClickLoopUPP ( TEClickLoopUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a do-text callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTEDoTextUPP ( TEDoTextUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a find-word callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTEFindWordUPP ( TEFindWordUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a recaluclation callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTERecalcUPP ( TERecalcUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a text-width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTextWidthHookUPP ( TextWidthHookUPP userUPP );
TextEdit.h
Disposes of a universal procedure pointer (UPP) to a post-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTSMTEPostUpdateUPP ( TSMTEPostUpdateUPP userUPP );
TSMTE.h
Disposes of a universal procedure pointer (UPP) to a pre-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeTSMTEPreUpdateUPP ( TSMTEPreUpdateUPP userUPP );
TSMTE.h
Disposes of a universal procedure pointer (UPP) to a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void DisposeWidthHookUPP ( WidthHookUPP userUPP );
TextEdit.h
Returns a TSM document ID for the specified dialog. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TSMDocumentID GetTSMTEDialogDocumentID ( DialogRef dialog );
See the Text Services Manager documentation for a description of the TSMDocumentID
data type.
TSMTE.h
Returns a handle to a TSM record for the specified dialog. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TSMTERecHandle GetTSMTEDialogTSMTERecHandle ( DialogRef dialog );
See the description of the TSMTERecHandle
data type.
TSMTE.h
Calls a caret-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeCaretHookUPP ( const Rect *r, TEPtr pTE, CaretHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a draw-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeDrawHookUPP ( unsigned short textOffset, unsigned short drawLen, void *textBufferPtr, TEPtr pTE, TEHandle hTE, DrawHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls an EOL-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Boolean InvokeEOLHookUPP ( char theChar, TEPtr pTE, TEHandle hTE, EOLHookUPP userUPP );
See the Mac Types documentation for a description of the Boolean
data type.
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a high-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeHighHookUPP ( const Rect *r, TEPtr pTE, HighHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a hit-test hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Boolean InvokeHitTestHookUPP ( unsigned short styleRunLen, unsigned short styleRunOffset, unsigned short slop, void *textBufferPtr, TEPtr pTE, TEHandle hTE, unsigned short *pixelWidth, unsigned short *charOffset, Boolean *pixelInChar, HitTestHookUPP userUPP );
See the Mac Types documentation for a description of the Boolean
data type.
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
unsigned short InvokeNWidthHookUPP ( unsigned short styleRunLen, unsigned short styleRunOffset, short slop, short direction, void *textBufferPtr, short *lineStart, TEPtr pTE, TEHandle hTE, NWidthHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a click-loop callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Boolean InvokeTEClickLoopUPP ( TEPtr pTE, TEClickLoopUPP userUPP );
See the Mac Types documentation for a description of the Boolean
data type.
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a do-text callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeTEDoTextUPP ( TEPtr pTE, unsigned short firstChar, unsigned short lastChar, short selector, GrafPtr *currentGrafPort, short *charPosition, TEDoTextUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a find-word callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeTEFindWordUPP ( unsigned short currentPos, short caller, TEPtr pTE, TEHandle hTE, unsigned short *wordStart, unsigned short *wordEnd, TEFindWordUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a recalculation callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeTERecalcUPP ( TEPtr pTE, unsigned short changeLength, unsigned short *lineStart, unsigned short *firstChar, unsigned short *lastChar, TERecalcUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a text-width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
unsigned short InvokeTextWidthHookUPP ( unsigned short textLen, unsigned short textOffset, void *textBufferPtr, TEPtr pTE, TEHandle hTE, TextWidthHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Calls a post-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeTSMTEPostUpdateUPP ( TEHandle textH, long fixLen, long inputAreaStart, long inputAreaEnd, long pinStart, long pinEnd, long refCon, TSMTEPostUpdateUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TSMTE.h
Calls a pre-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void InvokeTSMTEPreUpdateUPP ( TEHandle textH, long refCon, TSMTEPreUpdateUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TSMTE.h
Calls a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
unsigned short InvokeWidthHookUPP ( unsigned short textLen, unsigned short textOffset, void *textBufferPtr, TEPtr pTE, TEHandle hTE, WidthHookUPP userUPP );
You should not need to use this function, as the system invokes your callback for you.
TextEdit.h
Checks to see if the specified dialog is a TSMTE dialog. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Boolean IsTSMTEDialog ( DialogRef dialog );
See the Mac Types documentation for a description of the Boolean
data type.
TSMTE.h
Creates a new universal procedure pointer (UPP) to a caret-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
CaretHookUPP NewCaretHookUPP ( CaretHookProcPtr userRoutine );
See the description of the CaretHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a draw-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
DrawHookUPP NewDrawHookUPP ( DrawHookProcPtr userRoutine );
See the description of the DrawHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to an EOL-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
EOLHookUPP NewEOLHookUPP ( EOLHookProcPtr userRoutine );
See the description of the EOLHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a high-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
HighHookUPP NewHighHookUPP ( HighHookProcPtr userRoutine );
See the description of the HighHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a hit-test hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
HitTestHookUPP NewHitTestHookUPP ( HitTestHookProcPtr userRoutine );
See the description of the HitTestHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
NWidthHookUPP NewNWidthHookUPP ( NWidthHookProcPtr userRoutine );
See the description of the NWidthHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a click-loop callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEClickLoopUPP NewTEClickLoopUPP ( TEClickLoopProcPtr userRoutine );
See the description of the TEClickLoopUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a do-text callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEDoTextUPP NewTEDoTextUPP ( TEDoTextProcPtr userRoutine );
See the description of the TEDoTextUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a find-word callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEFindWordUPP NewTEFindWordUPP ( TEFindWordProcPtr userRoutine );
See TEFindWordUPP
for a description of the TEFindWordUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a recalculation callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TERecalcUPP NewTERecalcUPP ( TERecalcProcPtr userRoutine );
See the description of the TERecalcUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a text-width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TextWidthHookUPP NewTextWidthHookUPP ( TextWidthHookProcPtr userRoutine );
See the description of the TextWidthHookUPP
data type.
TextEdit.h
Creates a new universal procedure pointer (UPP) to a post-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TSMTEPostUpdateUPP NewTSMTEPostUpdateUPP ( TSMTEPostUpdateProcPtr userRoutine );
See TSMTEPostUpdateUPP
for a description of the TSMTEPostUpdateUPP
data type.
TSMTE.h
Creates a new universal procedure pointer (UPP) to a pre-update callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TSMTEPreUpdateUPP NewTSMTEPreUpdateUPP ( TSMTEPreUpdateProcPtr userRoutine );
See the description of the TSMTEPreUpdateUPP
data type.
TSMTE.h
Creates a new universal procedure pointer (UPP) to a width-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
WidthHookUPP NewWidthHookUPP ( WidthHookProcPtr userRoutine );
See the description of the WidthHookUPP
data type.
TextEdit.h
Sets the document ID for the specified dialog. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void SetTSMTEDialogDocumentID ( DialogRef dialog, TSMDocumentID documentID );
TSMTE.h
Sets a handle to a TSMTE record for the specified dialog. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void SetTSMTEDialogTSMTERecHandle ( DialogRef dialog, TSMTERecHandle tsmteRecHandle );
TSMTE.h
Activates the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEActivate ( TEHandle hTE );
A handle to the specified edit structure.
When your application receives notification of an activate event, it can call the TEActivate
function, which activates an edit structure and highlights the selection range. If the selection range is an insertion point, TEActivate
simply displays a caret there. Call this function every time the Event Manager function WaitNextEvent
reports that the window containing the edit structure has become active.
If you do not call TEActivate
before you call TEClick
, TEIdle
, or TESetSelect
, the selection range is not highlighted, or, if the selection range is set to an insertion point, a caret is not displayed at the insertion point. However, if you have turned on outline highlighting through the TEFeatureFlag
function for the edit structure, the text of the selection range is framed or a dimmed or an unblinking caret is displayed at the insertion point.
TextEdit.h
Enables and disables automatic scrolling of the text in the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEAutoView ( Boolean fAuto, TEHandle hTE );
A flag indicating whether to enable or disable automatic scrolling. A value of TRUE
enables automatic scrolling; a value of FALSE
disables automatic scrolling.
A handle to the edit structure for which automatic scrolling is to be enabled or disabled.
The TEAutoView
function does not actually scroll the text automatically: TESelView
does. However, when fAuto
is set to FALSE
, a call to TESelView
has no effect.
If there is a scroll bar associated with the edit structure, your application must manage scrolling of it. You can replace the default click loop function, which scrolls the text only, with a customized version that also updates the scroll bar.
You can also enable or disable automatic scrolling for an edit structure through the teFAutoScroll
feature of the TEFeatureFlag
function. For more information, see TEFeatureFlag
.
TextEdit.h
Recalculates the beginnings of all lines of text in the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TECalText ( TEHandle hTE );
A handle to the edit structure whose text lines are to be recalculated.
The TECalText
function updates elements of the lineStarts
array in an edit structure. Call TECalText
if you’ve changed the destination rectangle, the hText
field, or any other property of the edit structure that pertains to line breaks and the number of characters per line—for example, font, size, style, and so on.
TextEdit.h
Controls placement and highlighting of the selection range as determined by mouse events. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEClick ( Point pt, Boolean fExtend, TEHandle h );
The mouse location in local coordinates at the time the mouse button was pressed, obtainable from the event structure (in global coordinates).
A flag denoting the state of the Shift key at the time of the click as indicated by the Event Manager. If the Shift key was held down at the time of the click to extend the selection, pass a value of TRUE
.
A handle to the edit structure whose text is displayed in the view rectangle where the click occurred.
Call TEClick
whenever a mouse-down event occurs in the view rectangle of the edit structure and the window associated with that edit structure is active. The TEClick
function keeps control until the mouse button is released. Use the QuickDraw function GlobalToLocal
to convert the global coordinates of the mouse location given in the event structure to the local coordinate system for pt
.
The TEClick
function removes highlighting of the old selection range unless the selection range is being extended. If the mouse moves, meaning that a drag is occurring, TEClick
expands or shortens the selection range accordingly a character at a time. In the case of a double-click, the word where the cursor is positioned becomes the selection range.
TextEdit.h
Determines whether a given character attribute is continuous over the current selection range. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Boolean TEContinuousStyle ( short *mode, TextStyle *aStyle, TEHandle hTE );
On input, a pointer to a selector specifying the attributes to be checked. On output, mode
identifies only those attributes determined to be continuous over the selection range. Possible values for the mode
parameter are defined in “Text Styling Constants.”
On input, a pointer to a text style structure. On output, this structure contains the values for the mode
attributes determined to be continuous over the selection.
A handle to the edit structure containing the selected text whose attributes are to be checked. If the value of hTE
is a handle to a monostyled edit structure, TEContinuousStyle
returns the set of character attributes that are consistent for the entire structure.
TRUE
if all of the attributes to be checked are continuous; FALSE
if none or some are continuous. See the Mac Types documentation for a description of the Boolean
data type.
This function does not modify the text selection. If the current selection range is an insertion point, TEContinuousStyle
first checks the null scrap. If the null scrap contains character attributes, then they are used based on the value of the mode
parameter. Otherwise, if the null scrap is empty, TEContinuousStyle
returns the attributes of the character preceding the insertion point. The TEContinuousStyle
function always returns TRUE
in this case, and each field of the text style structure is set if the corresponding bit in the mode
parameter is set.
Note that fields in the text style structure specified by aStyle
are only valid if the corresponding bits are set in the mode
variable.
How the tsFace
field of the aStyle
structure is used requires some consideration. For example, if TEContinuousStyle
returns a mode
parameter that contains doFace
and the text style structure tsFace
field is bold, it means that the selected text is all bold, but may contain other text styles, such as italic, as well. Italic does not apply to all of the selected text, or it would have been included in the tsFace
field. If the tsFace
field is an empty set, then all of the selected text is plain.
TextEdit.h
Copies the text selection range from the edit structure, leaving the selection range intact. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TECopy ( TEHandle hTE );
A handle to the edit structure containing the text to be copied.
The TECopy
function copies the text to the private scrap. For text of a monostyled edit structure, the text is written to the private scrap only. For text of a multistyled edit structure, the text is written to the TextEdit private scrap, the character attribute information is written to the TextEdit style scrap, and both are written to the Scrap Manager’s desk scrap. Anything previously in the private scrap is deleted before the copied text is written to it.
For both multistyled and monostyled text, if the selection range is an insertion point, TECopy
empties the TextEdit private scrap. When the selection range is an insertion point and the text is multistyled, TECopy
has no effect on the null scrap, the style scrap, or the Scrap Manager’s desk scrap.
TextEdit.h
Replaces a default TextEdit hook function with a customized function and returns the address of the replaced function. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TECustomHook ( TEIntHook which, UniversalProcPtr *addr, TEHandle hTE );
The hook whose default function is to be replaced.
On input, the address of your customized function.
On output, the addr
parameter contains the address of the function that was previously installed in the field identified by the which
parameter. This address is returned so that you can daisy-chain functions.
A handle to the edit structure to be modified.
The TECustomHook
function lets you alter the behavior of TextEdit to better suit your application’s requirements and those of the script systems installed. If you replace a default hook function with a customized version that you write in a high-level language, such as Pascal or C, you need to provide assembly-language glue code that utilizes the registers for your high-level language function.
The end-of-line hook, width measurement hook, new width measurement hook, text width measurement hook, draw hook, and hit test hook fields are hook fields in the TextEdit dispatch structure. The which
parameter identifies the hook whose default function is to be replaced. You use the constants described in “Text Custom Hook Constants” to specify a value for this parameter.
Certain precautions are critical in replacing default functions. Before placing the address of your function in the TextEdit dispatch structure, strip the addresses, using the Operating System Utilities StripAddress
function, to guarantee that your application is 32-bit clean.
Before replacing a TextEdit function with a customized one, determine whether more than one script system is installed, and if so, ensure that your customized function accommodates all of the installed script systems. This avoids the problem of your customized function producing results that are incompatible with the Script Manager.
TextEdit.h
Removes the current selection range from the text of the designated edit structure, redrawing the text as necessary. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TECut ( TEHandle hTE );
A handle to the edit structure containing the text to be cut.
For monostyled text, the TECut
function writes the cut text to the private scrap.
For multistyled text, TECut
writes the cut text to the private scrap and its character attributes to the style scrap it also writes both to the Scrap Manager’s desk scrap. For multistyled text, the TECut
function removes the character attributes from the style structure’s style table when the text is cut.
For both monostyled and multistyled text, if the selection range is an insertion point, TextEdit deletes everything from the private scrap. When the selection range is an insertion point and the text is multistyled, TECut
has no effect on the style scrap or the Scrap Manager’s desk scrap.
TextEdit.h
Deactivates the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEDeactivate ( TEHandle hTE );
A handle to the specified edit structure.
When the activate event flag is set to deactivate the window, your application can call the TEDeactivate
function, which changes an edit structure’s status from active to inactive and removes the selection range highlighting or the caret.
However, if you turned on outline highlighting through the TEFeatureFlag
function for the edit structure, the text of the selection range is framed or a dimmed or an unblinking caret is displayed at the insertion point when the structure is deactivated.
Call this function every time the Event Manager function WaitNextEvent
reports that the window containing the edit structure has become inactive.
TextEdit.h
Removes the selected range of text from the designated edit structure, redrawing the remaining text as necessary. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEDelete ( TEHandle hTE );
A handle to the edit structure containing the text to be deleted.
When the TEDelete
function deletes a selected range of text, it does not transfer the text to either the private scrap or the Scrap Manager’s desk scrap.
For multistyled structures, when you use TEDelete
to delete a selected range of text, the associated character attributes are saved in the null scrap to be applied to characters entered after the text is deleted. When the user clicks in some other area of the text, the character attributes are removed from the null scrap. You can use TEDelete
to implement the Clear command. The TEDelete
function recalculates line starts and line heights.
TextEdit.h
Removes a specified edit structure and releases all memory associated with it. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEDispose ( TEHandle hTE );
A handle to the edit structure for which the allocated memory should be released.
Call the TEDispose
function only when you’re completely through with an edit structure.
Note that if your program retains a handle to text associated with the edit structure that you are destroying with TEDispose
, the handle becomes invalid because the TEDispose
function disposes of it, as well as the dispatch structure handle. If the structure is multistyled, TEDispose
also disposes all of the style-related handles: STHandle
, LHHandle
, STScrpHandle
, nullSTHandle
, and TEStyleHandle
.
To continue to refer to the text after you’ve destroyed the edit structure, you need to make a copy of the handle in the hText
field of the edit structure using the Operating System Utilities HandToHand
function before you call TEDispose
.
In addition to disposing of the edit structure, the edit structure handle, and the dispatch structure handle, the TEDispose
function destroys the null scrap associated with the edit structure and releases the memory used for it.
TextEdit.h
Turns a specified feature on or off or returns the current status of that feature. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
short TEFeatureFlag ( short feature, short action, TEHandle hTE );
The feature for which the action is to be performed. See “Text Feature Constants” for a description of the available values.
A selector stipulating that the feature, specified by the feature
parameter, is to be turned on or off, or that the current status of the feature is to be returned. See “Text Feature Action Constants” for a description of the available values.
A handle to the edit structure for which the action should be performed.
The status of the specified feature (if the selector is set to teBitTest
).
You can use the TEFeatureFlag
function to check the status of additional TextEdit features—automatic scrolling, outline highlighting, and text buffering—and to enable or disable the feature. You can also use this function to disable inline input in a particular edit structure and to enable several features that have been provided so that inline input works correctly with TextEdit.
TextEdit.h
Copies the contents of the desk scrap to the TextEdit private scrap. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
OSErr TEFromScrap ( void );
A result code. See “TextEdit Result Codes.”
You use this function to move monostyled text across applications or between an application and a desk accessory.
TextEdit.h
Obtains a universal procedure pointer to your do-text-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEDoTextUPP TEGetDoTextHook ( void );
See the description of the TEDoTextUPP
data type.
TextEdit.h
Obtains a universal procedure pointer to your set-find-word-hook callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEFindWordUPP TEGetFindWordHook ( void );
See the description of the TEFindWordUPP
data type.
TextEdit.h
Returns the total height of all of the lines in the text between and including the specified starting and ending lines. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
long TEGetHeight ( long endLine, long startLine, TEHandle hTE );
The number of the last line of text whose height is to be included in the total height. You can specify a value that is greater than or equal to 1 for this parameter.
The number of the first line of text whose height is to be included in the total height. You can specify a value that is greater than or equal to 1 for this parameter.
A handle to the edit structure containing the lines of text whose height is to be returned.
The total height of all of the designated text lines.
For monostyled text, the TEGetHeight
function uses the value of the edit structure’s lineHeight
field. For multistyled text, it uses the line height element (LHElement
) of the line height table (LHTable
). Note that TEGetHeight
does not take into account the height of any blank lines at the end of the text. You need to consider this when scrolling text.
TextEdit.h
Obtains the highlight region for the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
OSErr TEGetHiliteRgn ( RgnHandle region, TEHandle hTE );
A result code. See “TextEdit Result Codes.”
TextEdit.h
Finds the byte offset of a character in an edit structure’s text that corresponds to the specified point. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
short TEGetOffset ( Point pt, TEHandle hTE );
A point in the displayed text of the specified edit structure.
A handle to the edit structure containing the text.
The byte offset of the character at the specified point. In the case of a 2-byte character, the function returns the byte offset of the first byte.
The TEGetOffset
function works for both monostyled and multistyled edit structures.
TextEdit.h
Determines the point that corresponds to the specified byte offset of a character and returns the coordinates of that point. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Point TEGetPoint ( short offset, TEHandle hTE );
A byte offset into the text buffer of an edit structure.
A handle to the edit structure containing the text.
The coordinates of the point that corresponds to the specified byte offset. The TEGetPoint
function returns a valid result even when the edit structure does not contain any text. The point returned is based on the values in the structure’s destination rectangle.
In the case of an offset being equal to a line end, which is also the start of the next line, TEGetPoint
returns a point corresponding to the line start of the next line. In the case of a dual caret, the primary caret position, the one corresponding to the primary line direction, is returned.
See the Mac Types documentation for a description of the Point
data type.
The line height, taken either from the lineHeight
field for a monostyled edit structure or from the line-height array, LHElement
, for a multistyled edit structure, is also used to determine the vertical component. Both the text direction and the primary line direction are used to determine the horizontal component.
The TEGetPoint
function works for both monostyled and multistyled edit structures.
TextEdit.h
Obtains a universal procedure pointer to your recalculation callback. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TERecalcUPP TEGetRecalcHook ( void );
See the description of the TERecalcUPP
data type.
TextEdit.h
Returns a handle to the TextEdit private scrap. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Handle TEGetScrapHandle ( void );
See the Mac Types documentation for a description of the Handle
data type.
TextEdit.h
Returns the size of the TextEdit private scrap, in bytes. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
long TEGetScrapLength ( void );
The size of the TextEdit private scrap, in bytes.
TextEdit.h
Gets character attributes for the specified text. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEGetStyle ( short offset, TextStyle *theStyle, short *lineHeight, short *fontAscent, TEHandle hTE );
The offset to the text whose character attributes you want to obtain.
On output, points to a structure of type TextStyle that contains the character attributes for the current selection range.
A pointer to a value that specifies the line height.
A pointer to a value that specifies the font ascent.
A handle to the multistyled edit structure containing the text whose character attributes you want to obtain.
TextEdit.h
Returns the style handle stored in the designated edit structure’s txFont
and txFace
fields. The style handle points to the associated style structure, not to a copy of it. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEStyleHandle TEGetStyleHandle ( TEHandle hTE );
A handle to the multistyled edit structure containing the style handle to be returned.
A handle to the style structure contained in the specified edit structure (of type TEStyleRec
). Because only multistyled edit structures have style structures, TEGetStyleHandle
returns NULL
when used with a monostyled edit structure. See the description of the TEStyleHandle
data type.
To ensure future compatibility, your application should always use this function rather than manipulate the fields of the edit structure directly.
TextEdit.h
Creates a style scrap structure, copies the character attributes associated with the current selection range into it, and returns a handle to it. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
StScrpHandle TEGetStyleScrapHandle ( TEHandle hTE );
The handle to the edit structure containing the text selection range whose character attributes are to be copied.
A handle to the created style scrap structure, or NULL
if called with a handle to a monostyled structure. See the description of the StScrpHandle
data type.
The TEGetStyleScrapHandle
function creates a style scrap structure of type StScrpRec
and copies the character attributes associated with the current selection range of the designated edit structure into it. If the current selection range is an insertion point, TEGetStyleScrapHandle
first checks the null scrap. If the null scrap contains character attributes, they are written to the newly created style scrap structure. If the null scrap is empty, the attributes associated with the character preceding the insertion point are copied to the style scrap structure.
The TEGetStyleScrapHandle
function has no impact on the Scrap Manager’s desk scrap.
TextEdit.h
Returns a handle to the text of the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
CharsHandle TEGetText ( TEHandle hTE );
A handle to the edit structure containing the text whose handle you want returned. You pass this handle as an input parameter.
A handle to the text contained in the specified edit structure. See page 82 for a description of the CharsHandle
data type.
Given an edit structure that contains text, you can use the TEGetText
function to get a handle to the text itself. The TEGetText
function doesn’t make a copy of the text. Rather, it returns the handle to the text which is stored as a packed array of characters. (This handle belongs to TextEdit your application must not destroy it.) The teLength
field of the edit structure contains the length of the text whose handle is returned.
The handle of type CharsHandle
that is returned by TEGetText
corresponds to the hText
field of the TERec
structure.
TextEdit.h
When called repeatedly, displays a blinking caret at the insertion point, if any exists, in the text of the specified edit structure of an active window. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEIdle ( TEHandle hTE );
A handle to the edit structure.
You need to call TEIdle
only when the window containing the text is active; the caret is blinked only then. TextEdit observes a minimum blink interval, initially set to 32 ticks. No matter how often you call TEIdle
, the time between blinks is never less than the minimum interval. (The user can adjust the minimum interval setting with the General Controls control panel.)
To maintain a constant frequency of blinking, you need to call TEIdle
at least once each time through your main event loop. Call it more than once if your application does an unusually large amount of processing each time through the loop.
Call the Event Manager’s GetCaretTime
function to get the blink rate.
TextEdit.h
Inserts the specified text immediately before the selection range or the insertion point in the text of the designated edit structure, redrawing the text as necessary. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEInsert ( const void *text, long length, TEHandle hTE );
A pointer to the text to be inserted.
The number of characters to be inserted.
A handle to the edit structure containing the text buffer into which the new text is to be inserted.
When you call the TEInsert
function and a range of text is selected, TEInsert
doesn’t affect the selection range. The TEInsert
function does not check for a 32 KB limit, so your application must ensure that the inserted text does not exceed this text size limit of 32 KB. The TEInsert
function recalculates line starts and line heights to adjust for the inserted text.
TextEdit.h
Replaces the selection range in the text of the specified edit structure with the input character and positions the insertion point just past the inserted character. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEKey ( CharParameter key, TEHandle hTE );
The input character.
A handle to the edit structure in whose text the character is to be entered.
The TextEdit function TEKey
allows you to handle key-down events and enter text input through the keyboard. If the selection range is an insertion point, TEKey
inserts the character. (Two-byte characters are passed one byte at a time.)
If the key
parameter contains a backspace character, the selection range or the character immediately before the insertion point is deleted. When the primary line direction is right-to-left, the character to the right of the insertion point is deleted. When the primary line direction is left-to-right, the character to the left of the insertion point is deleted.
When the user deletes text up to the beginning of a set of character attributes, TEKey
saves the attributes in the null scrap’s style scrap structure. The attributes are saved temporarily to be applied to characters inserted after the deletion. As soon as the user clicks in another area of the text, TEKey
removes the attributes. TEKey
redraws the text as necessary.
Call TEKey
every time the Event Manager function WaitNextEvent
reports a keyboard event that your application determines should be handled by TextEdit.
Because TEKey
inserts every character passed in the key
parameter, your application must filter all characters which aren’t actual text, such as keys typed in conjunction with the Command key.
TextEdit.h
Creates and initializes a monostyled edit structure and allocates a handle to it. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEHandle TENew ( const Rect *destRect, const Rect *viewRect );
A pointer to the destination rectangle for the new edit structure, specified in the local coordinates of the current graphics port. This is the area in which text is laid out.
A pointer to the view, or visible, rectangle for the new edit structure, specified in the local coordinates of the current graphics port. This is the area of the window in which text is actually displayed.
A handle to the newly created edit structure. Your application needs to store the handle to the edit structure that is returned; many functions require it as an input parameter. See the description of the TEHandle
data type.
A monostyled edit structure is one in which all text is restricted to a single font, size, and style. Use the TENew
function when the text is to be rendered in attributes that are consistent from character to character. Otherwise, use the TEStyleNew
function.
Call TENew
once for every edit structure you want allocated. Your application should store the handle to the edit structure that is returned; many functions require it as an input parameter. The edit structure assumes the drawing environment of the graphics port.
If your application contains more than one window where text editing occurs, you need to create an edit structure for each window.
Before this function is called, the window must be in the current graphics port.
TextEdit.h
Returns the number of character attribute changes contained in the specified range, counting one for the start of the range. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
long TENumStyles ( long rangeStart, long rangeEnd, TEHandle hTE );
The beginning of the range of text for which the number of style runs (sets of character attributes) or changes is counted and returned.
The end of the range of text for which the number of style runs (sets of character attributes) or changes is counted and returned.
A handle to the edit structure containing the range of text.
The number of character attribute changes contained in the specified range. This does not necessarily represent the number of unique sets of attributes for the range, because some sets of attributes may be repeated. For monostyled edit structures, TENumStyles
always returns 1.
TextEdit.h
Replaces the edit structure’s selected text with the contents of the private scrap and leaves an insertion point after the inserted text. If the selection range is an insertion point, TEPaste
inserts the contents of the private scrap there. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEPaste ( TEHandle hTE );
A handle to the edit structure into which the text is to be pasted.
When you call TEPaste
, after it pastes the text from the private scrap, it redraws all of the text as necessary. If the private scrap is empty, TEPaste
deletes the selection range. If you call TEPaste
for a multistyled edit structure, it pastes only the text in the private scrap. In this case, TEPaste
ignores any associated character attribute information stored in the style scrap; instead, it applies the character attributes of the first character of the selection range being replaced to the text. If the selection range is an insertion point, TEPaste
applies the character attributes of the character preceding the insertion point.
TextEdit.h
Scrolls the text within the view rectangle of the specified edit structure by the designated number of pixels. Scrolling stops when the last line of text is scrolled into view. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEPinScroll ( short dh, short dv, TEHandle hTE );
The distance in pixels that the text is to be scrolled horizontally. A positive value moves the text to the right; a negative value moves the text to the left.
The distance in pixels that the text is to be scrolled vertically. A positive value moves the text down; a negative value moves the text up.
A handle to the edit structure whose text is to be scrolled.
The TEPinScroll
function updates the text on the screen automatically to reflect the new scroll position, as does the TEScroll
function. The destination rectangle is offset by the amount scrolled. When the edit structure is longer than the text it contains, TEPinScroll
displays up to the last line of text inclusive, and not beyond it.
TextEdit.h
Replaces any character attributes in the current selection range that match the specified existing character attributes with the specified new character attributes. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEReplaceStyle ( short mode, const TextStyle *oldStyle, const TextStyle *newStyle, Boolean fRedraw, TEHandle hTE );
A selector that specifies which attributes to replace. It corresponds to any additive combination of the “Text Styling Constants” for font, character style, type size, color, and so forth.
A pointer to a text style structure that specifies the current character attributes to search for in the selected text.
A pointer to a text style structure that specifies the new attributes to be set. This structure contains the character attributes to be applied to the current selection range based on the value of mode
.
A flag that specifies whether or not TextEdit should immediately redraw the text to reflect the attribute changes. A value of FALSE
delays redrawing until another event forces the update. A value of TRUE
causes the text to be redrawn immediately using the new character attributes.
A handle to the multistyled edit structure containing the text selection whose character attributes are to be changed.
The TEReplaceStyle
function replaces any attribute in the current selection range that matches the attribute specified by oldStyle
with that given by newStyle
. Only the character attributes specified by mode
are affected.
Attribute changes are made directly to the style elements (STElement
) within the style table itself (TEStyleTable
). If you specify the value doAll
for the mode
parameter, newStyle
replaces oldStyle
outright. The TEReplaceStyle
function has no effect on a monostyled edit structure.
TextEdit.h
Returns a handle to the TextEdit private scrap. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
Handle TEScrapHandle ( void );
A handle to the TextEdit private scrap. See the Mac Types documentation for a description of the Handle
data type.
TextEdit.h
Scrolls the text within the view rectangle of the specified edit structure by the designated number of pixels. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEScroll ( short dh, short dv, TEHandle hTE );
The distance in pixels that the text is to be scrolled horizontally. A positive value moves the text to the right; a negative value moves the text to the left.
The distance in pixels that the text is to be scrolled vertically. A positive value moves the text down; a negative value moves the text up.
A handle to the edit structure whose text is to be scrolled.
The TEScroll
function updates the text on the screen automatically to reflect the new scroll position. The destination rectangle is offset by the amount scrolled. The TEScroll
and TEPinScroll
functions behave the same, except that TEPinScroll
stops scrolling when the last line of text is scrolled into view.
TextEdit.h
Ensures, once automatic scrolling has been enabled by a call to the TEAutoView
function or through the TEFeatureFlag
function, that the selection range is visible, scrolling it into the view rectangle if necessary. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESelView ( TEHandle hTE );
A handle to the edit structure containing the text selection range.
The top left part of the selection range is scrolled into view. If the text is displayed in a rectangle that is not high enough, automatic scrolling can cause text to appear to flicker. If automatic scrolling is disabled, TESelView
has no effect. For more information, see TEFeatureFlag
.
TextEdit.h
Sets the alignment of the specified text in an edit structure so that it is centered, right aligned, or left aligned, or aligned according to the line direction. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetAlignment ( short just, TEHandle hTE );
The alignment for the specified text.The default value of the just
field of the edit structure is teFlushDefault
. This means that text alignment is based on the primary line direction which is set by default according to the system script.
For a description of the values you can use in this parameter, see “Text Alignment Constants.”
A handle to the edit structure containing the text.
For languages that are read from right to left, text is right aligned by default. For languages that are read from left to right, text is left aligned by default. If you change the alignment, call the Window Manager function InvalRect
after TESetAlignment
to redraw the text with the new alignment.
TextEdit does not support justified alignment. To draw justified text, use the QuickDraw Text functions.
TextEdit.h
Installs the address of the application-supplied click loop function in the clikLoop
field of the edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetClickLoop ( TEClickLoopUPP clikProc, TEHandle hTE );
A universal procedure pointer to the customized click loop function.
A handle to the edit structure whose clikLoop
field is to be modified.
The TESetClickLoop
function lets you replace the default click loop function. The TEClick
function repeatedly calls the function that the click loop field points to as long as the user holds down the mouse button within the text of the view rectangle. The default click loop function scrolls only the text. However, you can provide a customized click loop function that scrolls the text and the scroll bars in tandem.
If automatic scrolling is enabled, the default click loop function checks to see if the mouse has been dragged out of the view rectangle; if it has, the function scrolls the text using TEPinScroll
. The amount by which TEPinScroll
scrolls the text vertically is determined by the lineHeight
field of the edit structure for monostyled text and the LHTable
for multistyled text.
TextEdit.h
Sets your do-text-hook callback to be used by TextEdit. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetDoTextHook ( TEDoTextUPP value );
TextEdit.h
Sets your set-find-word-hook callback to be used by TextEdit. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetFindWordHook ( TEFindWordUPP value );
TextEdit.h
Sets your recalculation callback to be used by TextEdit. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetRecalcHook ( TERecalcUPP value );
TextEdit.h
Sets a handle to the TextEdit private scrap. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetScrapHandle ( Handle value );
TextEdit.h
Sets the size of the TextEdit private scrap to the specified number of bytes. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetScrapLength ( long length );
The size of the private scrap, in bytes.
TextEdit.h
Sets the selection range (or denotes the insertion point) within the text of the specified edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetSelect ( long selStart, long selEnd, TEHandle hTE );
The byte offset at the start of the text selection range. The selStart
field can range from 0 to 32767.
If selStart
equals selEnd
, the new selection range is an insertion point, and a caret is displayed. If selEnd
is anywhere beyond the last character of the text, TESetSelect
uses the first position past the last character.
The byte offset at the end of the text selection range. The selEnd
field can range from 0 to 32767.
A handle to the edit structure.
The TESetSelect
function removes highlighting of the old selection range and highlights the new one.
When only the Roman script system is used, the selection range is always displayed and highlighted as a continuous range of text. However, when one or more script systems requiring mixed-directional display of text are installed, a continuous sequence of characters in memory may appear as a discontinuous selection when displayed.
TextEdit.h
Sets new character attributes, in the specified edit structure, for the current selection range. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetStyle ( short mode, const TextStyle *newStyle, Boolean fRedraw, TEHandle hTE );
A selector that specifies which character attributes are to be changed. The value for mode
can be any additive combination of the mode
constants for font, style, type size, color, and so forth. It corresponds to any additive combination of the “Text Styling Constants” for font, character style, type size, color, and so forth.
The value of mode
specifies which existing character attributes are to be changed to the new character attributes specified by newStyle
. If doToggle
is specified along with doFace
and if an attribute specified in the given newStyle
parameter exists across the entire selected range of text, then TESetStyle
removes that attribute. Otherwise, if the attribute doesn’t exist across the entire selection range, all of the selected text is set to include that character attribute.
A pointer to a structure of type TextStyle
that specifies the new attributes to be set. This structure contains the character attributes to be applied to the current selection range based on the value of mode
.
A flag that specifies whether or not TextEdit should immediately redraw the affected text to reflect the new character attribute changes. A value of TRUE
causes the text to be redrawn immediately. Line breaks, line heights, and line ascents are recalculated. A value of FALSE
delays redrawing until another event forces the update.
If the fRedraw
parameter is set to TRUE
, TextEdit redraws the current selection range using the new character attributes, recalculating line breaks, line heights, and line ascents.
If the fRedraw
parameter is set to FALSE
, TextEdit does not redraw the text or recalculate line breaks, line heights, and line ascents. Consequently, when you call a function that uses any of this information, such as TEGetHeight
(which returns a total height between two specified lines), it does not reflect the new character attributes set with TESetStyle
. Instead, the function uses the information that was available before TESetStyle
was called. To update this information, call the TECalText
function. To be certain that the new information is always reflected, call TESetStyle
with the fRedraw
parameter set to TRUE
.
A handle to the multistyled edit structure containing the selected text.
The TESetStyle
function has no effect on a monostyled structure.
If you call the TESetStyle
function when the value of the selStart
field of an edit structure equals the value of the selEnd
field (specifying an insertion point), TextEdit stores the input character attributes in the null scrap structure pointed to by the null style handle.
TextEdit.h
Sets an edit structure’s style handle, which is stored in the txFont
and txFace
fields. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetStyleHandle ( TEStyleHandle theHandle, TEHandle hTE );
The style handle to be set in the combined txFont
and txFace
fields of the specified edit structure.
A handle to the edit structure.
The TESetStyleHandle
function has no effect on monostyled edit structures.
Your application should always use TESetStyleHandle
rather than manipulate the fields of the edit structure directly.
TextEdit.h
Incorporates a copy of the specified text into the designated edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TESetText ( const void *text, long length, TEHandle hTE );
A pointer to the text to be copied and incorporated.
The number of characters in the text to be incorporated.
A handle to the edit structure into which the text is to be copied.
The function TESetText
lets you incorporate existing text into the text buffer of an edit structure. The function copies the specified text into the existing hText
handle of the edit structure, resizing the buffer, if necessary it doesn’t bring in the original text. The copied text is wrapped to the destination rectangle, and its lineStarts
and nLines
fields are calculated accordingly. The selection range is set to an insertion point at the end of the incorporated text. The TESetText
function does not display the copied text on the screen. To do this, call TEUpdate
.
TextEdit.h
Inserts the specified text immediately before the selection range or the insertion point in the edit structure’s text and applies the specified character attributes to the text, redrawing the text if necessary. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEStyleInsert ( const void *text, long length, StScrpHandle hST, TEHandle hTE );
A pointer to the text to be inserted.
The length, in bytes, of the text to be inserted.
A handle to the style scrap structure containing the character attribute information to be applied to the inserted text.
A handle to the edit structure into which the text is to be inserted.
You should create your own style scrap structure, specifying the character attributes to be inserted and applied to the text, and pass its handle to TEStyleInsert
as the value of the hST
parameter. The character attributes are copied directly into the style structure’s (TEStyleRec
) style table.
The TEStyleInsert
function does not affect the current selection range.
TextEdit.h
Creates a multistyled edit structure and allocates a handle to it. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
TEHandle TEStyleNew ( const Rect *destRect, const Rect *viewRect );
A pointer to the destination rectangle for the new edit structure, specified in the local coordinates of the current graphics port. This is the area in which text is laid out.
A pointer to the view rectangle for the new edit structure, specified in the local coordinates of the current graphics port. This is the area of the window in which text is actually displayed.
A handle to the newly created edit structure. Your application needs to store the handle to the edit structure that is returned; many functions require it as an input parameter. See the description of the TEHandle
data type.
A multistyled edit structure contains text whose attributes, including font, size, and style, can vary from character to character. Always use the TEStyleNew
function to create an edit structure for text that uses varying character attributes. The TEStyleNew
function sets the txSize
, lineHeight
, and fontAscent
fields of the edit structure to –1, allocates a style structure, and stores a handle to the style structure in the txFont
and txFace
fields. The TEStyleNew
function creates and initializes a null scrap that is used by TextEdit functions throughout the life of the edit structure.
Call TEStyleNew
once for every edit structure you want allocated. Your application needs to store the handle to the edit structure that is returned; many functions require it as an input parameter.
If your application contains more than one window where text editing occurs, you need to create an edit structure for each window.
Before this function is called, the window must be in the current graphics port.
TextEdit.h
Pastes text and its associated character attribute information from the desk scrap into the edit structure’s text at the insertion point—if the current selection range is an insertion point—or it replaces the current selection range. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEStylePaste ( TEHandle hTE );
A handle to the edit structure into which the text is to be pasted.
When you call TEStylePaste
and there is no character attribute information associated with text in the desk scrap, TEStylePaste
first checks the null scrap. If the null scrap contains character attribute information, this is used. If the null scrap is empty, TEStylePaste
gives the text the same attributes as those of the first character of the replaced selection range or that of the preceding character if the selection is an insertion point.
For a monostyled edit structure, TEStylePaste
pastes the text only; there is no associated character attribute information because all the text uses the same attributes.
TextEdit.h
Draws the indicated text in a given rectangle, with the specified alignment. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TETextBox ( const void *text, long length, const Rect *box, short just );
A pointer to the text to be drawn.
The number of bytes comprising the text.
A pointer to the rectangle where the text is to be drawn. The rectangle is specified in local coordinates (of the current graphics port) and must be at least as wide as the first character drawn. (A good rule of thumb is to make the rectangle at least 20 pixels wide.
The kind of justification (alignment) used for the specified text.
The TETextBox
function provides you with an easy way to display static text to a user. It creates its own monostyled edit structure, which it deletes when finished with it, so you cannot edit the text it draws. The TETextBox
function breaks a line of text correctly. You can specify how text is aligned in the box using any of the “Text Alignment Constants.”
TextEdit.h
Copies the contents of the TextEdit private scrap to the desk scrap. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
OSErr TEToScrap ( void );
A result code. See “TextEdit Result Codes.”
You use the TEToScrap
function to move monostyled text across applications or between an application and a desk accessory. Call the Scrap Manager function ZeroScrap
to initialize the desk scrap or clear its contents before calling TEToScrap
.
TextEdit.h
Draws the specified text within a given update rectangle. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEUpdate ( const Rect *rUpdate, TEHandle hTE );
The update rectangle, given in the coordinates of the current graphics port, where the specified text is to be drawn.
A handle to the edit structure containing the text to be drawn.
Call TEUpdate
every time the Event Manager function WaitNextEvent
reports an update event for a text editing window—after you call the Window Manager function BeginUpdate
, and before you call the EndUpdate
function. You also need to erase the update region with the EraseRect
function. If you don’t, the caret can sometimes remain visible when the window is deactivated.
TextEdit.h
Assigns new character attributes to the specified range of text in the designated edit structure. (Deprecated in Mac OS X v10.4. Use Multilingual Text Engine instead; see Handling Unicode Text Editing With MLTE.)
void TEUseStyleScrap ( long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw, TEHandle hTE );
The offset of the first character in the text of the edit structure to which the character attributes are to be applied.
The offset of the last character in the text of the edit structure to which the character attributes are to be applied.
A handle to a style scrap structure. The style scrap structure contains the attributes to be applied to the specified range of text. If the value of newStyles
is NULL
, no action is performed. Each element in the style scrap structure contains a field that is the offset of the beginning of the element’s character attributes. This field (scrpStartChar
) defines the boundaries for the scrap’s style runs.
Depending on the requirements of your application, you can create a style scrap structure directly and pass its handle to TEUseStyleScrap
as the value of newStyles
or you can use a style scrap structure created by TEGetStyleScrapHandle
.
A flag that specifies whether TextEdit should immediately redraw the selection range using the new character attributes. If the fRedraw
parameter is set to TRUE
, the attributes are applied immediately to the specified range of text, and line breaks, line heights, and line ascents are recalculated. If fRedraw
is set to FALSE
, the new character attributes are not reflected in the view rectangle until the next update event occurs.
A handle to the edit structure containing the range of text to which the character attributes are to be applied. If the handle points to a monostyled edit structure (created using TENew
), no action is performed.
The TEUseStyleScrap
function writes the character attribute information into the style structure’s style table and updates the style run table.
Regardless of whether the text is redrawn, the current selection range is not changed; if characters are highlighted before TEUseStyleScrap
is called, they remain highlighted after it is called. However, if characters within the current selection range also fall within the specified range of text, they are rendered in the new character attributes when the text is redrawn.
The TEUseStyleScrap
function applies the first element’s attributes to the characters from rangeStart
up to the scrpStartChar
field of the next element. The function terminates without error if it prematurely reaches the end of the range or if there are not enough scrap style elements to cover the whole range. In the latter case, the function applies the last set of character attributes in the style scrap structure to the remainder of the range.
TextEdit.h
© 2003, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-13)