xref: /haiku/src/apps/haikudepot/textview/CharacterStyle.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef CHARACTER_STYLE_H
6 #define CHARACTER_STYLE_H
7 
8 #include "CharacterStyleData.h"
9 
10 
11 class CharacterStyle {
12 public:
13 								CharacterStyle();
14 								CharacterStyle(const CharacterStyle& other);
15 
16 			CharacterStyle&		operator=(const CharacterStyle& other);
17 			bool				operator==(const CharacterStyle& other) const;
18 			bool				operator!=(const CharacterStyle& other) const;
19 
20 			bool				SetFont(const BFont& font);
21 			const BFont&		Font() const;
22 
23 			bool				SetFontSize(float size);
24 			float				FontSize() const;
25 
26 			bool				SetBold(bool bold);
27 			bool				IsBold() const;
28 
29 			bool				SetItalic(bool italic);
30 			bool				IsItalic() const;
31 
32 			bool				SetAscent(float ascent);
33 			float				Ascent() const;
34 
35 			bool				SetDescent(float descent);
36 			float				Descent() const;
37 
38 			bool				SetWidth(float width);
39 			float				Width() const;
40 
41 			bool				SetGlyphSpacing(float spacing);
42 			float				GlyphSpacing() const;
43 
44 			bool				SetForegroundColor(
45 									uint8 r, uint8 g, uint8 b,
46 									uint8 a = 255);
47 			bool				SetForegroundColor(color_which which);
48 			bool				SetForegroundColor(rgb_color color);
49 			rgb_color			ForegroundColor() const;
50 			color_which			WhichForegroundColor() const;
51 
52 			bool				SetBackgroundColor(
53 									uint8 r, uint8 g, uint8 b,
54 									uint8 a = 255);
55 			bool				SetBackgroundColor(color_which which);
56 			bool				SetBackgroundColor(rgb_color color);
57 			rgb_color			BackgroundColor() const;
58 			color_which			WhichBackgroundColor() const;
59 
60 			bool				SetStrikeOutColor(color_which which);
61 			bool				SetStrikeOutColor(rgb_color color);
62 			rgb_color			StrikeOutColor() const;
63 			color_which			WhichStrikeOutColor() const;
64 
65 			bool				SetUnderlineColor(color_which which);
66 			bool				SetUnderlineColor(rgb_color color);
67 			rgb_color			UnderlineColor() const;
68 			color_which			WhichUnderlineColor() const;
69 
70 			bool				SetStrikeOut(uint8 strikeOut);
71 			uint8				StrikeOut() const;
72 
73 			bool				SetUnderline(uint8 underline);
74 			uint8				Underline() const;
75 
76 private:
77 			BFont				_FindFontForFace(uint16 face) const;
78 
79 private:
80 			CharacterStyleDataRef fStyleData;
81 };
82 
83 
84 #endif // CHARACTER_STYLE_H
85