Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <painttext.h>
Classes | |
struct | LayoutState |
struct | TextFragment |
struct | TextLine |
Public Types | |
enum | WidthExceeded { FULL_WIDTH, ELLIPSIS, MULTI_LINE } |
Public Member Functions | |
virtual void | setRect (const Rect &r) |
virtual Rect | rect (void) const |
virtual void | setText (const std::string &text) |
virtual const std::string & | text (void) const |
virtual void | setColor (const GFXColor &c) |
virtual GFXColor | color (void) const |
virtual void | setFont (const Font &f) |
virtual Font | font (void) const |
virtual void | setJustification (Justification j) |
virtual Justification | justification (void) const |
virtual void | setWidthExceeded (WidthExceeded w) |
virtual WidthExceeded | widthExceeded (void) const |
virtual int | lineCount (void) const |
virtual int | visibleLineCountStartingWith (int lineNumber, float vertInterval) const |
virtual int | layoutVersion (void) const |
virtual void | drawLines (size_t start, size_t count=END_LINE) const |
void | draw (void) const |
PaintText (void) | |
PaintText (const Rect &rect, const std::string &text, const Font &font, const GFXColor &color, Justification just=RIGHT_JUSTIFY, WidthExceeded w=ELLIPSIS) | |
virtual | ~PaintText (void) |
Static Public Attributes | |
static const size_t | END_LINE = 1000000 |
Protected Member Functions | |
void | calcLayout (void) |
void | calcLayoutIfNeeded (void) const |
float | lineInset (const TextLine &line) |
void | addFragment (TextLine &line, const std::string::size_type endPos, std::string::size_type &startPos, double &width) |
void | parseFormat (std::string::size_type startPos, std::string::size_type *resultPos, bool *endLine) |
void | parseFragmentsWithCharBreak (TextLine &line, std::string::size_type startPos, std::string::size_type endPos, float maxWidth, bool ellipsis, std::string::size_type *resultPos) |
void | parseFragmentsWithWordBreak (TextLine &line, std::string::size_type startPos, float maxWidth, std::string::size_type *resultPos) |
Protected Attributes | |
Rect | m_rect |
std::string | m_text |
GFXColor | m_color |
Font | m_font |
Justification | m_justification |
WidthExceeded | m_widthExceeded |
bool | m_needLayout |
int | m_layoutVersion |
vector< TextLine > | m_lines |
double | m_verticalScaling |
double | m_horizontalScaling |
LayoutState | m_layout |
Definition at line 75 of file painttext.h.
PaintText::PaintText | ( | void | ) |
Definition at line 760 of file painttext.cpp.
PaintText::PaintText | ( | const Rect & | rect, |
const std::string & | text, | ||
const Font & | font, | ||
const GFXColor & | color, | ||
Justification | just = RIGHT_JUSTIFY , |
||
WidthExceeded | w = ELLIPSIS |
||
) |
|
inlinevirtual |
Definition at line 153 of file painttext.h.
|
protected |
Definition at line 432 of file painttext.cpp.
References Font::charWidth(), charWidth(), PaintText::TextFragment::color, PaintText::LayoutState::colorStack, PaintText::TextFragment::end, font(), PaintText::TextFragment::font, PaintText::LayoutState::fontStack, PaintText::TextLine::fragments, m_layout, m_text, and PaintText::TextFragment::start.
Referenced by parseFragmentsWithCharBreak().
|
protected |
Definition at line 674 of file painttext.cpp.
References PaintText::TextLine::baseLine, BOGUS_LINE_SPACING, PaintText::LayoutState::colorStack, PaintText::LayoutState::currentLineSpacing, ELLIPSIS, PaintText::LayoutState::fontStack, PaintText::TextLine::fragments, VegaConfig::getVariable(), Size::height, PaintText::TextLine::height, Font::horizontalScaling(), lineInset(), LINES_RESERVE, m_color, m_font, m_horizontalScaling, m_layout, m_layoutVersion, m_lines, m_needLayout, m_rect, m_text, m_verticalScaling, m_widthExceeded, MULTI_LINE, XMLSupport::parse_float(), parseFragmentsWithCharBreak(), parseFragmentsWithWordBreak(), PaintText::LayoutState::permanentLineSpacing, REFERENCE_BASELINE_POS, REFERENCE_FONT_ASCENDER, Font::size(), Rect::size, Font::verticalScaling(), vs_config, Size::width, and PaintText::TextLine::x.
Referenced by calcLayoutIfNeeded().
|
protected |
Definition at line 190 of file painttext.cpp.
References calcLayout(), and m_needLayout.
Referenced by drawLines(), layoutVersion(), lineCount(), and visibleLineCountStartingWith().
|
inlinevirtual |
Definition at line 94 of file painttext.h.
References m_color.
Referenced by parseFormat(), and StaticDisplay::textColor().
|
inline |
Definition at line 140 of file painttext.h.
References drawLines().
Referenced by Picker::draw(), and NewButton::draw().
|
virtual |
Definition at line 218 of file painttext.cpp.
References PaintText::TextLine::baseLine, calcLayoutIfNeeded(), drawChars(), ELLIPSIS_FRAGMENT, ELLIPSIS_STRING, PaintText::TextLine::fragments, GFXBlendMode(), GFXColorf(), GFXPopBlendMode(), GFXPushBlendMode(), GFXToggleTexture(), gl_options, guiMin, PaintText::TextLine::height, i, INVSRCALPHA, LINE_HEIGHT_EPSILON, m_horizontalScaling, m_lines, m_rect, m_text, m_verticalScaling, Rect::origin, gl_options_t::smooth_lines, SRCALPHA, Rect::top(), useStroke(), PaintText::TextLine::x, Point::x, and Point::y.
Referenced by StaticDisplay::draw(), and draw().
|
inlinevirtual |
Definition at line 101 of file painttext.h.
References m_font.
Referenced by addFragment(), StaticDisplay::font(), parseFragmentsWithCharBreak(), and parseFragmentsWithWordBreak().
|
inlinevirtual |
Definition at line 108 of file painttext.h.
References m_justification.
Referenced by StaticDisplay::justification().
|
virtual |
Definition at line 183 of file painttext.cpp.
References calcLayoutIfNeeded(), and m_layoutVersion.
Referenced by StaticDisplay::draw().
|
virtual |
Definition at line 159 of file painttext.cpp.
References calcLayoutIfNeeded(), and m_lines.
Referenced by StaticDisplay::draw().
Definition at line 662 of file painttext.cpp.
References CENTER_JUSTIFY, LEFT_JUSTIFY, m_horizontalScaling, m_justification, m_rect, Rect::size, Size::width, and PaintText::TextLine::width.
Referenced by calcLayout().
|
protected |
Definition at line 343 of file painttext.cpp.
References BOGUS_LINE_SPACING, BOLD_STROKE, color(), PaintText::LayoutState::colorStack, PaintText::LayoutState::currentLineSpacing, DT_FORMAT_COLOR_CHAR, DT_FORMAT_LINE_SPACING_CHAR, DT_FORMAT_NEWLINE_CHAR, DT_FORMAT_POP_CHAR, DT_FORMAT_RESET_CHAR, DT_FORMAT_STROKE_CHAR, f, PaintText::LayoutState::fontStack, m_layout, m_text, parseFormatColor(), parseFormatFloat(), and PaintText::LayoutState::permanentLineSpacing.
Referenced by parseFragmentsWithCharBreak(), and parseFragmentsWithWordBreak().
|
protected |
Definition at line 468 of file painttext.cpp.
References addFragment(), Font::charWidth(), DT_FORMAT_CHAR, ELLIPSIS_FRAGMENT, ELLIPSIS_STRING, PaintText::TextFragment::end, font(), PaintText::TextFragment::font, PaintText::LayoutState::fontStack, PaintText::TextLine::fragments, i, isWordBreak(), m_layout, m_text, parseFormat(), PaintText::TextFragment::start, Font::stringWidth(), and PaintText::TextLine::width.
Referenced by calcLayout(), and parseFragmentsWithWordBreak().
|
protected |
Definition at line 582 of file painttext.cpp.
References Font::charWidth(), charWidth(), DT_FORMAT_CHAR, font(), PaintText::LayoutState::fontStack, isWordBreak(), m_layout, m_text, parseFormat(), and parseFragmentsWithCharBreak().
Referenced by calcLayout().
|
inlinevirtual |
|
virtual |
Definition at line 123 of file painttext.cpp.
References c, equalColors(), m_color, and m_needLayout.
Referenced by Picker::draw(), NewButton::draw(), and StaticDisplay::setTextColor().
|
virtual |
Definition at line 132 of file painttext.cpp.
References m_font, and m_needLayout.
Referenced by Picker::draw(), NewButton::draw(), and StaticDisplay::setFont().
|
virtual |
Definition at line 141 of file painttext.cpp.
References m_justification, and m_needLayout.
Referenced by NewButton::draw(), and StaticDisplay::setJustification().
|
virtual |
Definition at line 92 of file painttext.cpp.
References m_needLayout, and m_rect.
Referenced by Picker::draw(), NewButton::draw(), and StaticDisplay::setPaintTextRect().
|
virtual |
Definition at line 101 of file painttext.cpp.
References i, m_needLayout, m_text, OLD_FORMAT_NEWLINE, and text().
Referenced by Picker::draw(), NewButton::draw(), PaintText(), and StaticDisplay::setText().
|
virtual |
Definition at line 150 of file painttext.cpp.
References m_needLayout, and m_widthExceeded.
Referenced by StaticDisplay::setMultiLine().
|
inlinevirtual |
Definition at line 87 of file painttext.h.
References m_text.
Referenced by setText(), and StaticDisplay::text().
Definition at line 166 of file painttext.cpp.
References calcLayoutIfNeeded(), i, LINE_HEIGHT_EPSILON, and m_lines.
Referenced by StaticDisplay::draw().
|
inlinevirtual |
Definition at line 123 of file painttext.h.
References m_widthExceeded.
Referenced by StaticDisplay::multiLine().
|
static |
Definition at line 138 of file painttext.h.
|
protected |
Definition at line 239 of file painttext.h.
Referenced by calcLayout(), color(), and setColor().
|
protected |
Definition at line 240 of file painttext.h.
Referenced by calcLayout(), font(), and setFont().
|
protected |
Definition at line 248 of file painttext.h.
Referenced by calcLayout(), drawLines(), and lineInset().
|
protected |
Definition at line 241 of file painttext.h.
Referenced by justification(), lineInset(), and setJustification().
|
protected |
Definition at line 249 of file painttext.h.
Referenced by addFragment(), calcLayout(), parseFormat(), parseFragmentsWithCharBreak(), and parseFragmentsWithWordBreak().
|
protected |
Definition at line 245 of file painttext.h.
Referenced by calcLayout(), and layoutVersion().
|
protected |
Definition at line 246 of file painttext.h.
Referenced by calcLayout(), drawLines(), lineCount(), and visibleLineCountStartingWith().
|
protected |
Definition at line 244 of file painttext.h.
Referenced by calcLayout(), calcLayoutIfNeeded(), setColor(), setFont(), setJustification(), setRect(), setText(), and setWidthExceeded().
|
protected |
Definition at line 237 of file painttext.h.
Referenced by calcLayout(), drawLines(), lineInset(), rect(), and setRect().
|
protected |
Definition at line 238 of file painttext.h.
Referenced by addFragment(), calcLayout(), drawLines(), parseFormat(), parseFragmentsWithCharBreak(), parseFragmentsWithWordBreak(), setText(), and text().
|
protected |
Definition at line 247 of file painttext.h.
Referenced by calcLayout(), and drawLines().
|
protected |
Definition at line 242 of file painttext.h.
Referenced by calcLayout(), setWidthExceeded(), and widthExceeded().