2 * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef CHARACTER_STYLE_DATA_H
6 #define CHARACTER_STYLE_DATA_H
9 #include <Referenceable.h>
14 STRIKE_OUT_SINGLE
= 1,
27 class CharacterStyleData
;
28 typedef BReference
<CharacterStyleData
> CharacterStyleDataRef
;
31 // You cannot modify a CharacterStyleData object once it has been
32 // created. Instead, the setter methods return a new object that equals
33 // the object on which the method has been called, except for the changed
34 // property. If the property already has the requested value, then a
35 // reference to the same object is returned.
36 class CharacterStyleData
: public BReferenceable
{
40 const CharacterStyleData
& other
);
43 const CharacterStyleData
& other
) const;
45 const CharacterStyleData
& other
) const;
47 CharacterStyleDataRef
SetFont(const BFont
& font
);
48 inline const BFont
& Font() const
51 CharacterStyleDataRef
SetAscent(float ascent
);
53 // Returns the ascent of the configured font, unless the ascent
54 // has been overridden by a fixed value with SetAscent().
57 CharacterStyleDataRef
SetDescent(float descent
);
59 // Returns the descent of the configured font, unless the descent
60 // has been overridden by a fixed value with SetDescent().
61 float Descent() const;
63 CharacterStyleDataRef
SetWidth(float width
);
64 inline float Width() const
67 CharacterStyleDataRef
SetGlyphSpacing(float glyphSpacing
);
68 inline float GlyphSpacing() const
69 { return fGlyphSpacing
; }
71 CharacterStyleDataRef
SetForegroundColor(color_which which
);
72 CharacterStyleDataRef
SetForegroundColor(rgb_color color
);
73 inline rgb_color
ForegroundColor() const
75 inline color_which
WhichForegroundColor() const
76 { return fWhichFgColor
; }
78 CharacterStyleDataRef
SetBackgroundColor(color_which which
);
79 CharacterStyleDataRef
SetBackgroundColor(rgb_color color
);
80 inline rgb_color
BackgroundColor() const
82 inline color_which
WhichBackgroundColor() const
83 { return fWhichBgColor
; }
85 CharacterStyleDataRef
SetStrikeOutColor(color_which which
);
86 CharacterStyleDataRef
SetStrikeOutColor(rgb_color color
);
87 inline rgb_color
StrikeOutColor() const
88 { return fStrikeOutColor
; }
89 inline color_which
WhichStrikeOutColor() const
90 { return fWhichStrikeOutColor
; }
92 CharacterStyleDataRef
SetUnderlineColor(color_which which
);
93 CharacterStyleDataRef
SetUnderlineColor(rgb_color color
);
94 inline rgb_color
UnderlineColor() const
95 { return fUnderlineColor
; }
96 inline color_which
WhichUnderlineColor() const
97 { return fWhichUnderlineColor
; }
99 CharacterStyleDataRef
SetStrikeOut(uint8 strikeOut
);
100 inline uint8
StrikeOut() const
101 { return fStrikeOutStyle
; }
103 CharacterStyleDataRef
SetUnderline(uint8 underline
);
104 inline uint8
Underline() const
105 { return fUnderlineStyle
; }
109 CharacterStyleData
& operator=(const CharacterStyleData
& other
);
114 // The following three values override glyph metrics unless -1
115 // This is useful when you want to have a place-holder character
116 // in the text. You would assign this character a CharacterStyle
117 // which defines ascent, descent and width to fixed values, thereby
118 // controlling the exact dimensions of the character, regardless of
119 // font size. Instead of the character, one could render an icon
120 // that is layouted within the text.
125 // Additional spacing to be applied between glyphs.
128 color_which fWhichFgColor
;
129 color_which fWhichBgColor
;
131 color_which fWhichStrikeOutColor
;
132 color_which fWhichUnderlineColor
;
137 rgb_color fStrikeOutColor
;
138 rgb_color fUnderlineColor
;
140 uint8 fStrikeOutStyle
;
141 uint8 fUnderlineStyle
;
145 #endif // CHARACTER_STYLE_DATA_H