Add paragraph and fix hflow

This commit is contained in:
Arthur Sonzogni
2019-01-23 00:26:36 +01:00
parent 610b86183b
commit ce7867ab03
6 changed files with 59 additions and 5 deletions

View File

@@ -19,3 +19,4 @@ example(style_underlined)
example(size)
example(vbox_hbox)
example(hflow)
example(paragraph)

View File

@@ -0,0 +1,33 @@
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/dom/elements.hpp"
#include <iostream>
int main(int argc, const char *argv[])
{
using namespace ftxui;
std::wstring p = LR"(In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes' theorem, a person's age can be used to more accurately assess the probability that they have cancer, compared to the assessment of the probability of cancer made without knowledge of the person's age. One of the many applications of Bayes' theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes' theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of related evidence. Bayesian inference is fundamental to Bayesian statistics.)";
auto document =
vbox(
hbox(
hflow(paragraph(p)) | border,
hflow(paragraph(p)) | border,
hflow(paragraph(p)) | border
) | flex,
hbox(
hflow(paragraph(p)) | border,
hflow(paragraph(p)) | border
) | flex,
hbox(
hflow(paragraph(p)) | border
) | flex
);
auto screen = Screen::TerminalFullscreen();
Render(screen, document.get());
std::cout << screen.ToString();
getchar();
return 0;
}