Update document WIP.

This commit is contained in:
ArthurSonzogni
2020-05-25 01:34:13 +02:00
committed by Arthur Sonzogni
parent 177df31d41
commit 75c424cea9
55 changed files with 3244 additions and 152 deletions

View File

@@ -23,3 +23,4 @@ example(vbox_hbox)
example(hflow)
example(paragraph)
example(html_like)
example(window)

View File

@@ -3,41 +3,33 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <thread>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = hbox({
window(text(L" main frame ") | hcenter,
vbox({
text(L"Line 1"),
text(L"Line 2"),
text(L"Line 3"),
vbox({
text(L"Line 4"),
text(L"Line 5"),
text(L"Line 6"),
}) | border,
hbox({
window(text(L"frame 2"), vbox({
text(L"Line 4"),
text(L"Line 5"),
text(L"Line 6"),
})),
window(text(L"frame 3"), vbox({
text(L"Line 7"),
text(L"Line 8"),
text(L"Line 9"),
})),
}),
text(L"footer footer footer footer footer"),
})),
filler(),
});
auto document = //
hbox({
vbox({
text(L"Line 1"),
text(L"Line 2"),
text(L"Line 3"),
}) | border,
vbox({
text(L"Line 4"),
text(L"Line 5"),
text(L"Line 6"),
}) | border,
vbox({
text(L"Line 7"),
text(L"Line 8"),
text(L"Line 9"),
}) | border,
});
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << screen.ToString() << std::endl;

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = dbox({

View File

@@ -3,12 +3,11 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <thread>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
using namespace std::chrono_literals;

View File

@@ -4,13 +4,12 @@
#include <chrono>
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <thread>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
class Graph {
public:
std::vector<int> operator()(int width, int height) {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto make_box = [](size_t dimx, size_t dimy) {

View File

@@ -3,13 +3,12 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <thread>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
using namespace std::chrono_literals;

View File

@@ -3,14 +3,15 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <list>
#include <thread>
#include <vector>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
/// @example examples/dom/package_manage.cpp
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
std::wstring p =

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = hbox({

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto make_box = [](const std::wstring title) {

View File

@@ -3,13 +3,12 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <thread>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
using namespace std::chrono_literals;

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = //

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = //

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
// clang-format off

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = //

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
// clang-format off

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = hbox({

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = //

View File

@@ -2,11 +2,10 @@
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = //

15
examples/dom/window.cpp Normal file
View File

@@ -0,0 +1,15 @@
// 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.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
int main(int argc, const char* argv[]) {
using namespace ftxui;
auto document = window(text(L"Title"), text(L"content"));
auto screen = Screen::Create(Dimension::Fixed(30), Dimension::Fixed(6));
Render(screen, document);
std::cout << screen.ToString() << std::endl;
}

View File

@@ -26,8 +26,8 @@
<script type="text/c++">
#include <iostream>
#include "ftxui/screen/screen.hpp"
#include "ftxui/dom/elements.hpp"
#include <ftxui/screen/screen.hpp>
#include <ftxui/dom/elements.hpp>
int main() {
using namespace ftxui;

View File

@@ -3,13 +3,12 @@
// the LICENSE file.
#include <chrono>
#include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <thread>
#include "ftxui/component/component.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/screen/string.hpp"
using namespace ftxui;
class DrawKey : public Component {