root/Trunk/AIUtilities.framework/Versions/A/Headers/AITextAttributes.h @ 2

Revision 2, 6.1 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1/*-------------------------------------------------------------------------------------------------------*\
2| Adium, Copyright (C) 2001-2005, Adam Iser  (adamiser@mac.com | http://www.adiumx.com)                   |
3\---------------------------------------------------------------------------------------------------------/
4 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU
5 | General Public License as published by the Free Software Foundation; either version 2 of the License,
6 | or (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
10 | Public License for more details.
11 |
12 | You should have received a copy of the GNU General Public License along with this program; if not,
13 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
14 \------------------------------------------------------------------------------------------------------ */
15
16#define AIBodyColorAttributeName        @"AIBodyColor"
17
18/*!
19 * @class AITextAttributes
20 * @brief Encapsulates attributes that can be applied to a block of text
21 *
22 * Allows easy modification of various attributes which can be applied to a block of texxt.  To use, simply use its -[AITextAttributes dictionary] method to return an <tt>NSDictionary</tt> suitable for passing to <tt>NSAttributedString</tt> or the like.
23 */
24@interface AITextAttributes : NSObject<NSCopying> {
25    NSMutableDictionary *dictionary;
26
27    NSString                    *fontFamilyName;
28    NSFontTraitMask             fontTraitsMask;
29    int                                 fontSize;
30}
31
32/*!
33 * @brief Create a new <tt>AITextAttributes</tt> instance
34 *
35 * @param inFamilyName The family name for font attributes
36 * @param inTraits      <tt>NSFontTraitMask</tt> of initial traits.  Pass 0 for no traits.
37 * @param inSize Font point size
38 * @return The newly created (autoreleased) <tt>AITextAttributes</tt> object
39*/
40+ (id)textAttributesWithFontFamily:(NSString *)inFamilyName traits:(NSFontTraitMask)inTraits size:(int)inSize;
41
42/*!
43 * @brief Create a new <tt>AITextAttributes</tt> instance from a dictionary of attributes
44 *
45 * @param inAttributes A dictionary of attributes such as is returned by <tt>NSAttributedString</tt>'s attributesAtIndex:effectiveRange:
46 * @return The newly created (autoreleased) <tt>AITextAttributes</tt> object
47 */
48+ (id)textAttributesWithDictionary:(NSDictionary *)inAttributes;
49
50/*!
51 * @brief Return the dictionary of attributes
52 *
53 * Return the dictionary of attributes of this <tt>AITextAttributes</tt> suitable for passing to <tt>NSAttributedString</tt> or the like.
54 * @return The <tt>NSDictionary</tt> of attributes
55 */
56- (NSDictionary *)dictionary;
57
58/*!
59 * @brief Reset the font-related attributes.
60 *
61 * This sets to default values font family, font size, foreground color, background color, and language value.
62 */
63- (void)resetFontAttributes;
64
65/*!
66 * @brief Set the font family
67 *
68 * Set the font family
69 * @param inFamilyName The family name for font attributes
70*/       
71- (void)setFontFamily:(NSString *)inFamilyName;
72
73/*!
74 * @brief Font family
75 */
76- (NSString *)fontFamily;
77
78/*!
79 * @brief Set the font size
80 *
81 * Set the font size
82 * @param inSize Font point size
83*/     
84- (void)setFontSize:(int)inSize;
85
86- (int)fontSize;
87
88/*!
89 * @brief Add a trait to the current mask
90 *
91 * Add an <tt>NSFontTraitMask</tt> to the current mask of traits
92 * @param inTrait The <tt>NSFontTraitMask</tt> to add
93 */
94- (void)enableTrait:(NSFontTraitMask)inTrait;
95
96/*!
97 * @brief Remove a trait from the current mask
98 *
99 * Remove an <tt>NSFontTraitMask</tt> from the current mask of traits
100 * @param inTrait The <tt>NSFontTraitMask</tt> to remove
101 */
102- (void)disableTrait:(NSFontTraitMask)inTrait;
103
104- (NSFontTraitMask)traits;
105
106/*!
107 * @brief Set the underline attribute
108 *
109 * Set the underline attribute
110 * @param inUnderline A BOOL of the new underline attribute
111 */
112- (void)setUnderline:(BOOL)inUnderline;
113
114- (BOOL)underline;
115/*!
116 * @brief Set the strikethrough attribute
117 *
118 * Set the strikethrough attribute
119 * @param inStrikethrough A BOOL of the new strikethrough attribute
120 */
121- (void)setStrikethrough:(BOOL)inStrikethrough;
122
123- (BOOL)strikethrough;
124/*!
125 * @brief Set the subscript attribute
126 *
127 * Set the subscript attribute
128 * @param inSubscript A BOOL of the new subscript attribute
129 */
130- (void)setSubscript:(BOOL)inSubscript;
131
132/*!
133 * @brief Set the superscript attribute
134 *
135 * Set the superscript attribute
136 * @param inSuperscript A BOOL of the new superscript attribute
137 */
138- (void)setSuperscript:(BOOL)inSuperscript;
139
140/*!
141 * @brief Set the text foreground color
142 *
143 * Set  the text foreground color
144 * @param inColor A <tt>NSColor</tt> of the new text foreground color
145 */
146- (void)setTextColor:(NSColor *)inColor;
147
148- (NSColor *)textColor;
149
150/*!
151 * @brief Set the text background color
152 *
153 * Set the text background color.  This is drawn only behind the text.
154 * @param inColor A <tt>NSColor</tt> of the new text background color
155 */
156- (void)setTextBackgroundColor:(NSColor *)inColor;
157
158- (NSColor *)textBackgroundColor;
159
160/*!
161 * @brief Set the background color
162 *
163 * Set the background color which should be used for the entire rectangle containing the text. It is stored under the key   It is stored under the key <b>AIBodyColorAttributeName</b>. It is the responsibility of drawing code elsewhere to make use of this value if desired.
164 * @param inColor A <tt>NSColor</tt> of the new background color
165 */
166- (void)setBackgroundColor:(NSColor *)inColor;
167
168- (NSColor *)backgroundColor;
169
170/*!
171 * @brief Set a link attribute
172 *
173 * Set a URL to be associated with these attributes.
174 * @param inURL An <tt>NSURL</tt> of the link URL
175 */
176- (void)setLinkURL:(NSURL *)inURL;
177
178/*!
179 * @brief Set the language value
180 *
181 * No relevance to normal display; may be used for internal bookkeeping or the like
182 * @param inLanguageValue The language value
183 */
184- (void)setLanguageValue:(id)inLanguageValue;
185
186/*!
187 * @brief Retrieve the language value
188 *
189 * No relevance to normal display; may be used for internal bookkeeping or the like
190 */
191- (id)languageValue;
192
193- (void)setWritingDirection:(NSWritingDirection)inDirection;
194
195@end
Note: See TracBrowser for help on using the browser.