diff --git a/src/apps/haiku-depot/textview/TextStyle.cpp b/src/apps/haiku-depot/textview/TextStyle.cpp index 04bd9da5bd..a96ccb10fe 100644 --- a/src/apps/haiku-depot/textview/TextStyle.cpp +++ b/src/apps/haiku-depot/textview/TextStyle.cpp @@ -6,6 +6,28 @@ #include "TextStyle.h" +TextStyle::TextStyle() + : + font(), + + ascent(0.0f), + descent(0.0f), + width(-1.0f), + glyphSpacing(0.0f), + + fgColor((rgb_color){ 0, 0, 0, 255 }), + bgColor((rgb_color){ 255, 255, 255, 255 }), + + strikeOut(false), + strikeOutColor((rgb_color){ 0, 0, 0, 255 }), + + underline(false), + underlineStyle(0), + underlineColor((rgb_color){ 0, 0, 0, 255 }) +{ +} + + TextStyle::TextStyle(const BFont& font, float ascent, float descent, float width, float glyphSpacing, rgb_color fgColor, rgb_color bgColor, bool strikeOut, rgb_color strikeOutColor, bool underline, @@ -29,3 +51,47 @@ TextStyle::TextStyle(const BFont& font, float ascent, float descent, underlineColor(underlineColor) { } + + +TextStyle::TextStyle(const TextStyle& other) + : + font(other.font), + + ascent(other.ascent), + descent(other.descent), + width(other.width), + glyphSpacing(other.glyphSpacing), + + fgColor(other.fgColor), + bgColor(other.bgColor), + + strikeOut(other.strikeOut), + strikeOutColor(other.strikeOutColor), + + underline(other.underline), + underlineStyle(other.underlineStyle), + underlineColor(other.underlineColor) +{ +} + + +bool +TextStyle::operator==(const TextStyle& other) const +{ + return font == other.font + + && ascent == other.ascent + && descent == other.descent + && width == other.width + && glyphSpacing == other.glyphSpacing + + && fgColor == other.fgColor + && bgColor == other.bgColor + + && strikeOut == other.strikeOut + && strikeOutColor == other.strikeOutColor + + && underline == other.underline + && underlineStyle == other.underlineStyle + && underlineColor == other.underlineColor; +} diff --git a/src/apps/haiku-depot/textview/TextStyle.h b/src/apps/haiku-depot/textview/TextStyle.h index 3a359c210c..5f6643e2ed 100644 --- a/src/apps/haiku-depot/textview/TextStyle.h +++ b/src/apps/haiku-depot/textview/TextStyle.h @@ -12,12 +12,17 @@ class TextStyle : public BReferenceable { public: + TextStyle(); TextStyle(const BFont& font, float ascent, float descent, float width, float glyphSpacing, rgb_color fgColor, rgb_color bgColor, bool strikeOut, rgb_color strikeOutColor, bool underline, uint32 underlineStyle, rgb_color underlineColor); + TextStyle(const TextStyle& other); + + bool operator==(const TextStyle& other) const; + public: BFont font;