Start the gauge widget.

This commit is contained in:
Arthur Sonzogni
2018-09-19 21:52:25 +02:00
parent 49aeaa49c5
commit e577d67f2a
17 changed files with 211 additions and 12 deletions

View File

@@ -1 +1,3 @@
add_subdirectory(text)
add_subdirectory(gauge)
add_subdirectory(separator)
add_subdirectory(vbox_hbox)

View File

@@ -0,0 +1,4 @@
add_executable(gauge_example
main.cpp
)
target_link_libraries(gauge_example PRIVATE ftxui)

30
examples/gauge/main.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include "ftxui/core/screen.hpp"
#include "ftxui/core/dom/elements.hpp"
#include <iostream>
int main(int argc, const char *argv[])
{
using namespace ftxui::dom;
auto document =
hbox(
flex(vbox(
gauge(0.1),
gauge(0.2),
gauge(0.3)
)),
flex(vbox(
gauge(0.1),
gauge(0.8),
gauge(0.3)
))
);
//auto screen = ftxui::Screen::WholeTerminal();
auto screen = ftxui::Screen::TerminalOutput(document);
Render(screen, document.get());
std::cout << screen.ToString();
getchar();
return 0;
}

View File

@@ -0,0 +1,4 @@
add_executable(separator_example
main.cpp
)
target_link_libraries(separator_example PRIVATE ftxui)

View File

@@ -0,0 +1,26 @@
#include "ftxui/core/screen.hpp"
#include "ftxui/core/dom/elements.hpp"
#include <iostream>
int main(int argc, const char *argv[])
{
using namespace ftxui::dom;
auto document =
hbox(
text(L"left-column"),
separator(),
flex(vbox(
flex(center(text(L"right-column"))),
separator(),
center(text(L"bottom-column"))
))
);
auto screen = ftxui::Screen::WholeTerminal();
Render(screen, document.get());
std::cout << screen.ToString();
getchar();
return 0;
}

View File

@@ -1,4 +0,0 @@
add_executable(main
main.cpp
)
target_link_libraries(main PRIVATE ftxui)

View File

@@ -0,0 +1,4 @@
add_executable(vbox_hbox_example
main.cpp
)
target_link_libraries(vbox_hbox_example PRIVATE ftxui)

View File

@@ -5,7 +5,7 @@
int main(int argc, const char *argv[])
{
using namespace ftxui::dom;
auto root =
auto document =
vbox(
hbox(
text(L"north-west"),
@@ -28,7 +28,7 @@ int main(int argc, const char *argv[])
)
);
auto screen = ftxui::Screen::WholeTerminal();
Render(screen, root.get());
Render(screen, document.get());
std::cout << screen.ToString();