FTXUI/examples/dom/paragraph.cpp

41 lines
2.1 KiB
C++
Raw Normal View History

#include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for operator|, hflow, border, Element, hbox, flex, vbox
#include <ftxui/screen/screen.hpp> // for Dimension, Screen
#include <string> // for allocator, wstring
2021-05-02 02:40:35 +08:00
#include "ftxui/dom/deprecated.hpp" // for paragraph
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/box.hpp" // for ftxui
2020-03-23 05:32:44 +08:00
int main(int argc, const char* argv[]) {
2019-01-23 07:26:36 +08:00
using namespace ftxui;
2020-03-23 05:32:44 +08:00
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.)";
2019-01-23 07:26:36 +08:00
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,
});
2019-01-23 07:26:36 +08:00
auto screen = Screen::Create(Dimension::Full(), Dimension::Full());
Render(screen, document);
2021-03-22 05:54:39 +08:00
screen.Print();
2019-01-23 07:26:36 +08:00
getchar();
return 0;
}
2020-09-06 19:46:56 +08:00
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.