From 0b8a2ec181f042759671cd174ac1870d3d9428b6 Mon Sep 17 00:00:00 2001
From: Arthur Sonzogni <sonzogniarthur@gmail.com>
Date: Sun, 6 Jan 2019 01:28:14 +0100
Subject: [PATCH] Add more examples.

---
 examples/dom/CMakeLists.txt    |  6 ++++++
 examples/dom/blink.cpp         | 21 +++++++++++++++++++++
 examples/dom/bold.cpp          | 21 +++++++++++++++++++++
 examples/dom/dim.cpp           | 21 +++++++++++++++++++++
 examples/dom/inverted.cpp      | 21 +++++++++++++++++++++
 examples/dom/style_gallery.cpp | 26 ++++++++++++++++++++++++++
 examples/dom/underlined.cpp    | 21 +++++++++++++++++++++
 7 files changed, 137 insertions(+)
 create mode 100644 examples/dom/blink.cpp
 create mode 100644 examples/dom/bold.cpp
 create mode 100644 examples/dom/dim.cpp
 create mode 100644 examples/dom/inverted.cpp
 create mode 100644 examples/dom/style_gallery.cpp
 create mode 100644 examples/dom/underlined.cpp

diff --git a/examples/dom/CMakeLists.txt b/examples/dom/CMakeLists.txt
index 7a4ff10f..437b1f7d 100644
--- a/examples/dom/CMakeLists.txt
+++ b/examples/dom/CMakeLists.txt
@@ -1,7 +1,13 @@
+example(blink)
+example(bold)
 example(color)
 example(dbox)
+example(dim)
 example(frame)
 example(gauge)
+example(inverted)
 example(package_manager)
 example(separator)
+example(underlined)
+example(style_gallery)
 example(vbox_hbox)
diff --git a/examples/dom/blink.cpp b/examples/dom/blink.cpp
new file mode 100644
index 00000000..4214a7db
--- /dev/null
+++ b/examples/dom/blink.cpp
@@ -0,0 +1,21 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"This text is "),
+      text(L"blink") | blink,
+      text(L". Do you like it?")
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
diff --git a/examples/dom/bold.cpp b/examples/dom/bold.cpp
new file mode 100644
index 00000000..1a03b83c
--- /dev/null
+++ b/examples/dom/bold.cpp
@@ -0,0 +1,21 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"This text is "),
+      text(L"bold") | bold,
+      text(L". Do you like it?")
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
diff --git a/examples/dom/dim.cpp b/examples/dom/dim.cpp
new file mode 100644
index 00000000..a8386433
--- /dev/null
+++ b/examples/dom/dim.cpp
@@ -0,0 +1,21 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"This text is "),
+      text(L"dim") | dim,
+      text(L". Do you like it?")
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
diff --git a/examples/dom/inverted.cpp b/examples/dom/inverted.cpp
new file mode 100644
index 00000000..176dd6dd
--- /dev/null
+++ b/examples/dom/inverted.cpp
@@ -0,0 +1,21 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"This text is "),
+      text(L"inverted") | inverted,
+      text(L". Do you like it?")
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
diff --git a/examples/dom/style_gallery.cpp b/examples/dom/style_gallery.cpp
new file mode 100644
index 00000000..f44df662
--- /dev/null
+++ b/examples/dom/style_gallery.cpp
@@ -0,0 +1,26 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"normal")                           , text(L" ") ,
+      text(L"bold")      | bold                 , text(L" ") ,
+      text(L"dim")       | dim                  , text(L" ") ,
+      text(L"inverted")  | inverted             , text(L" ") ,
+      text(L"underlined")| underlined           , text(L" ") ,
+      text(L"blink")     | blink                , text(L" ") ,
+      text(L"color")     | color(Color::Blue)   , text(L" ") ,
+      text(L"bgcolor")   | bgcolor(Color::Blue)
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
diff --git a/examples/dom/underlined.cpp b/examples/dom/underlined.cpp
new file mode 100644
index 00000000..9f50dd2a
--- /dev/null
+++ b/examples/dom/underlined.cpp
@@ -0,0 +1,21 @@
+#include "ftxui/screen.hpp"
+#include "ftxui/dom/elements.hpp"
+#include <iostream>
+
+int main(int argc, const char *argv[])
+{
+  using namespace ftxui;
+  using namespace ftxui::dom;
+  auto document =
+    hbox(
+      text(L"This text is "),
+      text(L"underlined") | underlined,
+      text(L". Do you like it?")
+    );
+  auto screen = ftxui::Screen::TerminalOutput(document);
+  Render(screen, document.get());
+
+  std::cout << screen.ToString();
+
+  return 0;
+}
-- 
GitLab