19 #include "kateattribute.h"
21 KateAttribute::KateAttribute()
22 : m_weight(TQFont::Normal)
32 KateAttribute::~KateAttribute()
36 void KateAttribute::clear()
43 if (a.itemSet(Weight))
44 setWeight(a.weight());
46 if (a.itemSet(Italic))
47 setItalic(a.italic());
49 if (a.itemSet(Underline))
50 setUnderline(a.underline());
52 if (a.itemSet(Overline))
53 setOverline(a.overline());
55 if (a.itemSet(StrikeOut))
56 setStrikeOut(a.strikeOut());
58 if (a.itemSet(Outline))
59 setOutline(a.outline());
61 if (a.itemSet(TextColor))
62 setTextColor(a.textColor());
64 if (a.itemSet(SelectedTextColor))
65 setSelectedTextColor(a.selectedTextColor());
67 if (a.itemSet(BGColor))
68 setBGColor(a.bgColor());
70 if (a.itemSet(SelectedBGColor))
71 setSelectedBGColor(a.selectedBGColor());
76 TQFont KateAttribute::font(
const TQFont& ref)
81 ret.setWeight(weight());
83 ret.setItalic(italic());
84 if (itemSet(Underline))
85 ret.setUnderline(underline());
86 if (itemSet(Overline))
87 ret.setOverline(overline());
88 if (itemSet(StrikeOut))
89 ret.setStrikeOut(strikeOut());
94 void KateAttribute::setWeight(
int weight)
96 if (!(m_itemsSet & Weight) || m_weight != weight)
106 void KateAttribute::setBold(
bool enable)
108 setWeight(enable ? TQFont::Bold : TQFont::Normal);
111 void KateAttribute::setItalic(
bool enable)
113 if (!(m_itemsSet & Italic) || m_italic != enable)
115 m_itemsSet |= Italic;
123 void KateAttribute::setUnderline(
bool enable)
125 if (!(m_itemsSet & Underline) || m_underline != enable)
127 m_itemsSet |= Underline;
129 m_underline = enable;
135 void KateAttribute::setOverline(
bool enable)
137 if (!(m_itemsSet & Overline) || m_overline != enable)
139 m_itemsSet |= Overline;
147 void KateAttribute::setStrikeOut(
bool enable)
149 if (!(m_itemsSet & StrikeOut) || m_strikeout != enable)
151 m_itemsSet |= StrikeOut;
153 m_strikeout = enable;
159 void KateAttribute::setOutline(
const TQColor& color)
161 if (!(m_itemsSet & Outline) || m_outline != color)
163 m_itemsSet |= Outline;
171 void KateAttribute::setTextColor(
const TQColor& color)
173 if (!(m_itemsSet & TextColor) || m_textColor != color)
175 m_itemsSet |= TextColor;
183 void KateAttribute::setSelectedTextColor(
const TQColor& color)
185 if (!(m_itemsSet & SelectedTextColor) || m_selectedTextColor != color)
187 m_itemsSet |= SelectedTextColor;
189 m_selectedTextColor = color;
195 void KateAttribute::setBGColor(
const TQColor& color)
197 if (!(m_itemsSet & BGColor) || m_bgColor != color)
199 m_itemsSet |= BGColor;
207 void KateAttribute::setSelectedBGColor(
const TQColor& color)
209 if (!(m_itemsSet & SelectedBGColor) || m_selectedBGColor != color)
211 m_itemsSet |= SelectedBGColor;
213 m_selectedBGColor = color;
221 if (h1.m_itemsSet != h2.m_itemsSet)
224 if (h1.itemSet(KateAttribute::Weight))
225 if (h1.m_weight != h2.m_weight)
228 if (h1.itemSet(KateAttribute::Italic))
229 if (h1.m_italic != h2.m_italic)
232 if (h1.itemSet(KateAttribute::Underline))
233 if (h1.m_underline != h2.m_underline)
236 if (h1.itemSet(KateAttribute::StrikeOut))
237 if (h1.m_strikeout != h2.m_strikeout)
240 if (h1.itemSet(KateAttribute::Outline))
241 if (h1.m_outline != h2.m_outline)
244 if (h1.itemSet(KateAttribute::TextColor))
245 if (h1.m_textColor != h2.m_textColor)
248 if (h1.itemSet(KateAttribute::SelectedTextColor))
249 if (h1.m_selectedTextColor != h2.m_selectedTextColor)
252 if (h1.itemSet(KateAttribute::BGColor))
253 if (h1.m_bgColor != h2.m_bgColor)
256 if (h1.itemSet(KateAttribute::SelectedBGColor))
257 if (h1.m_selectedBGColor != h2.m_selectedBGColor)
The Attribute class incorporates all text decorations supported by Kate.