HaikuDepot: Added TextStyle convenience methods

* Empty constructor
 * Copy constructor
 * operator==(const TextStyle& other)
This commit is contained in:
Stephan Aßmus 2013-08-18 16:50:34 +02:00
parent 13e00959ac
commit aa26b5f5f0
2 changed files with 71 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;