16Elements Split(
const std::string& the_text) {
18 std::stringstream ss(the_text);
20 while (std::getline(ss, word,
' ')) {
21 output.push_back(
text(word));
26Element Split(
const std::string& paragraph,
27 const std::function<
Element(std::string)>& f) {
29 std::stringstream ss(paragraph);
31 while (std::getline(ss, line,
'\n')) {
32 output.push_back(f(line));
34 return vbox(std::move(output));
51 return Split(std::string(the_text), [](
const std::string& line) {
53 return flexbox(Split(line), config);
62 return Split(std::string(the_text), [](
const std::string& line) {
65 return flexbox(Split(line), config);
74 return Split(std::string(the_text), [](
const std::string& line) {
75 static const auto config =
77 return flexbox(Split(line), config);
87 return Split(std::string(the_text), [](
const std::string& line) {
91 words.push_back(
text(
"") | xflex);
92 return flexbox(std::move(words), config);
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.
Element paragraphAlignLeft(std::string_view text)
Return an element drawing the paragraph on multiple lines, aligned on the left.
Element text(std::wstring_view text)
Display a piece of unicode text.
Element paragraphAlignJustify(std::string_view text)
Return an element drawing the paragraph on multiple lines, aligned using a justified alignment....
Element paragraphAlignCenter(std::string_view text)
Return an element drawing the paragraph on multiple lines, aligned on the center.
Element paragraph(std::string_view text)
Return an element drawing the paragraph on multiple lines.
Element paragraphAlignRight(std::string_view text)
Return an element drawing the paragraph on multiple lines, aligned on the right.
Element vbox(Elements)
A container displaying elements vertically one by one.
FlexboxConfig is a configuration structure that defines the layout properties for a flexbox container...
The FTXUI ftxui:: namespace.
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
A container displaying elements on row/columns and capable of wrapping on the next column/row when fu...
std::shared_ptr< Node > Element
std::vector< Element > Elements