API Guide Home
(Online version only)

SmartTextEngineDef.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2004 palmOne, Inc. or its subsidiaries.
00003  * All rights reserved.
00004  *****************************************************************************/
00005 /** @ingroup STE
00006  *
00007  */
00008 
00009 /**
00010  * @file    SmartTextEngineDef.h
00011  *
00012  * @brief Public include file for Smart Text Engine shared library
00013  *
00014  * The calling application should always load this library with
00015  * SysLibLoad() before use, even if it is already open by another
00016  * application(ie, SysLibFind() returns a valid refnum). When
00017  * the application is done with the library, it should be
00018  * unloaded with SysLibRemove(). We do this because there is
00019  * no good way to synchronize loading and unloading of libraries
00020  * among multiple applications. It also greatly simplifies internal
00021  *
00022  */
00023 
00024 
00025 #ifndef _SMARTTEXTENGINEDEF_H_
00026 #define _SMARTTEXTENGINEDEF_H_
00027 
00028 #include <PalmOS.h>
00029 
00030 #include "SmartTextEngineErrors.h"
00031 #include "SmartTextEngineRsc.h"
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 
00039 #define steLibName          "SmartTextEngine.lib"      /**< Internal library name which can(but shouldn't) be passed to SysLibFind() */
00040 #define steLibDBName        "Smart Text Engine"        /**< Name used for DmFindDatabase */
00041 
00042 
00043 /**
00044  * @name Parsed types
00045  *
00046  */
00047 /*@{*/
00048 #define kParsedPhoneNumber        1
00049 #define kParsedURL                2
00050 #define kParsedEmail              3
00051 #define kParsedDeviceURL          4
00052 #define kParsedRtspURL            5
00053 /*@}*/
00054 
00055 #define kSmartTextBit            0x4000 /**<No definition */
00056 
00057 /**
00058  * @name Font types
00059  *
00060  */
00061 /*@{*/
00062 #define kSTEStdFont               (kSmartTextBit | 0x00)
00063 #define kSTEBoldFont              (kSmartTextBit | 0x01)
00064 /*@}*/
00065 
00066 /**
00067  * @name Font colors
00068  *
00069  */
00070 /*@{*/
00071 #define kSTECurrentFont           (kSmartTextBit | 0x10)    /**<Current font color*/
00072 #define kSTEBlackFont             (kSmartTextBit | 0x11)    /**<Black font color*/
00073 #define kSTEBlueFont              (kSmartTextBit | 0x12)    /**<Blue font color*/
00074 #define kSTERedFont               (kSmartTextBit | 0x13)    /**<Red font color*/
00075 #define kSTEGreenFont             (kSmartTextBit | 0x14)    /**<Green font color*/
00076 #define kSTEYellowFont            (kSmartTextBit | 0x15)    /**<Yellow font color*/
00077 #define kSTEPurpleFont            (kSmartTextBit | 0x16)    /**<Purple font color*/
00078 #define kSTEOrangeFont            (kSmartTextBit | 0x17)    /**<Orange font color*/
00079 #define kSTEGrayFont              (kSmartTextBit | 0x18)    /**<Gray font color*/
00080 /*@}*/
00081 
00082 /**
00083  * @name Formating
00084  *
00085  */
00086 /*@{*/
00087 #define kSTELineBreak             (kSmartTextBit | 0x50)    /**<Line Break**/
00088 #define kSTELeftIndent            (kSmartTextBit | 0x51)    /**<Left Indentation*/
00089 #define kSTERightAlign            (kSmartTextBit | 0x52)    /**<Right Alignment*/
00090 #define kSTECenterAlign           (kSmartTextBit | 0x53)    /**<Center Alignment*/
00091 
00092 #define kSTEHorizontalLine        (kSmartTextBit | 0x60)    /**<Horizontal Line*/
00093 
00094 #define kSTEBitmap                (kSmartTextBit | 0x70)    /**<Bitmap*/
00095 #define kSTESmileyBitmap          (kSmartTextBit | 0x71)    /**<Smiley Bitmap*/
00096 #define kSTECharacterBitmap       (kSmartTextBit | 0x72)    /**<Character Bitmap*/
00097 
00098 #define kSTEHyperlink             (kSmartTextBit | 0x80)    /**<Hyperlink*/
00099 /*@}*/
00100 
00101 /**
00102  * @name Emoticons
00103  *
00104  */
00105 /*@{*/
00106 #define kSmileSmiley              (((UInt32)LargeSmiley00BitMap << 16) | Smiley00BitMap)    /**<Smiling Smily*/
00107 #define kWinkSmiley               (((UInt32)LargeSmiley01BitMap << 16) | Smiley01BitMap)    /**<Winking Smily*/
00108 #define kFrownSmiley              (((UInt32)LargeSmiley02BitMap << 16) | Smiley02BitMap)    /**<Frowning Smily*/
00109 #define kBigTeethSmiley           (((UInt32)LargeSmiley03BitMap << 16) | Smiley03BitMap)    /**<Big Teeth Smily*/
00110 #define kTongueSmiley             (((UInt32)LargeSmiley04BitMap << 16) | Smiley04BitMap)    /**<Tongue Smily*/
00111 #define kDevilSmiley              (((UInt32)LargeSmiley05BitMap << 16) | Smiley05BitMap)    /**<Devil Smily*/
00112 #define kOMouthSmiley             (((UInt32)LargeSmiley06BitMap << 16) | Smiley06BitMap)    /**<O-mouth Smily*/
00113 #define kBigTongueSmiley          (((UInt32)LargeSmiley07BitMap << 16) | Smiley07BitMap)    /**<Big Tongue Smily*/
00114 #define kHeartSmiley              (((UInt32)LargeSmiley08BitMap << 16) | Smiley08BitMap)    /**<Heart Smily*/
00115 #define kBigFrownSmiley           (((UInt32)LargeSmiley09BitMap << 16) | Smiley09BitMap)    /**<Big Frown Smily*/
00116 #define kQuestionSmiley           (((UInt32)LargeSmiley10BitMap << 16) | Smiley10BitMap)    /**<Question Smily*/
00117 #define kPukeSmiley               (((UInt32)LargeSmiley11BitMap << 16) | Smiley11BitMap)    /**<Puke Smily*/
00118 #define kBigSmileSmiley           (((UInt32)LargeSmiley12BitMap << 16) | Smiley12BitMap)    /**<Big Smile Smily*/
00119 #define kBlushSmiley              (((UInt32)LargeSmiley13BitMap << 16) | Smiley13BitMap)    /**<Blush Smily*/
00120 #define kSmirkSmiley              (((UInt32)LargeSmiley14BitMap << 16) | Smiley14BitMap)    /**<Smirk Smily*/
00121 #define kClownSmiley              (((UInt32)LargeSmiley15BitMap << 16) | Smiley15BitMap)    /**<Clown Smily*/
00122 #define kStraightMouthSmiley      (((UInt32)LargeSmiley16BitMap << 16) | Smiley16BitMap)    /**<Straight Mouth Smily*/
00123 #define kYinYangSmiley            (((UInt32)LargeSmiley17BitMap << 16) | Smiley17BitMap)    /**<Yin Yang Smily*/
00124 #define kAngelSmiley              (((UInt32)LargeSmiley18BitMap << 16) | Smiley18BitMap)    /**<Angel Smily*/
00125 #define kCigarSmiley              (((UInt32)LargeSmiley19BitMap << 16) | Smiley19BitMap)    /**<Cigar Smily*/
00126 #define kFlipSmiley               (((UInt32)LargeSmiley20BitMap << 16) | Smiley20BitMap)    /**<Flip Smily*/
00127 #define kUFlipSmiley              (((UInt32)LargeSmiley21BitMap << 16) | Smiley21BitMap)    /**<Up Flip Smily*/
00128 #define kLFlipSmiley              (((UInt32)LargeSmiley22BitMap << 16) | Smiley22BitMap)    /**<Left Flip Smily*/
00129 #define kRFlipSmiley              (((UInt32)LargeSmiley23BitMap << 16) | Smiley23BitMap)    /**<Right Flip Smily*/
00130 
00131 
00132 #define kDeltaCharacter           (((UInt32)Delta14BitMap << 16)  | Delta11BitMap)  /**<Delta Character*/
00133 #define kPhiCharacter             (((UInt32)Phi14BitMap << 16)    | Phi11BitMap)    /**<Phi Character*/
00134 #define kGammaCharacter           (((UInt32)Gamma14BitMap << 16)  | Gamma11BitMap)  /**<Gamma Character*/
00135 #define kLambdaCharacter          (((UInt32)Lambda14BitMap << 16) | Lambda11BitMap) /**<Lambda Character*/
00136 #define kOmegaCharacter           (((UInt32)Omega14BitMap << 16)  | Omega11BitMap)  /**<Omega Character*/
00137 #define kPiCharacter              (((UInt32)Pi14BitMap << 16)     | Pi11BitMap)     /**<Pi Character*/
00138 #define kPsiCharacter             (((UInt32)Psi14BitMap << 16)    | Psi11BitMap)    /**<Psi Character*/
00139 #define kSigmaCharacter           (((UInt32)Sigma14BitMap << 16)  | Sigma11BitMap)  /**<Sigma Character*/
00140 #define kThetaCharacter           (((UInt32)Theta14BitMap << 16)  | Theta11BitMap)  /**<Theta Character*/
00141 #define kXiCharacter              (((UInt32)Xi14BitMap << 16)     | Xi11BitMap)     /**<Xi Character*/
00142 /*@}*/
00143 
00144 /**
00145  * @name Link colors (from the CLUT)
00146  *
00147  */
00148 /*@{*/
00149 #define kSTECurrent         254 // taking a chance no one will use this index
00150 #define kSTEBlack           255 /**<Black*/
00151 #define kSTEBlue            95  /**<Blue*/
00152 #define kSTERed             125 /**<Red*/
00153 #define kSTEGreen           210 /**<Green*/
00154 #define kSTEYellow          120 /**<Yellow*/
00155 #define kSTEPurple          23  /**<Purple*/
00156 #define kSTEOrange          116 /**<Orange*/
00157 #define kSTEGray            220 /**<Gray*/
00158 /*@}*/
00159 
00160 /**
00161  * @name Inverse Color
00162  *
00163  */
00164 /*@{*/
00165 #define kSTEBlackInverse    0   /**<Black Inverse*/
00166 #define kSTEBlueInverse     114 /**<Blue Inverse*/
00167 #define kSTERedInverse      8   /**<Red Inverse*/
00168 #define kSTEGreenInverse    18  /**<Green Inverse*/
00169 #define kSTEYellowInverse   6   /**<Yellow Inverse*/
00170 #define kSTEPurpleInverse   1   /**<Purple Inverse*/
00171 #define kSTEOrangeInverse   30  /**<Orange Inverse*/
00172 #define kSTEGrayInverse     25  /**<Gray Inverse*/
00173 /*@}*/
00174 
00175 
00176 // Smart Text delimiters
00177 
00178 /**
00179  * @name Use standard or bold font
00180  *
00181  */
00182 /*@{*/
00183 #define steStdFont          "//STESTDFONT//"    /**<Standard Font*/
00184 #define steBoldFont         "//STEBOLDFONT//"   /**<Bold Font*/
00185 /*@}*/
00186 
00187 /**
00188  * @name Font colors
00189  *
00190  */
00191 /*@{*/
00192 #define steCurrentFont      "//STECURRENTFONT//" /**<Current font color*/
00193 #define steBlackFont        "//STEBLACKFONT//"  /**<Black font color*/
00194 #define steBlueFont         "//STEBLUEFONT//"   /**<Blue font color*/
00195 #define steRedFont          "//STEREDFONT//"    /**<Red font color*/
00196 #define steGreenFont        "//STEGREENFONT//"  /**<Green font color*/
00197 #define steYellowFont       "//STEYELLOWFONT//" /**<Yellow font color*/
00198 #define stePurpleFont       "//STEPURPLEFONT//" /**<Purple font color*/
00199 #define steOrangeFont       "//STEORANGEFONT//" /**<Orange font color*/
00200 #define steGrayFont         "//STEGRAYFONT//"   /**<Gray font color*/
00201 /*@}*/
00202 
00203 /**
00204  * @name Used for formatting
00205  *
00206  */
00207 /*@{*/
00208 #define steLeftIndent       "//STELEFTINDENT="  /**<Left Indentation*/
00209 #define steRightAlign       "//STERIGHTALIGN="  /**<Right Indentation*/
00210 #define steCenterAlign      "//STECENTERALIGN//"    /**<Center Alignment*/
00211 /*@}*/
00212 
00213 #define steBitmap           "//STEBITMAP=" /**< Graphics support */
00214 
00215 /**
00216  * @name Miscellaneous
00217  *
00218  */
00219 /*@{*/
00220 #define steHorizontalLine   "//STEHORIZONTALLINE//" /**<Horizontal Line*/
00221 #define steLineBreak        "//STELINEBREAK//"  /**<Line Break*/
00222 /*@}*/
00223 
00224 // Custom link that calls a callback procedure when selected
00225 #define steHyperlink        "//STEHYPERLINK="   /**<Hyperlink*/
00226 
00227 // use this parameter to scroll to the end of the list
00228 #define kScrollToEnd                0xFFFF  /**< Used to scroll to end*/
00229 
00230 /**
00231  * @name Text Selection
00232  *
00233  */
00234 /*@{*/
00235 #define kSelectUntilEndOfRecord     0xFFFFFFFE  /**<Select till end of record*/
00236 #define kSelectUntilEnd             0xFFFFFFFF  /**<Select until End*/
00237 /*@}*/
00238 
00239 /**
00240  * @name Initializing the Smart Text Engine
00241  *
00242  */
00243 /*@{*/
00244 #define steParsePhoneNumbers        0x00000001  /**<Parse Phone Numbers*/
00245 #define steParseURLs                0x00000002  /**<Parse URLs*/
00246 #define steParseEmail               0x00000004  /**<parse Email*/
00247 #define steParseEmoticons           0x00000008  /**<parse Emotions*/
00248 #define steLargeFont                0x00000010  /**<Large Font*/
00249 #define steCannotSelectText         0x00000020  /**<Cannot Select Text*/
00250 #define steParseMoreEmoticons       0x00000040  /**<Parse More Emoticons*/
00251 #define steScrollWalksLinks         0x00000080  /**<Scroll Walks links*/
00252 #define steInvertHighlighting       0x00000100  /**<Invert highlighting*/
00253 #define steNoLinksBeforeColon       0x00000200  /**<No links before colon*/
00254 #define steAcceleratedScrolling     0x00000400  /**<No Accelerated Scrolling*/
00255 #define steAllowShortPhoneNumbers   0x00000800  /**<Allow Short Phone Numbers*/
00256 #define steParseGSMGreekChars       0x00001000  /**<Parse GSM Greek Characters*/
00257 #define steDoNotCenterVertically    0x00002000  /**<Do not center vertically*/
00258 #define steScrollWalksMessages      0x00004000  /**<Scroll walks messages*/
00259 #define steTextMustBeVisible        0x00008000  /**<If true, then any routine that returns selected text must verify the text is visible first*/
00260 #define steAllowPhoneNumberWords    0x00010000  /**<If true, then the phone number parser will allow numbers like 1-800-TESTING*/
00261 /*@}*/
00262 
00263 /** Used for custom hyperlinks */
00264 typedef void (*STECallbackType) (UInt32 refNum);
00265 
00266 
00267 /**
00268  * @brief Holds parsed item information.
00269  *
00270  * Given a message, or list of messages,
00271  * this structure gives the locations of all parsed items.
00272  */
00273 typedef struct
00274 {
00275   UInt16  parsedType;         /**< what kind of data did we find?*/
00276   UInt16  startLocation;      /**< the starting location of the parsed data we found*/
00277   UInt16  itemLength;         /**< the character length of the parsed data we found*/
00278   UInt16  msgNumber;          /**< when parsing a list of message, this is the message number, otherwise 0*/
00279   UInt16  color;              /**< used to store the font color (for custom hyperlinks)*/
00280   UInt16  nameLength;         /**< used to store the length of the link name (for custom hyperlinks)*/
00281   UInt32  miscData;           /**< used now to store left indentation and other info.  Adapt as needed.*/
00282 } ParsedInfo;
00283 
00284 /**
00285  * @brief Holds the list of parsed item information.
00286  */
00287 typedef struct
00288 {
00289   UInt16        size;         /**< how many items did we find in the text?*/
00290   UInt16        maxSize;      /**< maximum number of items that can be added without resizing*/
00291   ParsedInfo    info[1];      /**< parsing info follows*/
00292 } ParsedInfoList;
00293 
00294 
00295 #ifdef __cplusplus
00296 }
00297 #endif
00298 
00299 
00300 #endif // _SMARTTEXTENGINEDEF_H_

Top Palm Developer Network
© 2004-2008, Palm, Inc. All rights reserved.
Generated on Fri Jun 13 10:06:55 2008 for Palm API Guide