1 { 2 * AXTextAttributedString.h 3 * 4 * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. 5 * 6 } 7 8 { Pascal Translation: Gale R Paeper, <gpaeper@empirenet.com>, 2006 } 9 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 } 10 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2012 } 11 12 { 13 Modified for use with Free Pascal 14 Version 308 15 Please report any bugs to <gpc@microbizz.nl> 16 } 17 18 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 19 {$mode macpas} 20 {$modeswitch cblocks} 21 {$packenum 1} 22 {$macro on} 23 {$inline on} 24 {$calling mwpascal} 25 26 unit AXTextAttributedString; 27 interface 28 {$setc UNIVERSAL_INTERFACES_VERSION := $0400} 29 {$setc GAP_INTERFACES_VERSION := $0308} 30 31 {$ifc not defined USE_CFSTR_CONSTANT_MACROS} 32 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE} 33 {$endc} 34 35 {$ifc defined CPUPOWERPC and defined CPUI386} 36 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386} 37 {$endc} 38 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN} 39 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN} 40 {$endc} 41 42 {$ifc not defined __ppc__ and defined CPUPOWERPC32} 43 {$setc __ppc__ := 1} 44 {$elsec} 45 {$setc __ppc__ := 0} 46 {$endc} 47 {$ifc not defined __ppc64__ and defined CPUPOWERPC64} 48 {$setc __ppc64__ := 1} 49 {$elsec} 50 {$setc __ppc64__ := 0} 51 {$endc} 52 {$ifc not defined __i386__ and defined CPUI386} 53 {$setc __i386__ := 1} 54 {$elsec} 55 {$setc __i386__ := 0} 56 {$endc} 57 {$ifc not defined __x86_64__ and defined CPUX86_64} 58 {$setc __x86_64__ := 1} 59 {$elsec} 60 {$setc __x86_64__ := 0} 61 {$endc} 62 {$ifc not defined __arm__ and defined CPUARM} 63 {$setc __arm__ := 1} 64 {$elsec} 65 {$setc __arm__ := 0} 66 {$endc} 67 {$ifc not defined __arm64__ and defined CPUAARCH64} 68 {$setc __arm64__ := 1} 69 {$elsec} 70 {$setc __arm64__ := 0} 71 {$endc} 72 73 {$ifc defined cpu64} 74 {$setc __LP64__ := 1} 75 {$elsec} 76 {$setc __LP64__ := 0} 77 {$endc} 78 79 80 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__} 81 {$error Conflicting definitions for __ppc__ and __i386__} 82 {$endc} 83 84 {$ifc defined __ppc__ and __ppc__} 85 {$setc TARGET_CPU_PPC := TRUE} 86 {$setc TARGET_CPU_PPC64 := FALSE} 87 {$setc TARGET_CPU_X86 := FALSE} 88 {$setc TARGET_CPU_X86_64 := FALSE} 89 {$setc TARGET_CPU_ARM := FALSE} 90 {$setc TARGET_CPU_ARM64 := FALSE} 91 {$setc TARGET_OS_MAC := TRUE} 92 {$setc TARGET_OS_IPHONE := FALSE} 93 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 94 {$setc TARGET_OS_EMBEDDED := FALSE} 95 {$elifc defined __ppc64__ and __ppc64__} 96 {$setc TARGET_CPU_PPC := FALSE} 97 {$setc TARGET_CPU_PPC64 := TRUE} 98 {$setc TARGET_CPU_X86 := FALSE} 99 {$setc TARGET_CPU_X86_64 := FALSE} 100 {$setc TARGET_CPU_ARM := FALSE} 101 {$setc TARGET_CPU_ARM64 := FALSE} 102 {$setc TARGET_OS_MAC := TRUE} 103 {$setc TARGET_OS_IPHONE := FALSE} 104 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 105 {$setc TARGET_OS_EMBEDDED := FALSE} 106 {$elifc defined __i386__ and __i386__} 107 {$setc TARGET_CPU_PPC := FALSE} 108 {$setc TARGET_CPU_PPC64 := FALSE} 109 {$setc TARGET_CPU_X86 := TRUE} 110 {$setc TARGET_CPU_X86_64 := FALSE} 111 {$setc TARGET_CPU_ARM := FALSE} 112 {$setc TARGET_CPU_ARM64 := FALSE} 113 {$ifc defined iphonesim} 114 {$setc TARGET_OS_MAC := FALSE} 115 {$setc TARGET_OS_IPHONE := TRUE} 116 {$setc TARGET_IPHONE_SIMULATOR := TRUE} 117 {$elsec} 118 {$setc TARGET_OS_MAC := TRUE} 119 {$setc TARGET_OS_IPHONE := FALSE} 120 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 121 {$endc} 122 {$setc TARGET_OS_EMBEDDED := FALSE} 123 {$elifc defined __x86_64__ and __x86_64__} 124 {$setc TARGET_CPU_PPC := FALSE} 125 {$setc TARGET_CPU_PPC64 := FALSE} 126 {$setc TARGET_CPU_X86 := FALSE} 127 {$setc TARGET_CPU_X86_64 := TRUE} 128 {$setc TARGET_CPU_ARM := FALSE} 129 {$setc TARGET_CPU_ARM64 := FALSE} 130 {$ifc defined iphonesim} 131 {$setc TARGET_OS_MAC := FALSE} 132 {$setc TARGET_OS_IPHONE := TRUE} 133 {$setc TARGET_IPHONE_SIMULATOR := TRUE} 134 {$elsec} 135 {$setc TARGET_OS_MAC := TRUE} 136 {$setc TARGET_OS_IPHONE := FALSE} 137 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 138 {$endc} 139 {$setc TARGET_OS_EMBEDDED := FALSE} 140 {$elifc defined __arm__ and __arm__} 141 {$setc TARGET_CPU_PPC := FALSE} 142 {$setc TARGET_CPU_PPC64 := FALSE} 143 {$setc TARGET_CPU_X86 := FALSE} 144 {$setc TARGET_CPU_X86_64 := FALSE} 145 {$setc TARGET_CPU_ARM := TRUE} 146 {$setc TARGET_CPU_ARM64 := FALSE} 147 {$setc TARGET_OS_MAC := FALSE} 148 {$setc TARGET_OS_IPHONE := TRUE} 149 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 150 {$setc TARGET_OS_EMBEDDED := TRUE} 151 {$elifc defined __arm64__ and __arm64__} 152 {$setc TARGET_CPU_PPC := FALSE} 153 {$setc TARGET_CPU_PPC64 := FALSE} 154 {$setc TARGET_CPU_X86 := FALSE} 155 {$setc TARGET_CPU_X86_64 := FALSE} 156 {$setc TARGET_CPU_ARM := FALSE} 157 {$setc TARGET_CPU_ARM64 := TRUE} 158 {$ifc defined ios} 159 {$setc TARGET_OS_MAC := FALSE} 160 {$setc TARGET_OS_IPHONE := TRUE} 161 {$setc TARGET_OS_EMBEDDED := TRUE} 162 {$elsec} 163 {$setc TARGET_OS_MAC := TRUE} 164 {$setc TARGET_OS_IPHONE := FALSE} 165 {$setc TARGET_OS_EMBEDDED := FALSE} 166 {$endc} 167 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 168 {$elsec} 169 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.} 170 {$endc} 171 172 {$ifc defined __LP64__ and __LP64__ } 173 {$setc TARGET_CPU_64 := TRUE} 174 {$elsec} 175 {$setc TARGET_CPU_64 := FALSE} 176 {$endc} 177 178 {$ifc defined FPC_BIG_ENDIAN} 179 {$setc TARGET_RT_BIG_ENDIAN := TRUE} 180 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE} 181 {$elifc defined FPC_LITTLE_ENDIAN} 182 {$setc TARGET_RT_BIG_ENDIAN := FALSE} 183 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE} 184 {$elsec} 185 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.} 186 {$endc} 187 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE} 188 {$setc CALL_NOT_IN_CARBON := FALSE} 189 {$setc OLDROUTINENAMES := FALSE} 190 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE} 191 {$setc OPAQUE_UPP_TYPES := TRUE} 192 {$setc OTCARBONAPPLICATION := TRUE} 193 {$setc OTKERNEL := FALSE} 194 {$setc PM_USE_SESSION_APIS := TRUE} 195 {$setc TARGET_API_MAC_CARBON := TRUE} 196 {$setc TARGET_API_MAC_OS8 := FALSE} 197 {$setc TARGET_API_MAC_OSX := TRUE} 198 {$setc TARGET_CARBON := TRUE} 199 {$setc TARGET_CPU_68K := FALSE} 200 {$setc TARGET_CPU_MIPS := FALSE} 201 {$setc TARGET_CPU_SPARC := FALSE} 202 {$setc TARGET_OS_UNIX := FALSE} 203 {$setc TARGET_OS_WIN32 := FALSE} 204 {$setc TARGET_RT_MAC_68881 := FALSE} 205 {$setc TARGET_RT_MAC_CFM := FALSE} 206 {$setc TARGET_RT_MAC_MACHO := TRUE} 207 {$setc TYPED_FUNCTION_POINTERS := TRUE} 208 {$setc TYPE_BOOL := FALSE} 209 {$setc TYPE_EXTENDED := FALSE} 210 {$setc TYPE_LONGLONG := TRUE} 211 uses MacTypes, CFBase; 212 {$endc} {not MACOSALLINCLUDE} 213 214 215 {$ifc TARGET_OS_MAC} 216 217 {$ALIGN POWER} 218 219 var kAXFontTextAttribute: CFStringRef; external name '_kAXFontTextAttribute'; (* attribute const *) 220 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFDictionaryRef - see kAXFontTextAttribute keys below 221 var kAXForegroundColorTextAttribute: CFStringRef; external name '_kAXForegroundColorTextAttribute'; (* attribute const *) 222 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CGColorRef 223 var kAXBackgroundColorTextAttribute: CFStringRef; external name '_kAXBackgroundColorTextAttribute'; (* attribute const *) 224 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CGColorRef 225 var kAXUnderlineColorTextAttribute: CFStringRef; external name '_kAXUnderlineColorTextAttribute'; (* attribute const *) 226 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CGColorRef 227 var kAXStrikethroughColorTextAttribute: CFStringRef; external name '_kAXStrikethroughColorTextAttribute'; (* attribute const *) 228 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CGColorRef 229 var kAXUnderlineTextAttribute: CFStringRef; external name '_kAXUnderlineTextAttribute'; (* attribute const *) 230 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFNumberRef - AXUnderlineStyle 231 var kAXSuperscriptTextAttribute: CFStringRef; external name '_kAXSuperscriptTextAttribute'; (* attribute const *) 232 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFNumberRef = + number for superscript - for subscript 233 var kAXStrikethroughTextAttribute: CFStringRef; external name '_kAXStrikethroughTextAttribute'; (* attribute const *) 234 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFBooleanRef 235 var kAXShadowTextAttribute: CFStringRef; external name '_kAXShadowTextAttribute'; (* attribute const *) 236 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFBooleanRef 237 238 var kAXAttachmentTextAttribute: CFStringRef; external name '_kAXAttachmentTextAttribute'; (* attribute const *) 239 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // AXUIElementRef 240 var kAXLinkTextAttribute: CFStringRef; external name '_kAXLinkTextAttribute'; (* attribute const *) 241 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // AXUIElementRef 242 243 var kAXNaturalLanguageTextAttribute: CFStringRef; external name '_kAXNaturalLanguageTextAttribute'; (* attribute const *) 244 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFStringRef - the spoken language of the text 245 var kAXReplacementStringTextAttribute: CFStringRef; external name '_kAXReplacementStringTextAttribute'; (* attribute const *) 246 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFStringRef 247 248 var kAXMisspelledTextAttribute: CFStringRef; external name '_kAXMisspelledTextAttribute'; (* attribute const *) 249 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // AXUIElementRef 250 251 var kAXAutocorrectedTextAttribute: CFStringRef; external name '_kAXAutocorrectedTextAttribute'; (* attribute const *) 252 (* AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER *) // CFBooleanRef 253 254 // kAXFontTextAttribute keys 255 var kAXFontNameKey: CFStringRef; external name '_kAXFontNameKey'; (* attribute const *) 256 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFStringRef - required 257 var kAXFontFamilyKey: CFStringRef; external name '_kAXFontFamilyKey'; (* attribute const *) 258 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFStringRef - not required 259 var kAXVisibleNameKey: CFStringRef; external name '_kAXVisibleNameKey'; (* attribute const *) 260 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFStringRef - not required 261 var kAXFontSizeKey: CFStringRef; external name '_kAXFontSizeKey'; (* attribute const *) 262 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFNumberRef - required 263 264 const 265 kAXUnderlineStyleNone = $0; 266 kAXUnderlineStyleSingle = $1; 267 kAXUnderlineStyleThick = $2; 268 kAXUnderlineStyleDouble = $9; 269 type 270 AXUnderlineStyle = UInt32; 271 272 273 // DO NOT USE. This is an old, misspelled version of one of the above constants. 274 var kAXForegoundColorTextAttribute: CFStringRef; external name '_kAXForegoundColorTextAttribute'; (* attribute const *) 275 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CGColorRef 276 277 {$endc} {TARGET_OS_MAC} 278 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 279 280 end. 281 {$endc} {not MACOSALLINCLUDE} 282