HaikuDepot: Give access to glyph spacing

* The implementation for the get-accessors was missing
   from CharacterStyle.
This commit is contained in:
Stephan Aßmus
2013-09-05 10:23:11 +02:00
parent 9fc9619079
commit 2b7ea89d14
4 changed files with 111 additions and 0 deletions
@@ -66,6 +66,13 @@ CharacterStyle::SetFont(const BFont& font)
}
const BFont&
CharacterStyle::Font() const
{
return fStyleData->Font();
}
bool
CharacterStyle::SetAscent(float ascent)
{
@@ -78,6 +85,13 @@ CharacterStyle::SetAscent(float ascent)
}
float
CharacterStyle::Ascent() const
{
return fStyleData->Ascent();
}
bool
CharacterStyle::SetDescent(float descent)
{
@@ -90,6 +104,13 @@ CharacterStyle::SetDescent(float descent)
}
float
CharacterStyle::Descent() const
{
return fStyleData->Descent();
}
bool
CharacterStyle::SetWidth(float width)
{
@@ -102,6 +123,32 @@ CharacterStyle::SetWidth(float width)
}
float
CharacterStyle::Width() const
{
return fStyleData->Width();
}
bool
CharacterStyle::SetGlyphSpacing(float spacing)
{
CharacterStyleDataRef data = fStyleData->SetGlyphSpacing(spacing);
if (data == fStyleData)
return data->GlyphSpacing() == spacing;
fStyleData = data;
return true;
}
float
CharacterStyle::GlyphSpacing() const
{
return fStyleData->GlyphSpacing();
}
bool
CharacterStyle::SetForegroundColor(rgb_color color)
{
@@ -114,6 +161,13 @@ CharacterStyle::SetForegroundColor(rgb_color color)
}
rgb_color
CharacterStyle::ForegroundColor() const
{
return fStyleData->ForegroundColor();
}
bool
CharacterStyle::SetBackgroundColor(rgb_color color)
{
@@ -126,6 +180,13 @@ CharacterStyle::SetBackgroundColor(rgb_color color)
}
rgb_color
CharacterStyle::BackgroundColor() const
{
return fStyleData->BackgroundColor();
}
bool
CharacterStyle::SetStrikeOutColor(rgb_color color)
{
@@ -138,6 +199,13 @@ CharacterStyle::SetStrikeOutColor(rgb_color color)
}
rgb_color
CharacterStyle::StrikeOutColor() const
{
return fStyleData->StrikeOutColor();
}
bool
CharacterStyle::SetUnderlineColor(rgb_color color)
{
@@ -150,6 +218,13 @@ CharacterStyle::SetUnderlineColor(rgb_color color)
}
rgb_color
CharacterStyle::UnderlineColor() const
{
return fStyleData->UnderlineColor();
}
bool
CharacterStyle::SetStrikeOut(uint8 strikeOut)
{
@@ -162,6 +237,13 @@ CharacterStyle::SetStrikeOut(uint8 strikeOut)
}
uint8
CharacterStyle::StrikeOut() const
{
return fStyleData->StrikeOut();
}
bool
CharacterStyle::SetUnderline(uint8 underline)
{
@@ -174,3 +256,10 @@ CharacterStyle::SetUnderline(uint8 underline)
}
uint8
CharacterStyle::Underline() const
{
return fStyleData->Underline();
}
@@ -29,6 +29,9 @@ public:
bool SetWidth(float width);
float Width() const;
bool SetGlyphSpacing(float spacing);
float GlyphSpacing() const;
bool SetForegroundColor(rgb_color color);
rgb_color ForegroundColor() const;
@@ -140,6 +140,21 @@ CharacterStyleData::SetWidth(float width)
}
CharacterStyleDataRef
CharacterStyleData::SetGlyphSpacing(float glyphSpacing)
{
if (fGlyphSpacing == glyphSpacing)
return CharacterStyleDataRef(this);
CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this);
if (ret == NULL)
return CharacterStyleDataRef(this);
ret->fGlyphSpacing = glyphSpacing;
return CharacterStyleDataRef(ret, true);
}
CharacterStyleDataRef
CharacterStyleData::SetForegroundColor(rgb_color color)
{
@@ -57,6 +57,10 @@ public:
inline float Width() const
{ return fWidth; }
CharacterStyleDataRef SetGlyphSpacing(float glyphSpacing);
inline float GlyphSpacing() const
{ return fGlyphSpacing; }
CharacterStyleDataRef SetForegroundColor(rgb_color color);
inline rgb_color ForegroundColor() const
{ return fFgColor; }