GA::kit v0.3
G&A's in-house C++ application framework
Loading...
Searching...
No Matches
ga::Paragraph Class Reference

#include <paragraph_component.h>

Inheritance diagram for ga::Paragraph:
ga::Component

Classes

struct  StyledText
 
struct  StyledToken
 
struct  Word
 

Public Types

enum class  HorzAlignment { LEFT , CENTER , RIGHT }
 
enum class  VertAlignment { TOP , MIDDLE , BOTTOM }
 

Public Member Functions

 Paragraph ()
 
ParagraphsetFont (std::shared_ptr< Font > font, bool resetLeadingAndSpacing=true)
 
std::shared_ptr< Font > getFont ()
 
ParagraphsetBoldFont (std::shared_ptr< Font > font)
 
std::shared_ptr< Font > getBoldFont ()
 
ParagraphsetItalicFont (std::shared_ptr< Font > font)
 
std::shared_ptr< Font > getItalicFont ()
 
ParagraphsetBoldItalicFont (std::shared_ptr< Font > font)
 
std::shared_ptr< Font > getBoldItalicFont ()
 
ParagraphsetText (std::string text)
 
std::string getText ()
 
ParagraphsetHorizontalAlignment (HorzAlignment alignment)
 
ParagraphsetVerticalAlignment (VertAlignment alignment)
 
HorzAlignment getHorizontalAlignment ()
 
VertAlignment getVerticalAlignment ()
 
ParagraphsetTextOffset (ga::vec3 textOffset)
 
ParagraphsetTextOffset (ga::vec2 textOffset)
 
ga::vec3 getTextOffset ()
 
ParagraphsetSize (ga::vec2 size)
 
ga::vec2 getSize ()
 
ParagraphsetTextColor (const ga::Color textColor)
 
ga::Color getTextColor ()
 
ParagraphsetLeading (float px)
 
float getLeading ()
 
ParagraphsetWordSpacing (float px)
 
float getWordSpacing ()
 
ParagraphsetIsMarkdownText (bool isMarkdown)
 
bool getIsMarkdownText () const
 
ParagraphsetFboCacheEnabled (bool enable)
 
bool getIsFboCacheEnabled ()
 
void draw ()
 
std::vector< ga::RectgetWordBounds ()
 
ga::Rect getParagraphBounds ()
 
int getNumberOfLines ()
 
void cleanLayout ()
 
- Public Member Functions inherited from ga::Component
 Component ()=default
 
virtual ~Component ()=default
 
 Component (const Component &other)
 
Componentoperator= (const Component &other)
 
std::shared_ptr< NodegetNode () const
 

Protected Types

enum class  FontStyle { REGULAR , BOLD , ITALIC , BOLD_ITALIC }
 

Protected Member Functions

std::shared_ptr< Font > fontForStyle (FontStyle style)
 
void calcWordRect (Word &word)
 
void drawParagraph (bool forceRedraw=false)
 
StyledText parseMarkdownStyles (const std::string &text)
 
void calculateTextFlow ()
 
- Protected Member Functions inherited from ga::Component
virtual void update ()
 
virtual void draw ()
 
virtual void setNode (std::shared_ptr< Node > node)
 
virtual void setScene (std::shared_ptr< Scene > scene)
 

Protected Attributes

std::vector< Wordm_words
 
std::vector< std::vector< Word * > > m_lines
 
std::string m_text
 
StyledText m_styledText
 
std::shared_ptr< Font > m_font
 
std::shared_ptr< Font > m_boldFont
 
std::shared_ptr< Font > m_italicFont
 
std::shared_ptr< Font > m_boldItalicFont
 
glm::vec3 m_offset
 
glm::vec2 m_size
 
ga::Color m_textColor
 
HorzAlignment m_hAlignment
 
VertAlignment m_vAlignment
 
float m_leading
 
float m_spacing
 
bool m_isMarkdownFormatted
 
ga::Fbo m_fbo
 
ga::Rect m_fboRect
 
bool m_isLayoutDirty = true
 
bool m_cacheToFbo = false
 
- Protected Attributes inherited from ga::Component
std::weak_ptr< Nodem_node
 

Member Enumeration Documentation

◆ FontStyle

enum class ga::Paragraph::FontStyle
strongprotected
Enumerator
REGULAR 
BOLD 
ITALIC 
BOLD_ITALIC 

◆ HorzAlignment

enum class ga::Paragraph::HorzAlignment
strong
Enumerator
LEFT 
CENTER 
RIGHT 

◆ VertAlignment

enum class ga::Paragraph::VertAlignment
strong
Enumerator
TOP 
MIDDLE 
BOTTOM 

Constructor & Destructor Documentation

◆ Paragraph()

ga::Paragraph::Paragraph ( )

Member Function Documentation

◆ calculateTextFlow()

void ga::Paragraph::calculateTextFlow ( )
inlineprotected

◆ calcWordRect()

void ga::Paragraph::calcWordRect ( Word word)
protected

◆ cleanLayout()

void ga::Paragraph::cleanLayout ( )

◆ draw()

void ga::Paragraph::draw ( )
virtual

Reimplemented from ga::Component.

◆ drawParagraph()

void ga::Paragraph::drawParagraph ( bool  forceRedraw = false)
inlineprotected

◆ fontForStyle()

std::shared_ptr< Font > ga::Paragraph::fontForStyle ( FontStyle  style)
inlineprotected

◆ getBoldFont()

std::shared_ptr< Font > ga::Paragraph::getBoldFont ( )
inline

◆ getBoldItalicFont()

std::shared_ptr< Font > ga::Paragraph::getBoldItalicFont ( )
inline

◆ getFont()

std::shared_ptr< Font > ga::Paragraph::getFont ( )
inline

◆ getHorizontalAlignment()

HorzAlignment ga::Paragraph::getHorizontalAlignment ( )
inline

◆ getIsFboCacheEnabled()

bool ga::Paragraph::getIsFboCacheEnabled ( )
inline

◆ getIsMarkdownText()

bool ga::Paragraph::getIsMarkdownText ( ) const
inline

◆ getItalicFont()

std::shared_ptr< Font > ga::Paragraph::getItalicFont ( )
inline

◆ getLeading()

float ga::Paragraph::getLeading ( )
inline

◆ getNumberOfLines()

int ga::Paragraph::getNumberOfLines ( )

◆ getParagraphBounds()

ga::Rect ga::Paragraph::getParagraphBounds ( )

◆ getSize()

ga::vec2 ga::Paragraph::getSize ( )
inline

◆ getText()

std::string ga::Paragraph::getText ( )
inline

◆ getTextColor()

ga::Color ga::Paragraph::getTextColor ( )
inline

◆ getTextOffset()

ga::vec3 ga::Paragraph::getTextOffset ( )
inline

◆ getVerticalAlignment()

VertAlignment ga::Paragraph::getVerticalAlignment ( )
inline

◆ getWordBounds()

std::vector< ga::Rect > ga::Paragraph::getWordBounds ( )

◆ getWordSpacing()

float ga::Paragraph::getWordSpacing ( )
inline

◆ parseMarkdownStyles()

Paragraph::StyledText ga::Paragraph::parseMarkdownStyles ( const std::string &  text)
protected

◆ setBoldFont()

Paragraph & ga::Paragraph::setBoldFont ( std::shared_ptr< Font >  font)

◆ setBoldItalicFont()

Paragraph & ga::Paragraph::setBoldItalicFont ( std::shared_ptr< Font >  font)

◆ setFboCacheEnabled()

Paragraph & ga::Paragraph::setFboCacheEnabled ( bool  enable)

◆ setFont()

Paragraph & ga::Paragraph::setFont ( std::shared_ptr< Font >  font,
bool  resetLeadingAndSpacing = true 
)

◆ setHorizontalAlignment()

Paragraph & ga::Paragraph::setHorizontalAlignment ( HorzAlignment  alignment)

◆ setIsMarkdownText()

Paragraph & ga::Paragraph::setIsMarkdownText ( bool  isMarkdown)

◆ setItalicFont()

Paragraph & ga::Paragraph::setItalicFont ( std::shared_ptr< Font >  font)

◆ setLeading()

Paragraph & ga::Paragraph::setLeading ( float  px)

◆ setSize()

Paragraph & ga::Paragraph::setSize ( ga::vec2  size)

◆ setText()

Paragraph & ga::Paragraph::setText ( std::string  text)

◆ setTextColor()

Paragraph & ga::Paragraph::setTextColor ( const ga::Color  textColor)

◆ setTextOffset() [1/2]

Paragraph & ga::Paragraph::setTextOffset ( ga::vec2  textOffset)
inline

◆ setTextOffset() [2/2]

Paragraph & ga::Paragraph::setTextOffset ( ga::vec3  textOffset)

◆ setVerticalAlignment()

Paragraph & ga::Paragraph::setVerticalAlignment ( VertAlignment  alignment)

◆ setWordSpacing()

Paragraph & ga::Paragraph::setWordSpacing ( float  px)

Member Data Documentation

◆ m_boldFont

std::shared_ptr<Font> ga::Paragraph::m_boldFont
protected

◆ m_boldItalicFont

std::shared_ptr<Font> ga::Paragraph::m_boldItalicFont
protected

◆ m_cacheToFbo

bool ga::Paragraph::m_cacheToFbo = false
protected

◆ m_fbo

ga::Fbo ga::Paragraph::m_fbo
protected

◆ m_fboRect

ga::Rect ga::Paragraph::m_fboRect
protected

◆ m_font

std::shared_ptr<Font> ga::Paragraph::m_font
protected

◆ m_hAlignment

HorzAlignment ga::Paragraph::m_hAlignment
protected

◆ m_isLayoutDirty

bool ga::Paragraph::m_isLayoutDirty = true
protected

◆ m_isMarkdownFormatted

bool ga::Paragraph::m_isMarkdownFormatted
protected

◆ m_italicFont

std::shared_ptr<Font> ga::Paragraph::m_italicFont
protected

◆ m_leading

float ga::Paragraph::m_leading
protected

◆ m_lines

std::vector<std::vector<Word*> > ga::Paragraph::m_lines
protected

◆ m_offset

glm::vec3 ga::Paragraph::m_offset
protected

◆ m_size

glm::vec2 ga::Paragraph::m_size
protected

◆ m_spacing

float ga::Paragraph::m_spacing
protected

◆ m_styledText

StyledText ga::Paragraph::m_styledText
protected

◆ m_text

std::string ga::Paragraph::m_text
protected

◆ m_textColor

ga::Color ga::Paragraph::m_textColor
protected

◆ m_vAlignment

VertAlignment ga::Paragraph::m_vAlignment
protected

◆ m_words

std::vector<Word> ga::Paragraph::m_words
protected

The documentation for this class was generated from the following files: