class ffw::GuiText
Class List > ffw :: GuiText
Create a text widget. More...
Inherits the following classes: ffw::GuiWidget
Classes
Type | Name |
---|---|
struct | Paragraph |
struct | Style |
Public Functions
Type | Name |
---|---|
GuiText (GuiWindow * context) | |
virtual | ~GuiText () = default |
Paragraph * | addParagraph (const std::string & text) |
Paragraph * | addParagraph (const std::string & text, const Color & color, const GuiFont * font) |
const std::list< Paragraph > & | getParagraphs () const |
void | setStyle (const GuiText::Style * style, bool defaults = false) |
virtual ffw::Pointf | getMinimumWrapSize () override |
Detailed Description
This widget is simply a little more advanced ffw::GuiLabel. If you are looking for user input widget, see ffw::GuiTextInput
auto gui = ffw::GuiWindowNanoVG(nvg);
auto root = gui.getLayout();
// Make sure these three instances of font
// are alive while the GUI is rendering!
// If you free these fonts before gui.update() or
// gui.render() it will cause the program to crash!
auto fontRegular = ffw::GuiFontFineGraphics(canvas, "FreeSans.ttf", 16.0f))
auto fontBold = ffw::GuiFontFineGraphics(canvas, "FreeSansBold.ttf", 32.0f);
auto fontItalic = ffw::GuiFontFineGraphics(canvas, "FreeSansOblique.ttf", 16.0f);
auto text = new ffw::GuiText(&gui);
text->addParagraph("Title", ffw::rgb(10, 10, 10), fontBold.get());
text->addParagraph("Lorem Ipsum Donor");
text->addParagraph("Italic text", ffw::rgb(10, 90, 180), fontItalic.get());
root->addWidget(text);
// Do not free the created widgets! They will be deleted by the gui window!
while(true){
// Render the gui
}
Public Functions Documentation
function GuiText
ffw::GuiText::GuiText (
GuiWindow * context
)
function ~GuiText
virtual ffw::GuiText::~GuiText () = default
function addParagraph (1/2)
Paragraph * ffw::GuiText::addParagraph (
const std::string & text
)
function addParagraph (2/2)
Paragraph * ffw::GuiText::addParagraph (
const std::string & text,
const Color & color,
const GuiFont * font
)
function getParagraphs
const std::list< Paragraph > & ffw::GuiText::getParagraphs () const
function setStyle
void ffw::GuiText::setStyle (
const GuiText::Style * style,
bool defaults = false
)
function getMinimumWrapSize
virtual ffw::Pointf ffw::GuiText::getMinimumWrapSize ()
Implements GuiWidget::getMinimumWrapSize
The documentation for this class was generated from the following file: include/ffw/gui/guitext.h