16Elements Split(std::string_view the_text) {
19 size_t end = the_text.find(
' ');
20 while (end != std::string_view::npos) {
21 output.push_back(
text(the_text.substr(start, end - start)));
23 end = the_text.find(
' ', start);
25 output.push_back(
text(the_text.substr(start)));
29Element Split(std::string_view paragraph,
30 const std::function<
Element(std::string_view)>& f) {
33 size_t end = paragraph.find(
'\n');
34 while (end != std::string_view::npos) {
35 output.push_back(f(paragraph.substr(start, end - start)));
37 end = paragraph.find(
'\n', start);
39 output.push_back(f(paragraph.substr(start)));
40 return vbox(std::move(output));
57 return Split(the_text, [](std::string_view line) {
58 static const auto config = FlexboxConfig().SetGap(1, 0);
59 return flexbox(Split(line), config);
68 return Split(the_text, [](std::string_view line) {
69 static const auto config = FlexboxConfig().SetGap(1, 0).Set(
70 FlexboxConfig::JustifyContent::FlexEnd);
71 return flexbox(Split(line), config);
80 return Split(the_text, [](std::string_view line) {
81 static const auto config =
82 FlexboxConfig().SetGap(1, 0).Set(FlexboxConfig::JustifyContent::Center);
83 return flexbox(Split(line), config);
92 return Split(the_text, [](std::string_view line) {
93 static const auto config = FlexboxConfig().SetGap(1, 0).Set(
94 FlexboxConfig::JustifyContent::SpaceBetween);
96 words.push_back(
text(
"") | xflex);
97 return flexbox(std::move(words), config);
Element text(std::string_view text)
Affiche un morceau de texte unicode encodé en UTF8.
Element paragraphAlignLeft(std::string_view the_text)
Renvoie un élément affichant le paragraphe sur plusieurs lignes, aligné à gauche.
Element paragraphAlignJustify(std::string_view the_text)
Renvoie un élément affichant le paragraphe sur plusieurs lignes, aligné en utilisant un alignement ju...
Element paragraphAlignCenter(std::string_view the_text)
Renvoie un élément affichant le paragraphe sur plusieurs lignes, aligné au centre.
Element paragraph(std::string_view the_text)
Renvoie un élément affichant le paragraphe sur plusieurs lignes.
Element paragraphAlignRight(std::string_view the_text)
Renvoie un élément affichant le paragraphe sur plusieurs lignes, aligné à droite.
Element vbox(Elements children)
Un conteneur affichant les éléments verticalement un par un.
L'espace de noms FTXUI ftxui::
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
Un conteneur affichant des éléments sur des lignes/colonnes et capable de passer à la colonne/ligne s...
std::shared_ptr< Node > Element
std::vector< Element > Elements