|
API Guide Home (Online version only) |
![]() |
The Smart Text Engine (STE) Library can be used to enable hyperlink in your application and display icon as defined in the Resource Header file.
It will enable user to tap on:
The calling application should always load this library with SysLibLoad() before use, even if it is already open by another application(ie, SysLibFind() returns a valid refnum). When the application is done with the library, it should be unloaded with SysLibRemove(). We do this because there is no good way to synchronize loading and unloading of libraries among multiple applications. It also greatly simplifies internal synchronization.
Err LoadSmartTextEngine(UInt16* refNumP, Boolean* libLoadedP) { Err error = 0; // Routine is pointless without this parameter if (!refNumP) return memErrInvalidParam; // always load the library, so we have our own instance of the engine error = SysLibLoad(sysFileTLibrary, hsFileCSmartTextEngine, refNumP); if (error) return error; *libLoadedP = true; return error; }
Definition in file SmartTextEngine.h.
Include dependency graph for SmartTextEngine.h:

Go to the source code of this file.
| void STEAppendParsedInfo | ( | UInt16 | refNum, | |
| MemHandle | destParsedInfoH, | |||
| ParsedInfoList * | sourceParsedInfoP | |||
| ) |
This routine append a ParsedInfoList to another ParsedInfoList.
This does NOT require the STE to be initialized. This is used internally by the STE. You probably will not use this function.
| refNum,: | IN: The STE refNum | |
| destParsedInfoH,: | IN: A handle to the destination parsed info list | |
| sourceParsedInfoP,: | IN: The source parsed info list. |
| - |
| void STEAppendTextToEngine | ( | UInt16 | refNum, | |
| UInt16 | engineRefNum, | |||
| Char * | textP, | |||
| Boolean | renderImmediate | |||
| ) |
Function that is used to add text to the STE. Each text string that is appended is called a record. Record numbers are 1 based, meaning the first record is record 1.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| textP,: | IN: The text to append to the STE, including any STE delimiters | |
| renderImmediate,: | IN: If true, the text will be displayed immediately. If false, it will not be displayed until STERenderList is called. |
| - |
This routine clears any currently selected text or hot rect.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| - |
Standard library close routine. Library should always be unloaded with SysLibRemove() after STEClose() is called. See note at top of file.
| refNum,: | IN: Library reference number |
| STEErr | Error Code or zero if no error occurs |
This routine copies the selected text to the system's clipboard.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| - |
Get Library API Version number.
| refNum,: | IN: Library reference number | |
| majVerP,: | OUT: Major version number | |
| minVerP,: | OUT: Minor version number |
| STEErr | Error Code or zero if no error occurs |
| void STEGetCurrentTextSelection | ( | UInt16 | refNum, | |
| UInt16 | engineRefNum, | |||
| UInt16 * | messageNumber, | |||
| UInt16 * | startLocation, | |||
| UInt16 * | selectionLength | |||
| ) |
This routine will select the specified text selection. The display will be updated to show the selected text as highlighted.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| messageNumber,: | OUT: The record number of the start the selection | |
| startLocation,: | OUT: The byte offset of the start the text selection | |
| selectionLength,: | OUT: The number of bytes in the text selection |
| - |
This routine returns the current STE flags
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| UInt32 | The STE flags |
| void STEGetLastTapInfo | ( | UInt16 | refNum, | |
| UInt16 | engineRefNum, | |||
| UInt16 * | messageNumber, | |||
| UInt16 * | tapLocation | |||
| ) |
This routine returns the location of the last tap. If the user drags the stylus, it is not a tap.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| messageNumber,: | OUT: The record number of the text that was tapped | |
| tapLocation,: | OUT: The number of bytes offset from the start of the text to the location tapped |
| - |
This routine returns the number of lines in the STE.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| UInt16 | Number of lines in the STE |
This routine returns the number of records in the STE.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| UInt16 | Number of records in the STE |
| ParsedInfoList* STEGetParsedInformation | ( | UInt16 | refNum, | |
| Char * | textP, | |||
| UInt16 | msgNumber, | |||
| Boolean | replaceLineFeeds, | |||
| UInt32 | flags | |||
| ) |
This routine will parse the text string for URLs, email addresses, and/or phone numbers.
This does NOT require the STE to be initialized.
| refNum,: | IN: The STE refNum | |
| textP,: | IN: The text string to parse | |
| msgNumber,: | IN: The message number of this text string (Used internally by the STE) | |
| replaceLineFeeds,: | IN: If true, any line feed will be replaced with a space, but a parsed item will be create that specifies a line feed to be at that location | |
| flags,: | IN: The flags indicating what type of item to parse out |
| ParsedInfoList* | A parsed info list that has each of the parsed items found in the text string. |
This routine returns the current scroll position of the STE's scroll bar.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| UInt16 | The position of the scroll bar. |
This routine returns the current scroll position of the STE's scroll bar as a percentage of the entire scroll bar.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| UInt16 | The position of the scroll bar in percentage. |
This routine returns a copy of the actual text that is currently selected.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| Char* | Returns a copy of the current text selection. This must be freed by the caller. |
This routine should be called in the form's event handler. If there is no special handling of events, then this routine can be used to handle all the different events that can affect the STE.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine handles only the keyDown event. This routine should be used if there is special handling of the events by the application before (or after) the STE handles the event.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine handles only the penDown event. This routine should be used if there is special handling of the events by the application before (or after) the STE handles the event.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine handles only the penMove event. This routine should be used if there is special handling of the events by the application before (or after) the STE handles the event.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine handles only the penUp event. This routine should be used if there is special handling of the events by the application before (or after) the STE handles the event.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine handles only the sclRepeat event. This routine should be used if there is special handling of the events by the application before (or after) the STE handles the event.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| eventP,: | IN: A pointer to the event record. |
| Boolean | True if handled, False if not handled |
This routine checks if there is a current hot rect selection. A hot rect is a hyperlink that has been selected with the keyboard.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| Boolean | True if there is a current hot rect selected |
This routine checks if there is a current message selected.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| Boolean | True if there is a current message selected |
This routine checks if there is any text currently selected.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| Boolean | True if there is any text selected |
| STEErr STEInitializeEngine | ( | UInt16 | refNum, | |
| UInt16 * | engineRefNum, | |||
| RectangleType * | listBounds, | |||
| UInt16 | scrollBarID, | |||
| UInt32 | flags, | |||
| UInt8 | phoneNumberColor, | |||
| UInt8 | urlColor, | |||
| UInt8 | emailColor | |||
| ) |
Styled Text Engine initialization function Before most of the STE can be used, it must be initialized. This function will return an engineRefNum which is to be used in the STE functions that require the STE to be initialized.
There are some functions that do not require the STE to be initialized. They are noted below.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | OUT: The STE engine refNum to be used in subsequent calls to the STE | |
| listBounds,: | IN: The bounds of the STE list that will be displayed | |
| scrollBarID,: | IN: The ID of the scroll used by the STE list. If this is 0, the list will not scroll. If there is more text than can be displayed, an ellipsis will be appended to the end. | |
| flags,: | IN: The flags for the STE | |
| phoneNumberColor,: | IN: The color of the phone number hyperlinks | |
| urlColor,: | IN: The color of the URL hyperlinks | |
| emailColor,: | IN: The color of the email hyperlinks |
| STEErr | Error Code or zero if no error occurs |
Standard library open routine. Library should always be loaded with SysLibLoad()(not SysLibFind()) before calling STEOpen(). See note at top of file.
| refNum,: | IN: Library reference number |
| STEErr | Error Code or zero if no error occurs |
| void STEQuickRender | ( | UInt16 | refNum, | |
| RectangleType * | listBounds, | |||
| UInt32 | flags, | |||
| UInt8 | phoneNumberColor, | |||
| UInt8 | urlColor, | |||
| UInt8 | emailColor, | |||
| Char * | msgP | |||
| ) |
This routine will render the specified text as a "one shot deal". The text will not respond to any events, and hyperlinks do not work. This can be used to display rich text with graphics easily in your application.
This does NOT require the STE to be initialized.
| refNum,: | IN: The STE refNum | |
| listBounds,: | IN: The bounds of the STE list that will be displayed | |
| flags,: | IN: The flags for the STE | |
| phoneNumberColor,: | IN: The color of the phone number hyperlinks | |
| urlColor,: | IN: The color of the URL hyperlinks | |
| emailColor,: | IN: The color of the email hyperlinks | |
| msgP,: | IN: The text to display |
| - |
Initializes the STE to the initial state right after initializing it. This frees up any text that has been entered into the STE.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| STEErr | Error Code or zero if no error occurs |
Removes the last text that was appended to the engine. You must call STERenderList to update the display after removing the text.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| - |
Renders the text that is currently in the STE.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| - |
Rerenders the text that is currently in the STE. This routine should be used if a change is made that can change the formatting (i.e. font size).
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| - |
Frees up the STE engine refNum. For each STEInitializeEngine, there must be a corresponding STEResetEngine.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum |
| STEErr | Error Code or zero if no error occurs |
| UInt16 STESetCurrentTextSelection | ( | UInt16 | refNum, | |
| UInt16 | engineRefNum, | |||
| UInt16 | messageNumber, | |||
| UInt32 | startLocation, | |||
| UInt32 | selectionLength | |||
| ) |
This routine will select the specified text selection. The display will be updated to show the selected text as highlighted.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| messageNumber,: | IN: The record number to start the selection | |
| startLocation,: | IN: The byte offset to start the text selection | |
| selectionLength,: | IN: The number of bytes in the text selection |
| UInt16 | Returns the line number of the topmost line of the selection |
| void STESetCustomHyperlinkCallback | ( | UInt16 | refNum, | |
| UInt16 | engineRefNum, | |||
| STECallbackType | callback, | |||
| Boolean | armCallback | |||
| ) |
This routine sets the procedure to call as a result of tapping a custom hyperlink
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| callback,: | IN: The routine to call | |
| armCallback,: | IN: True if the callback routine is ARM code, false if it is 68K code |
| - |
This routine sets the STE flags
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| flagsToSet,: | IN: Bitmap representing the flags to set | |
| flagsToClear,: | IN: Bitmap representing the flags to clear |
| - |
This routine sets the current scroll position of the STE's scroll bar.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| scrollValue,: | IN: The position to set the scroll bar |
| - |
This routine sets the current scroll position percentage of the STE's scroll bar.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| scrollPct,: | IN: The position to set the scroll bar in percentage |
| - |
This routine sets the current scroll bar position so that the specified record appears at the top of the list.
| refNum,: | IN: The STE refNum | |
| engineRefNum,: | IN: The STE engine refNum | |
| recordNum,: | IN: The record number to display at the top of the list. |
| - |
| Top | Palm Developer Network © 2004-2008, Palm, Inc. All rights reserved. Generated on Fri Jun 13 10:08:04 2008 for Palm API Guide |