HaikuDepot: Added TextStyle convenience methods
* Empty constructor * Copy constructor * operator==(const TextStyle& other)
This commit is contained in:
parent
13e00959ac
commit
aa26b5f5f0
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user