Use IWYU.

This commit is contained in:
ArthurSonzogni 2021-05-01 20:40:35 +02:00
parent eb399d20c5
commit 155758c073
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
119 changed files with 770 additions and 342 deletions

View File

@ -16,5 +16,5 @@ jobs:
run: >
mkdir build;
cd build;
emcmake cmake ..
emcmake cmake ..;
cmake --build . --config Release;

View File

@ -112,6 +112,14 @@ add_library(ftxui::component ALIAS component)
target_link_libraries(dom PUBLIC screen)
target_link_libraries(component PUBLIC dom Threads::Threads)
find_program(iwyu_path NAMES include-what-you-use iwyu)
if(iwyu_path)
set_property(TARGET ${lib}
PROPERTY ${iwyu_path} -Xiwyu
--mapping_file ${CMAKE_CURRENT_SOURCE_DIR}/iwyu.impl
)
endif()
foreach(lib screen dom component)
target_include_directories(${lib}

View File

@ -30,6 +30,7 @@
@example ./examples/component/checkbox_in_frame.cpp
@example ./examples/component/menu2.cpp
@example ./examples/component/tab_horizontal.cpp
@example ./examples/component/slider.cpp
@example ./examples/component/input.cpp
@example ./examples/component/homescreen.cpp
@example ./examples/component/radiobox.cpp

View File

@ -1,8 +1,14 @@
#include "ftxui/component/button.hpp"
#include <functional> // for function
#include <memory> // for unique_ptr, make_u...
#include <string> // for wstring
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/button.hpp" // for Button
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;

View File

@ -1,8 +1,7 @@
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
using namespace ftxui;

View File

@ -1,10 +1,15 @@
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp"
#include "ftxui/component/menu.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include <memory> // for allocator_traits<>...
#include <string> // for operator+, wstring
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/checkbox.hpp" // for CheckBox
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/string.hpp" // for to_wstring
using namespace ftxui;

View File

@ -1,12 +1,20 @@
#include "ftxui/component/button.hpp"
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.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/slider.hpp"
#include "ftxui/component/toggle.hpp"
#include <functional> // for function
#include <memory> // for allocator, unique_ptr
#include <string> // for wstring
#include <vector> // for vector
#include "ftxui/component/button.hpp" // for Button
#include "ftxui/component/checkbox.hpp" // for CheckBox
#include "ftxui/component/component.hpp" // for Component, Compone...
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/input.hpp" // for Input
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/radiobox.hpp" // for RadioBox
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/component/slider.hpp" // for Slider
#include "ftxui/component/toggle.hpp" // for Toggle
#include "ftxui/dom/elements.hpp" // for separator, operator|
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;
@ -76,7 +84,8 @@ class MyComponent : public Component {
text(name) | size(WIDTH, EQUAL, 8),
separator(),
element | xflex,
}) | xflex;
}) |
xflex;
}
Element Render(std::wstring name, Component& component) {

View File

@ -1,14 +1,23 @@
#include <cmath>
#include <thread>
#include <chrono> // for operator""s, chron...
#include <cmath> // for sin
#include <functional> // for ref, reference_wra...
#include <string> // for allocator, wstring
#include <thread> // for sleep_for, thread
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.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/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/checkbox.hpp" // for CheckBox
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/event.hpp" // for Event, Event::Custom
#include "ftxui/component/input.hpp" // for Input
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/radiobox.hpp" // for RadioBox
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/component/toggle.hpp" // for Toggle
#include "ftxui/dom/elements.hpp" // for text, operator|
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Blue...
using namespace ftxui;

View File

@ -1,10 +1,6 @@
#include "ftxui/component/input.hpp"
#include <iostream>
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
using namespace ftxui;

View File

@ -1,10 +1,11 @@
#include "ftxui/component/menu.hpp"
#include <functional> // for function
#include <iostream> // for basic_ostream::ope...
#include <string> // for wstring, allocator
#include <vector> // for vector
#include <chrono>
#include <iostream>
#include <thread>
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/screen/box.hpp" // for ftxui
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,11 +1,14 @@
#include <chrono>
#include <iostream>
#include <thread>
#include <functional> // for function
#include <string> // for wstring, allocator
#include <vector> // for vector
#include "ftxui/component/container.hpp"
#include "ftxui/component/menu.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, separator, bold
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/string.hpp" // for to_wstring
using namespace ftxui;

View File

@ -1,10 +1,15 @@
#include <iostream>
#include <thread>
#include <functional> // for function
#include <initializer_list> // for initializer_list
#include <string> // for wstring, allocator
#include <vector> // for vector
#include "ftxui/component/container.hpp"
#include "ftxui/component/menu.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, Element
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/color.hpp" // for Color, Color::Blue
using namespace ftxui;
@ -13,7 +18,14 @@ class MyComponent : public Component {
MyComponent() {
Add(&container);
for (Menu* menu : {&menu_1, &menu_2, &menu_3, &menu_4, &menu_5, &menu_6,}) {
for (Menu* menu : {
&menu_1,
&menu_2,
&menu_3,
&menu_4,
&menu_5,
&menu_6,
}) {
container.Add(menu);
menu->entries = {
L"Monkey", L"Dog", L"Cat", L"Bird", L"Elephant",

View File

@ -1,7 +1,14 @@
#include "ftxui/component/button.hpp"
#include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <functional> // for function
#include <memory> // for allocator_traits<>...
#include <string> // for operator+, wstring
#include <vector> // for vector
#include "ftxui/component/button.hpp" // for Button
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;

View File

@ -1,8 +1,5 @@
#include "ftxui/component/radiobox.hpp"
#include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
using namespace ftxui;

View File

@ -1,11 +1,12 @@
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.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/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include <string> // for wstring, operator+
#include <vector> // for vector
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/radiobox.hpp" // for RadioBox
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/string.hpp" // for to_wstring
using namespace ftxui;

View File

@ -1,16 +1,21 @@
#include "ftxui/component/slider.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include <functional> // for function
#include <memory> // for allocator, unique_ptr
#include <string> // for operator+, to_wstring
#include "ftxui/component/component.hpp" // for Component, Compone...
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/event.hpp" // for Event, Event::Escape
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/component/slider.hpp" // for Slider
#include "ftxui/dom/elements.hpp" // for separator, operator|
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/color.hpp" // for Color
using namespace ftxui;
Element ColorTile(int red, int green, int blue) {
return text(L"")
| size(WIDTH, GREATER_THAN, 14)
| size(HEIGHT, GREATER_THAN, 7)
| bgcolor(Color::RGB(red, green, blue));
return text(L"") | size(WIDTH, GREATER_THAN, 14) |
size(HEIGHT, GREATER_THAN, 7) | bgcolor(Color::RGB(red, green, blue));
}
Element ColorString(int red, int green, int blue) {

View File

@ -1,11 +1,14 @@
#include <iostream>
#include <thread>
#include <functional> // for function
#include <string> // for wstring, allocator
#include <vector> // for vector
#include "ftxui/component/container.hpp"
#include "ftxui/component/radiobox.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/radiobox.hpp" // for RadioBox
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/component/toggle.hpp" // for Toggle
#include "ftxui/dom/elements.hpp" // for Element, operator|
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;

View File

@ -1,10 +1,12 @@
#include <iostream>
#include <functional> // for function
#include <string> // for wstring, allocator
#include <vector> // for vector
#include "ftxui/component/container.hpp"
#include "ftxui/component/menu.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/component/toggle.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/menu.hpp" // for Menu
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;

View File

@ -1,12 +1,7 @@
#include "ftxui/component/toggle.hpp"
#include <chrono>
#include <iostream>
#include <thread>
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/component/container.hpp" // for Container
#include "ftxui/component/event.hpp" // for Event, Event::Return
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
using namespace ftxui;

View File

@ -1,8 +1,9 @@
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <thread>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,14 +1,16 @@
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/color_info.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
#include <iostream>
#include "ftxui/screen/string.hpp"
#include <memory>
#include <utility>
#include <vector>
using namespace ftxui;
#include "./color_info_sorted_2d.ipp" // ColorInfoSorted2D.
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
// clang-format off

View File

@ -1,10 +1,13 @@
#include <algorithm>
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/color_info.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
#include "ftxui/screen/string.hpp"
using namespace ftxui;

View File

@ -1,10 +1,11 @@
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
#include <iostream>
#include <memory>
#include <utility>
#include "ftxui/screen/string.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,10 +1,11 @@
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
#include <iostream>
#include <memory>
#include <utility>
#include "ftxui/screen/string.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -2,8 +2,12 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <string>
#include <thread>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
using namespace std::chrono_literals;

View File

@ -2,9 +2,15 @@
#include <cmath>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <functional>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
class Graph {
public:

View File

@ -1,7 +1,11 @@
#include <stddef.h>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <string>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,10 +1,14 @@
#include <chrono>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <string>
#include <thread>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
using namespace std::chrono_literals;

View File

@ -4,9 +4,16 @@
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <list>
#include <memory>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
/// @example examples/dom/package_manage.cpp
int main(int argc, const char* argv[]) {

View File

@ -1,7 +1,10 @@
#include <stdio.h>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <string>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,7 +1,12 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -3,7 +3,13 @@
#include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
#include <iostream>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,10 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,10 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,9 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,10 @@
#include <stdio.h>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <memory>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;

View File

@ -1,6 +1,10 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
#include <vector>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
int main(void) {
using namespace ftxui;

View File

@ -2,12 +2,18 @@
// Use of this source code is governed by the MIT license that can be found in
// 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 <stddef.h> // for size_t
#include <algorithm> // for max
#include <ftxui/component/component.hpp> // for Component
#include <ftxui/component/screen_interactive.hpp> // for ScreenInteractive
#include <string> // for allocator, operator+
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left
#include "ftxui/dom/elements.hpp" // for text, vbox, window
#include "ftxui/screen/box.hpp" // for ftxui
using namespace ftxui;

View File

@ -2,10 +2,14 @@
#define FTXUI_COMPONENT_BUTTON_HPP
#include <functional>
#include <string>
#include "ftxui/component/component.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief A button. An action is associated to the click event.
/// @ingroup dom
@ -25,6 +29,7 @@ class Button : public Component {
// Component implementation.
Element Render() override;
bool OnEvent(Event) override;
private:
Box box_;
};

View File

@ -12,3 +12,7 @@ using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;
} // namespace ftxui
#endif /* end of include guard: FTXUI_CAPTURED_MOUSE_HPP */
// 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.

View File

@ -1,11 +1,13 @@
#ifndef FTXUI_COMPONENT_CHECKBOX_HPP
#define FTXUI_COMPONENT_CHECKBOX_HPP
#include <functional>
#include <string>
#include "ftxui/component/component.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief A Checkbox. It can be checked or unchecked.Display an element on a
/// ftxui::Screen.
@ -42,7 +44,6 @@ class CheckBox : public Component {
int cursor_position = 0;
Box box_;
};
} // namespace ftxui

View File

@ -1,14 +1,17 @@
#ifndef FTXUI_COMPONENT_COMPONENT_HPP
#define FTXUI_COMPONENT_COMPONENT_HPP
#include <memory>
#include "ftxui/component/event.hpp"
#include "ftxui/dom/elements.hpp"
#include <memory> // for unique_ptr
#include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for CaptureMouse
#include "ftxui/dom/elements.hpp" // for Element
namespace ftxui {
class Delegate;
class Focus;
struct Event;
/// @brief It implement rendering itself as ftxui::Element. It implement
/// keyboard navigation by responding to ftxui::Event.
@ -53,6 +56,8 @@ class Component {
void TakeFocus();
protected:
CapturedMouse CaptureMouse(const Event& event);
std::vector<Component*> children_;
private:

View File

@ -2,6 +2,8 @@
#define FTXUI_COMPONENT_CONTAINER_HPP
#include "ftxui/component/component.hpp"
#include "ftxui/component/event.hpp"
#include "ftxui/dom/elements.hpp"
namespace ftxui {

View File

@ -1,16 +1,14 @@
#ifndef FTXUI_COMPONENT_EVENT_HPP
#define FTXUI_COMPONENT_EVENT_HPP
#include <array>
#include <ftxui/component/mouse.hpp>
#include <ftxui/component/receiver.hpp>
#include <functional>
#include <string>
#include <ftxui/component/mouse.hpp> // for Mouse
#include <string> // for string, operator==
#include <vector>
namespace ftxui {
class ScreenInteractive;
class Component;
/// @brief Represent an event. It can be key press event, a terminal resize, or
/// more ...
@ -67,13 +65,12 @@ struct Event {
const std::string& input() const { return input_; }
ScreenInteractive* screen() { return screen_; }
void SetScreen(ScreenInteractive* screen) { screen_ = screen; }
bool operator==(const Event& other) const { return input_ == other.input_; }
//--- State section ----------------------------------------------------------
private:
friend Component;
friend ScreenInteractive;
enum class Type {
Unknown,
Character,
@ -94,10 +91,9 @@ struct Event {
};
std::string input_;
ScreenInteractive* screen_;
ScreenInteractive* screen_ = nullptr;
};
} // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */

View File

@ -2,10 +2,14 @@
#define FTXUI_COMPONENT_INPUT_H_
#include <functional>
#include <string>
#include "ftxui/component/component.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief An input box. The user can type text into it.
/// @ingroup component.

View File

@ -2,11 +2,15 @@
#define FTXUI_COMPONENT_MENU
#include <functional>
#include <string>
#include <vector>
#include "ftxui/component/component.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief A list of items. The user can navigate through them.
/// @ingroup component

View File

@ -1,3 +1,5 @@
#ifndef FTXUI_COMPONENT_MOUSE_HPP
#define FTXUI_COMPONENT_MOUSE_HPP
namespace ftxui {
/// @brief A mouse event. It contains the coordinate of the mouse, the button
@ -39,3 +41,4 @@ struct Mouse {
// 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.
#endif /* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */

View File

@ -1,11 +1,15 @@
#ifndef FTXUI_COMPONENT_RADIOBOX_HPP
#define FTXUI_COMPONENT_RADIOBOX_HPP
#include <functional>
#include <string>
#include <vector>
#include "ftxui/component/component.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief A list of selectable element. One and only one can be selected at
/// the same time.

View File

@ -1,13 +1,13 @@
#ifndef FTXUI_COMPONENT_RECEIVER_HPP_
#define FTXUI_COMPONENT_RECEIVER_HPP_
#include <atomic>
#include <condition_variable>
#include <atomic> // for atomic
#include <condition_variable> // for condition_variable
#include <functional>
#include <iostream>
#include <memory>
#include <mutex>
#include <queue>
#include <memory> // for unique_ptr, make_unique
#include <mutex> // for mutex, unique_lock
#include <queue> // for queue
namespace ftxui {
@ -38,6 +38,7 @@ namespace ftxui {
// clang-format off
template<class T> class SenderImpl;
template<class T> class ReceiverImpl;
template<class T> using Sender = std::unique_ptr<SenderImpl<T>>;
template<class T> using Receiver = std::unique_ptr<ReceiverImpl<T>>;
template<class T> Receiver<T> MakeReceiver();

View File

@ -1,20 +1,18 @@
#ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
#define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
#include <atomic>
#include <condition_variable>
#include <atomic> // for atomic
#include <ftxui/component/receiver.hpp>
#include <functional>
#include <memory>
#include <mutex>
#include <queue>
#include <memory> // for unique_ptr
#include <string> // for string
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/event.hpp"
#include "ftxui/screen/screen.hpp"
#include "ftxui/screen/screen.hpp" // for Screen
namespace ftxui {
class Component;
struct Event;
class ScreenInteractive : public Screen {
public:

View File

@ -12,12 +12,7 @@ namespace ftxui {
// float increment = (max - min) * 0.05f);
template <class T> // T = {int, float}
ComponentPtr Slider(std::wstring label,
T* value,
T min,
T max,
T increment);
ComponentPtr Slider(std::wstring label, T* value, T min, T max, T increment);
} // namespace ftxui

View File

@ -1,12 +1,15 @@
#ifndef FTXUI_COMPONENT_TOGGLE_H_
#define FTXUI_COMPONENT_TOGGLE_H_
#include <functional>
#include <string>
#include <vector>
#include "ftxui/component/component.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {
struct Event;
/// @brief An horizontal list of elements. The user can navigate through them.
/// @ingroup component

View File

@ -1,16 +1,18 @@
#ifndef FTXUI_DOM_NODE_HPP
#define FTXUI_DOM_NODE_HPP
#include <memory>
#include <vector>
#include <memory> // for shared_ptr
#include <vector> // for vector
#include "ftxui/dom/requirement.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp"
namespace ftxui {
class Node;
class Screen;
using Element = std::shared_ptr<Node>;
using Elements = std::vector<std::shared_ptr<Node>>;

View File

@ -1,3 +1,4 @@
// IWYU pragma: private, include "ftxui/dom/elements.hpp"
#include <type_traits>
template <class T>

View File

@ -1,8 +1,8 @@
#ifndef FTXUI_SCREEN_COLOR
#define FTXUI_SCREEN_COLOR
#include <cstdint>
#include <string>
#include <stdint.h> // for uint8_t
#include <string> // for wstring
#ifdef RGB
// Workaround for wingdi.h (via Windows.h) defining macros that break things.

View File

@ -1,6 +1,7 @@
#ifndef FTXUI_SCREEN_COLOR_INFO_HPP
#define FTXUI_SCREEN_COLOR_INFO_HPP
#include <stdint.h>
#include <ftxui/screen/color.hpp>
namespace ftxui {

8
iwyu.imp Normal file
View File

@ -0,0 +1,8 @@
[
{ symbol: [ "VMIN", private, "<termios.h>", public ] },
{ symbol: [ "VTIME", private, "<termios.h>", public ] },
{ symbol: [ "ECHO", private, "<termios.h>", public ] },
{ symbol: [ "ICANON", private, "<termios.h>", public ] },
{ symbol: [ "termios", private, "<termios.h>", public ] },
{ symbol: [ "TCSANOW", private, "<termios.h>", public ] },
]

View File

@ -1,7 +1,11 @@
#include "ftxui/component/button.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <functional> // for function
#include <memory> // for shared_ptr
#include <functional>
#include "ftxui/component/button.hpp"
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/event.hpp" // for Event, Event::Return
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
namespace ftxui {
@ -12,7 +16,7 @@ Element Button::Render() {
bool Button::OnEvent(Event event) {
if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
TakeFocus();

View File

@ -1,7 +1,11 @@
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <functional> // for function
#include <memory> // for shared_ptr
#include <functional>
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/event.hpp" // for Event, Event::Return
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
namespace ftxui {
@ -27,7 +31,7 @@ bool CheckBox::OnEvent(Event event) {
}
bool CheckBox::OnMouseEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
if (!box_.Contain(event.mouse().x, event.mouse().y))
return false;

View File

@ -1,11 +1,20 @@
#include "ftxui/component/component.hpp"
#include <assert.h>
#include <algorithm>
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/event.hpp"
#include "ftxui/component/screen_interactive.hpp"
namespace ftxui {
namespace {
class CaptureMouseImpl : public CapturedMouseInterface {
public:
~CaptureMouseImpl() override {}
};
}
Component::~Component() {
Detach();
}
@ -97,6 +106,16 @@ void Component::TakeFocus() {
}
}
/// @brief Take the CapturedMouse if available. There is only one component of
/// them. It represents a component taking priority over others.
/// @argument event
/// @ingroup component
CapturedMouse Component::CaptureMouse(const Event& event) {
if (!event.screen_)
return std::make_unique<CaptureMouseImpl>();
return event.screen_->CaptureMouse();
}
/// @brief Detach this children from its parent.
/// @see Attach
/// @see Detach

View File

@ -1,6 +1,8 @@
#include "ftxui/component/container.hpp"
#include <stddef.h>
#include <algorithm>
#include <vector>
namespace ftxui {

View File

@ -1,6 +1,10 @@
#include "ftxui/component/container.hpp"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver
#include <memory> // for allocator
#include "gtest/gtest.h"
#include "ftxui/component/container.hpp"
#include "ftxui/screen/box.hpp" // for ftxui
#include "gtest/gtest_pred_impl.h" // for AssertionResult, EXPECT_EQ, EXPEC...
using namespace ftxui;

View File

@ -1,6 +1,6 @@
#include "ftxui/component/event.hpp"
#include <iostream>
#include "ftxui/component/mouse.hpp"
#include "ftxui/screen/string.hpp"
namespace ftxui {

View File

@ -1,9 +1,11 @@
#include "ftxui/component/input.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <algorithm>
#include <memory>
#include "ftxui/screen/string.hpp"
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/mouse.hpp"
#include "ftxui/component/screen_interactive.hpp"
namespace ftxui {
@ -103,7 +105,7 @@ bool Input::OnEvent(Event event) {
}
bool Input::OnMouseEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
if (!input_box_.Contain(event.mouse().x, event.mouse().y))
return false;

View File

@ -1,8 +1,13 @@
#include "ftxui/component/menu.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <stddef.h>
#include <algorithm>
#include <iostream>
#include <memory>
#include <utility>
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/mouse.hpp"
#include "ftxui/component/screen_interactive.hpp"
namespace ftxui {
@ -28,7 +33,7 @@ Element Menu::Render() {
}
bool Menu::OnEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
if (event.is_mouse())
return OnMouseEvent(event);
@ -63,7 +68,7 @@ bool Menu::OnEvent(Event event) {
}
bool Menu::OnMouseEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
for (int i = 0; i < boxes_.size(); ++i) {
if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))

View File

@ -1,8 +1,14 @@
#include "ftxui/component/radiobox.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <stddef.h>
#include <algorithm>
#include <functional>
#include <memory>
#include <utility>
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/mouse.hpp"
#include "ftxui/component/screen_interactive.hpp"
namespace ftxui {
@ -13,8 +19,9 @@ Element RadioBox::Render() {
for (size_t i = 0; i < entries.size(); ++i) {
auto style =
(focused == int(i) && is_focused) ? focused_style : unfocused_style;
auto focus_management =
(focused != int(i)) ? nothing : is_focused ? focus : select;
auto focus_management = (focused != int(i)) ? nothing
: is_focused ? focus
: select;
const std::wstring& symbol = selected == int(i) ? checked : unchecked;
elements.push_back(hbox(text(symbol), text(entries[i]) | style) |
@ -24,7 +31,7 @@ Element RadioBox::Render() {
}
bool RadioBox::OnEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
if (event.is_mouse())
return OnMouseEvent(event);
@ -58,7 +65,7 @@ bool RadioBox::OnEvent(Event event) {
}
bool RadioBox::OnMouseEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
for (int i = 0; i < boxes_.size(); ++i) {
if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))

View File

@ -1,6 +1,10 @@
#include "ftxui/component/radiobox.hpp"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver, TestFactoryImpl
#include "gtest/gtest.h"
#include "ftxui/component/event.hpp" // for Event, Event::ArrowDown, Event::ArrowUp, Event::Tab, Event::TabReverse
#include "ftxui/component/mouse.hpp" // for ftxui
#include "ftxui/component/radiobox.hpp"
#include "gtest/gtest_pred_impl.h" // for EXPECT_EQ, Test, TEST
using namespace ftxui;

View File

@ -1,8 +1,10 @@
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult
#include <thread> // for thread
#include <utility> // for move
#include "ftxui/component/receiver.hpp"
#include <thread>
#include "gtest/gtest.h"
#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, EXPECT_EQ
using namespace ftxui;

View File

@ -1,19 +1,24 @@
#include "ftxui/component/screen_interactive.hpp"
#include <stdio.h>
#include <stdio.h> // for fileno, stdin
#include <algorithm> // for copy, max, min
#include <csignal> // for signal, SIGINT
#include <cstdlib> // for exit, NULL
#include <iostream> // for cout, ostream
#include <stack> // for stack
#include <thread> // for thread
#include <utility> // for move
#include <vector> // for vector
#include <algorithm>
#include <csignal>
#include <cstdlib>
#include <iostream>
#include <stack>
#include <thread>
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/component.hpp"
#include "ftxui/component/terminal_input_parser.hpp"
#include "ftxui/screen/string.hpp"
#include "ftxui/screen/terminal.hpp"
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Component
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/receiver.hpp" // for ReceiverImpl
#include "ftxui/component/terminal_input_parser.hpp" // for TerminalInputPa...
#include "ftxui/dom/node.hpp" // for Node, Render
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/terminal.hpp" // for Terminal::Dimen...
#if defined(_WIN32)
#define DEFINE_CONSOLEV2_PROPERTIES
@ -26,8 +31,9 @@
#error Must be compiled in UNICODE mode
#endif
#else
#include <termios.h>
#include <unistd.h>
#include <sys/select.h> // for select, FD_ISSET
#include <termios.h> // for tcsetattr, tcge...
#include <unistd.h> // for STDIN_FILENO, read
#endif
// Quick exit is missing in standard CLang headers
@ -48,8 +54,7 @@ constexpr int timeout_milliseconds = 20;
constexpr int timeout_microseconds = timeout_milliseconds * 1000;
#if defined(_WIN32)
void EventListener(std::atomic<bool>* quit,
Sender<Event> out) {
void EventListener(std::atomic<bool>* quit, Sender<Event> out) {
auto console = GetStdHandle(STD_INPUT_HANDLE);
auto parser = TerminalInputParser(out->Clone());
while (!*quit) {
@ -69,8 +74,7 @@ void EventListener(std::atomic<bool>* quit,
std::vector<INPUT_RECORD> records{number_of_events};
DWORD number_of_events_read = 0;
ReadConsoleInput(console, records.data(),
(DWORD)records.size(),
ReadConsoleInput(console, records.data(), (DWORD)records.size(),
&number_of_events_read);
records.resize(number_of_events_read);
@ -115,7 +119,7 @@ void EventListener(std::atomic<bool>* quit, Sender<Event> out) {
}
#else
#include <sys/time.h>
#include <sys/time.h> // for timeval
int CheckStdinReady(int usec_timeout) {
timeval tv = {0, usec_timeout};
@ -219,8 +223,7 @@ void OnResize(int /* signal */) {
class CapturedMouseImpl : public CapturedMouseInterface {
public:
CapturedMouseImpl(std::function<void(void)> callback)
: callback_(callback) {}
CapturedMouseImpl(std::function<void(void)> callback) : callback_(callback) {}
~CapturedMouseImpl() override { callback_(); }
private:
@ -406,7 +409,7 @@ void ScreenInteractive::Loop(Component* component) {
event.mouse().y -= cursor_y_;
}
event.SetScreen(this);
event.screen_ = this;
component->OnEvent(event);
}

View File

@ -1,6 +1,14 @@
#include "ftxui/component/slider.hpp"
#include <memory>
#include <utility>
#include "ftxui/component/captured_mouse.hpp"
#include "ftxui/component/mouse.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
namespace ftxui {
@ -55,7 +63,7 @@ class SliderImpl : public Component {
}
if (box_.Contain(event.mouse().x, event.mouse().y) &&
event.screen()->CaptureMouse()) {
CaptureMouse(event)) {
TakeFocus();
}
@ -63,7 +71,7 @@ class SliderImpl : public Component {
event.mouse().motion == Mouse::Pressed &&
gauge_box_.Contain(event.mouse().x, event.mouse().y) &&
!captured_mouse_) {
captured_mouse_ = event.screen()->CaptureMouse();
captured_mouse_ = CaptureMouse(event);
}
if (captured_mouse_) {
@ -105,3 +113,7 @@ template ComponentPtr Slider(std::wstring label,
float increment);
} // namespace ftxui
// 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.

View File

@ -1,5 +1,8 @@
#include "ftxui/component/terminal_input_parser.hpp"
#include <utility>
#include "ftxui/component/event.hpp"
namespace ftxui {
TerminalInputParser::TerminalInputParser(Sender<Event> out)
@ -61,7 +64,6 @@ void TerminalInputParser::Send(TerminalInputParser::Output output) {
return;
}
// NOT_REACHED().
}
TerminalInputParser::Output TerminalInputParser::Parse() {
@ -227,3 +229,7 @@ TerminalInputParser::Output TerminalInputParser::ParseCursorReporting(
}
} // namespace ftxui
// 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.

View File

@ -1,10 +1,13 @@
#ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
#define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER
#include "ftxui/component/event.hpp"
#include "ftxui/component/receiver.hpp"
#include <memory> // for unique_ptr
#include <string> // for string
#include <vector> // for vector
#include <string>
#include "ftxui/component/event.hpp" // IWYU pragma: keep
#include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/receiver.hpp" // for SenderImpl
namespace ftxui {

View File

@ -1,7 +1,9 @@
#include "ftxui/component/terminal_input_parser.hpp"
#include "ftxui/component/receiver.hpp"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult
#include "gtest/gtest.h"
#include "ftxui/component/receiver.hpp" // for MakeReceiver, ReceiverImpl
#include "ftxui/component/terminal_input_parser.hpp"
#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, Suite...
using namespace ftxui;

View File

@ -1,7 +1,12 @@
#include "ftxui/component/toggle.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <stddef.h> // for size_t
#include <algorithm> // for max, min
#include <memory> // for shared_ptr, alloca...
#include <utility> // for move
#include <algorithm>
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/component/toggle.hpp"
namespace ftxui {
@ -60,7 +65,7 @@ bool Toggle::OnEvent(Event event) {
}
bool Toggle::OnMouseEvent(Event event) {
if (!event.screen()->CaptureMouse())
if (!CaptureMouse(event))
return false;
for (int i = 0; i < boxes_.size(); ++i) {
if (!boxes_[i].Contain(event.mouse().x, event.mouse().y))

View File

@ -1,6 +1,10 @@
#include "ftxui/component/toggle.hpp"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver, TestFactoryImpl
#include "gtest/gtest.h"
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Return, Event::Tab, Event::TabReverse
#include "ftxui/component/mouse.hpp" // for ftxui
#include "ftxui/component/toggle.hpp"
#include "gtest/gtest_pred_impl.h" // for AssertionResult, EXPECT_EQ, Test, EXPECT_TRUE, EXPECT_FALSE, TEST
using namespace ftxui;

View File

@ -1,5 +1,10 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,7 +1,14 @@
#include <algorithm>
#include <algorithm> // for max
#include <iterator> // for begin, end
#include <memory> // for make_shared, __shared_ptr_access
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/elements.hpp" // for unpack, Element, Decorator, Elements, border, borderWith, window
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/color.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,5 +1,5 @@
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
namespace ftxui {

View File

@ -1,7 +1,12 @@
#include <algorithm>
#include <algorithm> // for max
#include <memory> // for __shared_ptr_access, shared_ptr, make_shared
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/elements.hpp" // for Element, Elements, dbox
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include <vector>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/requirement.hpp"
#include "ftxui/screen/box.hpp"
namespace ftxui {

View File

@ -1,8 +1,14 @@
#include <algorithm>
#include <algorithm> // for max, min
#include <memory> // for make_shared, shared_ptr, __shared_ptr_access
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/util/autoreset.hpp"
#include "ftxui/dom/elements.hpp" // for Element, unpack, focus, frame, select, xframe, yframe
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement, Requirement::FOCUSED, Requirement::SELECTED
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Screen, Screen::Cursor
#include "ftxui/util/autoreset.hpp" // for AutoReset
namespace ftxui {

View File

@ -1,5 +1,9 @@
#include <memory>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/requirement.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,6 +1,12 @@
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult
#include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for gauge
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, SuiteApiResolver, EXPECT_EQ
using namespace ftxui;
using namespace ftxui;

View File

@ -1,4 +1,12 @@
#include "ftxui/dom/elements.hpp"
#include <functional> // for function
#include <memory> // for make_shared
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for GraphFunction, Element, graph
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Screen
namespace ftxui {

View File

@ -1,7 +1,12 @@
#include <algorithm>
#include <algorithm> // for max
#include <memory> // for __shared_ptr_access, shared_ptr, make_shared
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/elements.hpp" // for Element, Elements, hbox
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
namespace ftxui {

View File

@ -1,6 +1,13 @@
#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult
#include <string> // for allocator, basic_string, string
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex_grow
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/box.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, SuiteApiResolver, EXPECT_EQ
using namespace ftxui;
using namespace ftxui;

View File

@ -1,7 +1,12 @@
#include <algorithm>
#include <algorithm> // for max
#include <memory> // for __shared_ptr_access, make_shared, shared_ptr
#include <utility> // for move
#include <vector> // for vector
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node.hpp"
#include "ftxui/dom/elements.hpp" // for Element, Elements, hflow
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
namespace ftxui {

View File

@ -1,5 +1,10 @@
#include <memory>
#include <utility>
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,4 +1,7 @@
#include <utility>
#include "ftxui/dom/node.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {

View File

@ -1,4 +1,9 @@
#include <memory> // for __shared_ptr_access
#include <vector> // for vector
#include "ftxui/dom/node_decorator.hpp"
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
namespace ftxui {

Some files were not shown because too many files have changed in this diff Show More