diff --git a/CMakeLists.txt b/CMakeLists.txt index f3ac6a5..56a2468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,18 @@ add_library(dom ) add_library(component + include/ftxui/component/button.hpp + include/ftxui/component/checkbox.hpp + include/ftxui/component/component.hpp + include/ftxui/component/container.hpp + include/ftxui/component/event.hpp + include/ftxui/component/input.hpp + include/ftxui/component/menu.hpp + include/ftxui/component/radiobox.hpp + include/ftxui/component/receiver.hpp + include/ftxui/component/screen_interactive.hpp + include/ftxui/component/toggle.hpp + src/ftxui/component/button.cpp src/ftxui/component/checkbox.cpp src/ftxui/component/component.cpp src/ftxui/component/container.cpp @@ -75,16 +87,6 @@ add_library(component src/ftxui/component/radiobox.cpp src/ftxui/component/screen_interactive.cpp src/ftxui/component/toggle.cpp - include/ftxui/component/checkbox.hpp - include/ftxui/component/component.hpp - include/ftxui/component/container.hpp - include/ftxui/component/event.hpp - include/ftxui/component/input.hpp - include/ftxui/component/menu.hpp - include/ftxui/component/radiobox.hpp - include/ftxui/component/screen_interactive.hpp - include/ftxui/component/receiver.hpp - include/ftxui/component/toggle.hpp ) add_library(ftxui::screen ALIAS screen) diff --git a/examples/component/CMakeLists.txt b/examples/component/CMakeLists.txt index 0b41a2f..90633ab 100644 --- a/examples/component/CMakeLists.txt +++ b/examples/component/CMakeLists.txt @@ -4,9 +4,11 @@ function(example name) set_property(TARGET ${name} PROPERTY CXX_STANDARD 17) endfunction(example) +example(button) example(checkbox) example(checkbox_in_frame) example(gallery) +example(homescreen) example(input) example(menu) example(menu2) @@ -16,4 +18,3 @@ example(radiobox_in_frame) example(tab_horizontal) example(tab_vertical) example(toggle) -example(homescreen) diff --git a/examples/component/button.cpp b/examples/component/button.cpp new file mode 100644 index 0000000..00314a9 --- /dev/null +++ b/examples/component/button.cpp @@ -0,0 +1,48 @@ +// 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/component/button.hpp" + +#include "ftxui/component/component.hpp" +#include "ftxui/component/container.hpp" +#include "ftxui/component/screen_interactive.hpp" + +using namespace ftxui; + +class MyComponent : public Component { + private: + std::vector> buttons_; + Container container_ = Container::Horizontal(); + + public: + MyComponent() { + Add(&container_); + + auto button_add = std::make_unique