Mac Carbon |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 4:54 pm Post subject: MLTE |
|
|
adc - Multilingual Text Engine Reference
"Multilingual Text Engine (MLTE) is an API that allows your application to provide
Carbon-compliant Unicode text editing. This document is relevant for anyone
who is writing an application that needs to display static Unicode text or provide
Unicode-compliant text editing fields." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 4:56 pm Post subject: |
|
|
adc - Multilingual Text Engine Reference
Code: | void TXNIdle (
TXNObject iTXNObject
); |
"Does idle time processing, such as flashing the cursor."
Code: | void TXNClick (
TXNObject iTXNObject,
const EventRecord *iEvent
); |
"Processes a mouse-down event in a window’s content area."
Code: | void TXNFocus (
TXNObject iTXNObject,
Boolean iBecomingFocused
); |
"iBecomingFocused
If you pass true, the text object receives focus. This means the current
selection or insertion point is active, text input appears at the insertion
point, and the keyboard and font are synchronized." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 4:56 pm Post subject: |
|
|
adc - Multilingual Text Engine Reference
Code: | OSStatus TXNCreateObject (
const HIRect *iFrameRect,
TXNFrameOptions iFrameOptions,
TXNObject *oTXNObject
); |
"Creates a new MLTE text object which is an opaque structure that handles
text formatting at the document level. See Frame Option Masks."
Code: | OSStatus TXNAttachObjectToWindowRef (
TXNObject iTXNObject,
WindowRef iWindowRef
); |
"Attaches a text object to a window." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 4:58 pm Post subject: |
|
|
ADC: Technical Note TN2026: Multilingual Text Engine FAQ
"By default MLTE uses the Apple Event Manager for text input. However,
with the recent addition of the TXNCarbonEventInfo data structure, MLTE
clients can specify that MLTE use Carbon events to handle text input.
Q: What is the optimal way to clear the content of a TXNObject?
A: You should call TXNSetData with a NULL pointer to clear the content of
an MLTE object." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 4:59 pm Post subject: |
|
|
adc - TXNSetData - Multilingual Text Engine Reference
Code: | OSStatus TXNSetData (
TXNObject iTXNObject,
TXNDataType iDataType,
const void *iDataPtr,
ByteCount iDataSize,
TXNOffset iStartOffset,
TXNOffset iEndOffset
); |
"Replaces a range of data (text, graphics, and so forth).
If you have a text object that has word wrap disabled, and you want
to avoid horizontal scrolling, you can try the following. After you call
the function TXNSetData(), call TXNSetSelection() with the value of the
ending offset set to what it was before you called TXNSetData(). Then,
call the function TXNShowSelection() to scroll the text back into view.
Offsets in MLTE are always character offsets." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:00 pm Post subject: |
|
|
adc - TXNGetData - Multilingual Text Engine Reference
Code: | OSStatus TXNGetData (
TXNObject iTXNObject,
TXNOffset iStartOffset,
TXNOffset iEndOffset,
Handle *oDataHandle
); |
"Copies a range of data.
You first need to use the TXNCountRunsInRange function to find the number
of data runs in a given range. Then you can examine each run’s type and
text attributes with the TXNGetIndexedRunInfoFromRange() function. Finally,
use the TXNGetData() function to examine data for each run of interest to
you. The function does not check to see that the copied data aligns on a word
boundary; data is simply copied as specified by the offset values." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:00 pm Post subject: |
|
|
adc - TXNGetDataEncoded - Multilingual Text Engine Reference
Code: | OSStatus TXNGetDataEncoded (
TXNObject iTXNObject,
TXNOffset iStartOffset,
TXNOffset iEndOffset,
Handle *oDataHandle,
TXNDataType iEncoding
); |
"Copies the text in a specified range, and if necessary, translates the text
to match your application’s preferred encoding.
The type of data to be encoded. See Supported Data Types for a full desc-
ription of possible values. You should specify either the kTXNTextData or
kTXNUnicodeTextData constant. If the iEncoding parameter specifies an
encoding different from that used to store the text data internally, the Con-
version Manager translates the data to the specified type (text or Unicode).
If the iEncoding parameter is not recognized, the data is returned in the
current encoding." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:01 pm Post subject: |
|
|
adc - TXNDataSize - Multilingual Text Engine Reference
Code: | ByteCount TXNDataSize (
TXNObject iTXNObject
); |
"You can use this function to determine how large a handle should be
if, for example, you copy text. Note that because every individual sound,
picture, or movie in a text object is represented by a single character in
the text buffer, the TXNDataSize() function returns a value that does not
necessarily represent the true size of any non-text data.
If you are using Unicode and you want to know the number of characters,
divide the returned ByteCount value by sizeof(UniChar) or 2, since MLTE
uses the 16-bit Unicode Transformation Format (UTF-16)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:01 pm Post subject: |
|
|
adc - TXNDrawObject - Multilingual Text Engine Reference
Code: | OSStatus TXNDrawObject (
TXNObject iTXNObject,
const HIRect *iClipRect,
TXNDrawItems iDrawItems
); |
"You shouldn’t use TXNUpdate() for windows that contain something else
besides the text object. If the window contains something in addition to
the text object, you should use the TXNDrawObject() function instead of
the TXNUpdate() function."
Code: | void TXNForceUpdate (
TXNObject iTXNObject
); |
"This function operates similarly to the Window Manager functions InvalRect()
and InvalRgn()." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:10 pm Post subject: |
|
|
adc - TXNNewObject - Deprecated Multilingual Text Engine Functions
Code: | OSStatus TXNNewObject (
const FSSpec *iFileSpec,
WindowRef iWindow,
const Rect *iFrame,
TXNFrameOptions iFrameOptions,
TXNFrameType iFrameType,
TXNFileType iFileType,
TXNPermanentTextEncodingType iPermanentEncoding,
TXNObject *oTXNObject,
TXNFrameID *oTXNFrameID,
TXNObjectRefcon iRefCon
); |
"Creates a new MLTE text object which is an opaque structure that handles
text formatting at the document level. See Frame Option Masks for a
description of possible values. See also Supported Frame Types." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 5:11 pm Post subject: |
|
|
adc - TXNSetTXNObjectControls - Multilingual Text Engine Reference
Code: | OSStatus TXNSetTXNObjectControls (
TXNObject iTXNObject,
Boolean iClearAll,
ItemCount iControlCount,
const TXNControlTag iControlTags[],
const TXNControlData iControlData[]
); |
"Sets formatting and privileges attributes (such as justification, line direction,
tab values, and read-only status) that apply to the entire text object. See
Formatting and Privileges Settings" |
|
Back to top |
|
|
|