15Elements Split(
const std::string& the_text) {
17 std::stringstream ss(the_text);
19 while (std::getline(ss, word,
' ')) {
20 output.push_back(
text(word));
26 const std::function<
Element(std::string)>& f) {
30 while (std::getline(ss, line,
'\n')) {
31 output.push_back(f(line));
33 return vbox(std::move(output));
50 return Split(the_text, [](
const std::string& line) {
52 return flexbox(Split(line), config);
61 return Split(the_text, [](
const std::string& line) {
64 return flexbox(Split(line), config);
73 return Split(the_text, [](
const std::string& line) {
74 static const auto config =
76 return flexbox(Split(line), config);
86 return Split(the_text, [](
const std::string& line) {
91 return flexbox(std::move(words), config);
Element xflex(Element)
Expand/Minimize if possible/needed on the X axis.
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
Element paragraphAlignRight(const std::string &text)
Return an element drawing the paragraph on multiple lines, aligned on the right.
std::shared_ptr< Node > Element
std::vector< Element > Elements
Element paragraphAlignCenter(const std::string &text)
Return an element drawing the paragraph on multiple lines, aligned on the center.
Element text(std::wstring text)
Display a piece of unicode text.
Element paragraphAlignLeft(const std::string &text)
Return an element drawing the paragraph on multiple lines, aligned on the left.
Elements paragraph(std::wstring text)
Element paragraphAlignJustify(const std::string &text)
Return an element drawing the paragraph on multiple lines, aligned using a justified alignment....
Element vbox(Elements)
A container displaying elements vertically one by one.
FlexboxConfig & SetGap(int gap_x, int gap_y)
Set the flexbox flex direction.
@ Center
Items are centered along the line.
@ FlexEnd
Items are aligned to the end of flexbox's direction.
@ SpaceBetween
Items are evenly distributed in the line; first item is on the start.
FlexboxConfig & Set(FlexboxConfig::Direction)
Set the flexbox direction.