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));
56 return Split(the_text, [](std::string_view line) {
57 static const auto config = FlexboxConfig().SetGap(1, 0);
58 return flexbox(Split(line), config);
66 return Split(the_text, [](std::string_view line) {
67 static const auto config = FlexboxConfig().SetGap(1, 0).Set(
68 FlexboxConfig::JustifyContent::FlexEnd);
69 return flexbox(Split(line), config);
77 return Split(the_text, [](std::string_view line) {
78 static const auto config =
79 FlexboxConfig().SetGap(1, 0).Set(FlexboxConfig::JustifyContent::Center);
80 return flexbox(Split(line), config);
89 return Split(the_text, [](std::string_view line) {
90 static const auto config = FlexboxConfig().SetGap(1, 0).Set(
91 FlexboxConfig::JustifyContent::SpaceBetween);
93 words.push_back(
text(
"") | xflex);
94 return flexbox(std::move(words), config);
Element text(std::string_view text)
UTF8エンコードされたユニコードテキストを表示します。
Element paragraphAlignLeft(std::string_view the_text)
段落を複数行にわたって左揃えで描画する要素を返します。
Element paragraphAlignJustify(std::string_view the_text)
段落を複数行にわたって両端揃えで描画する要素を返します。 中央に。
Element paragraphAlignCenter(std::string_view the_text)
段落を複数行にわたって中央揃えで描画する要素を返します。
Element paragraph(std::string_view the_text)
段落を複数行で描画する要素を返します。
Element paragraphAlignRight(std::string_view the_text)
段落を複数行にわたって右揃えで描画する要素を返します。
Element vbox(Elements children)
要素を縦に一つずつ表示するコンテナ。
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
行/列に要素を表示し、一杯になると次の列/行に折り返すことができるコンテナ。
std::shared_ptr< Node > Element
std::vector< Element > Elements