mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 18:48:11 +08:00 
			
		
		
		
	Use IWYU.
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/linux-emscripten.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/linux-emscripten.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -16,5 +16,5 @@ jobs: | |||||||
|         run: > |         run: > | ||||||
|           mkdir build; |           mkdir build; | ||||||
|           cd build; |           cd build; | ||||||
|           emcmake cmake .. |           emcmake cmake ..; | ||||||
|           cmake --build . --config Release; |           cmake --build . --config Release; | ||||||
|   | |||||||
| @@ -112,6 +112,14 @@ add_library(ftxui::component ALIAS component) | |||||||
|  |  | ||||||
| target_link_libraries(dom PUBLIC screen) | target_link_libraries(dom PUBLIC screen) | ||||||
| target_link_libraries(component PUBLIC dom Threads::Threads) | 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) | foreach(lib screen dom component) | ||||||
|   target_include_directories(${lib} |   target_include_directories(${lib} | ||||||
|   | |||||||
| @@ -30,6 +30,7 @@ | |||||||
| @example ./examples/component/checkbox_in_frame.cpp | @example ./examples/component/checkbox_in_frame.cpp | ||||||
| @example ./examples/component/menu2.cpp | @example ./examples/component/menu2.cpp | ||||||
| @example ./examples/component/tab_horizontal.cpp | @example ./examples/component/tab_horizontal.cpp | ||||||
|  | @example ./examples/component/slider.cpp | ||||||
| @example ./examples/component/input.cpp | @example ./examples/component/input.cpp | ||||||
| @example ./examples/component/homescreen.cpp | @example ./examples/component/homescreen.cpp | ||||||
| @example ./examples/component/radiobox.cpp | @example ./examples/component/radiobox.cpp | ||||||
|   | |||||||
| @@ -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/button.hpp"              // for Button | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,7 @@ | |||||||
| #include "ftxui/component/checkbox.hpp" | #include "ftxui/component/checkbox.hpp" | ||||||
|  | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,10 +1,15 @@ | |||||||
| #include "ftxui/component/checkbox.hpp" | #include <memory>   // for allocator_traits<>... | ||||||
| #include "ftxui/component/container.hpp" | #include <string>   // for operator+, wstring | ||||||
| #include "ftxui/component/input.hpp" | #include <utility>  // for move | ||||||
| #include "ftxui/component/menu.hpp" | #include <vector>   // for vector | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/component/checkbox.hpp"            // for CheckBox | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,12 +1,20 @@ | |||||||
| #include "ftxui/component/button.hpp" | #include <functional>  // for function | ||||||
| #include "ftxui/component/checkbox.hpp" | #include <memory>      // for allocator, unique_ptr | ||||||
| #include "ftxui/component/container.hpp" | #include <string>      // for wstring | ||||||
| #include "ftxui/component/input.hpp" | #include <vector>      // for vector | ||||||
| #include "ftxui/component/menu.hpp" |  | ||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/button.hpp"              // for Button | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/checkbox.hpp"            // for CheckBox | ||||||
| #include "ftxui/component/slider.hpp" | #include "ftxui/component/component.hpp"           // for Component, Compone... | ||||||
| #include "ftxui/component/toggle.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
| @@ -76,7 +84,8 @@ class MyComponent : public Component { | |||||||
|                text(name) | size(WIDTH, EQUAL, 8), |                text(name) | size(WIDTH, EQUAL, 8), | ||||||
|                separator(), |                separator(), | ||||||
|                element | xflex, |                element | xflex, | ||||||
|     }) | xflex; |            }) | | ||||||
|  |            xflex; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Element Render(std::wstring name, Component& component) { |   Element Render(std::wstring name, Component& component) { | ||||||
|   | |||||||
| @@ -1,14 +1,23 @@ | |||||||
| #include <cmath> | #include <chrono>      // for operator""s, chron... | ||||||
| #include <thread> | #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/checkbox.hpp"            // for CheckBox | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/input.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/event.hpp"               // for Event, Event::Custom | ||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/input.hpp"               // for Input | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/menu.hpp"                // for Menu | ||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/component/radiobox.hpp"            // for RadioBox | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,10 +1,6 @@ | |||||||
| #include "ftxui/component/input.hpp" | #include "ftxui/component/input.hpp" | ||||||
|  | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include <iostream> | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
|  |  | ||||||
| #include "ftxui/component/container.hpp" |  | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
| #include "ftxui/screen/string.hpp" |  | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 "ftxui/component/menu.hpp"                // for Menu | ||||||
| #include <iostream> | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include <thread> | #include "ftxui/screen/box.hpp"                    // for ftxui | ||||||
|  |  | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,11 +1,14 @@ | |||||||
| #include <chrono> | #include <functional>  // for function | ||||||
| #include <iostream> | #include <string>      // for wstring, allocator | ||||||
| #include <thread> | #include <vector>      // for vector | ||||||
|  |  | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/menu.hpp"                // for Menu | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,10 +1,15 @@ | |||||||
| #include <iostream> | #include <functional>        // for function | ||||||
| #include <thread> | #include <initializer_list>  // for initializer_list | ||||||
|  | #include <string>            // for wstring, allocator | ||||||
|  | #include <vector>            // for vector | ||||||
|  |  | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/menu.hpp"                // for Menu | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
| @@ -13,7 +18,14 @@ class MyComponent : public Component { | |||||||
|   MyComponent() { |   MyComponent() { | ||||||
|     Add(&container); |     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); |       container.Add(menu); | ||||||
|       menu->entries = { |       menu->entries = { | ||||||
|           L"Monkey", L"Dog", L"Cat", L"Bird", L"Elephant", |           L"Monkey", L"Dog", L"Cat", L"Bird", L"Elephant", | ||||||
|   | |||||||
| @@ -1,7 +1,14 @@ | |||||||
| #include "ftxui/component/button.hpp" | #include <functional>  // for function | ||||||
| #include "ftxui/component/component.hpp" | #include <memory>      // for allocator_traits<>... | ||||||
| #include "ftxui/component/container.hpp" | #include <string>      // for operator+, wstring | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,5 @@ | |||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/radiobox.hpp" | ||||||
|  | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include "ftxui/component/component.hpp" |  | ||||||
| #include "ftxui/component/container.hpp" |  | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,11 +1,12 @@ | |||||||
| #include "ftxui/component/checkbox.hpp" | #include <string>  // for wstring, operator+ | ||||||
| #include "ftxui/component/container.hpp" | #include <vector>  // for vector | ||||||
| #include "ftxui/component/input.hpp" |  | ||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/radiobox.hpp"            // for RadioBox | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/dom/elements.hpp"                  // for Element, operator| | ||||||
| #include "ftxui/screen/string.hpp" | #include "ftxui/screen/box.hpp"                    // for ftxui | ||||||
|  | #include "ftxui/screen/string.hpp"                 // for to_wstring | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,16 +1,21 @@ | |||||||
| #include "ftxui/component/slider.hpp" | #include <functional>  // for function | ||||||
| #include "ftxui/component/container.hpp" | #include <memory>      // for allocator, unique_ptr | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include <string>      // for operator+, to_wstring | ||||||
| #include "ftxui/component/toggle.hpp" |  | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
| Element ColorTile(int red, int green, int blue) { | Element ColorTile(int red, int green, int blue) { | ||||||
|   return text(L"") |   return text(L"") | size(WIDTH, GREATER_THAN, 14) | | ||||||
|     | size(WIDTH, GREATER_THAN, 14) |          size(HEIGHT, GREATER_THAN, 7) | bgcolor(Color::RGB(red, green, blue)); | ||||||
|     | size(HEIGHT, GREATER_THAN, 7) |  | ||||||
|     | bgcolor(Color::RGB(red, green, blue)); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| Element ColorString(int red, int green, int blue) { | Element ColorString(int red, int green, int blue) { | ||||||
|   | |||||||
| @@ -1,11 +1,14 @@ | |||||||
| #include <iostream> | #include <functional>  // for function | ||||||
| #include <thread> | #include <string>      // for wstring, allocator | ||||||
|  | #include <vector>      // for vector | ||||||
|  |  | ||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/component.hpp"           // for Component | ||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/radiobox.hpp"            // for RadioBox | ||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include "ftxui/screen/string.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/component.hpp"           // for Component | ||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/menu.hpp"                // for Menu | ||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include "ftxui/screen/string.hpp" | #include "ftxui/screen/box.hpp"                    // for ftxui | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,12 +1,7 @@ | |||||||
| #include "ftxui/component/toggle.hpp" | #include "ftxui/component/toggle.hpp" | ||||||
|  | #include "ftxui/component/container.hpp"           // for Container | ||||||
| #include <chrono> | #include "ftxui/component/event.hpp"               // for Event, Event::Return | ||||||
| #include <iostream> | #include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive | ||||||
| #include <thread> |  | ||||||
|  |  | ||||||
| #include "ftxui/component/container.hpp" |  | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
| #include "ftxui/screen/string.hpp" |  | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,9 @@ | |||||||
| #include <chrono> |  | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <iostream> | #include <memory> | ||||||
| #include <thread> |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,14 +1,16 @@ | |||||||
| #include <cmath> |  | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/color_info.hpp> | #include <ftxui/screen/color_info.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/terminal.hpp> | #include <ftxui/screen/terminal.hpp> | ||||||
| #include <iostream> | #include <memory> | ||||||
|  | #include <utility> | ||||||
| #include "ftxui/screen/string.hpp" | #include <vector> | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
| #include "./color_info_sorted_2d.ipp"  // ColorInfoSorted2D. | #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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   // clang-format off |   // clang-format off | ||||||
|   | |||||||
| @@ -1,10 +1,13 @@ | |||||||
| #include <algorithm> |  | ||||||
| #include <cmath> |  | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/color_info.hpp> | #include <ftxui/screen/color_info.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/terminal.hpp> | #include <string> | ||||||
| #include <iostream> | #include <utility> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
| #include "ftxui/screen/string.hpp" | #include "ftxui/screen/string.hpp" | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,10 +1,11 @@ | |||||||
| #include <cmath> |  | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/terminal.hpp> | #include <memory> | ||||||
| #include <iostream> | #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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,10 +1,11 @@ | |||||||
| #include <cmath> |  | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/terminal.hpp> | #include <memory> | ||||||
| #include <iostream> | #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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -2,8 +2,12 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <iostream> | #include <iostream> | ||||||
|  | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   using namespace std::chrono_literals; |   using namespace std::chrono_literals; | ||||||
|   | |||||||
| @@ -2,9 +2,15 @@ | |||||||
| #include <cmath> | #include <cmath> | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.hpp> | #include <functional> | ||||||
| #include <iostream> | #include <iostream> | ||||||
|  | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
|  |  | ||||||
| class Graph { | class Graph { | ||||||
|  public: |  public: | ||||||
|   | |||||||
| @@ -1,7 +1,11 @@ | |||||||
|  | #include <stddef.h> | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,10 +1,14 @@ | |||||||
| #include <chrono> | #include <chrono> | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.hpp> |  | ||||||
| #include <iostream> | #include <iostream> | ||||||
|  | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   using namespace std::chrono_literals; |   using namespace std::chrono_literals; | ||||||
|   | |||||||
| @@ -4,9 +4,16 @@ | |||||||
| #include <ftxui/screen/string.hpp> | #include <ftxui/screen/string.hpp> | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <list> | #include <list> | ||||||
|  | #include <memory> | ||||||
|  | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  | #include <utility> | ||||||
| #include <vector> | #include <vector> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
|  |  | ||||||
| /// @example examples/dom/package_manage.cpp | /// @example examples/dom/package_manage.cpp | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   | |||||||
| @@ -1,7 +1,10 @@ | |||||||
|  | #include <stdio.h> | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.hpp> | #include <string> | ||||||
| #include <iostream> |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,7 +1,12 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -3,7 +3,13 @@ | |||||||
| #include <ftxui/screen/screen.hpp> | #include <ftxui/screen/screen.hpp> | ||||||
| #include <ftxui/screen/string.hpp> | #include <ftxui/screen/string.hpp> | ||||||
| #include <iostream> | #include <iostream> | ||||||
|  | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  | #include <utility> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| int main(int argc, const char* argv[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,10 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,10 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,10 @@ | |||||||
|  | #include <stdio.h> | ||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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[]) { | int main(int argc, const char* argv[]) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -1,6 +1,10 @@ | |||||||
| #include <ftxui/dom/elements.hpp> | #include <ftxui/dom/elements.hpp> | ||||||
| #include <ftxui/screen/screen.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) { | int main(void) { | ||||||
|   using namespace ftxui; |   using namespace ftxui; | ||||||
|   | |||||||
| @@ -2,12 +2,18 @@ | |||||||
| // Use of this source code is governed by the MIT license that can be found in | // Use of this source code is governed by the MIT license that can be found in | ||||||
| // the LICENSE file. | // the LICENSE file. | ||||||
|  |  | ||||||
| #include <chrono> | #include <stddef.h>                                // for size_t | ||||||
| #include <ftxui/component/component.hpp> | #include <algorithm>                               // for max | ||||||
| #include <ftxui/component/screen_interactive.hpp> | #include <ftxui/component/component.hpp>           // for Component | ||||||
| #include <ftxui/screen/string.hpp> | #include <ftxui/component/screen_interactive.hpp>  // for ScreenInteractive | ||||||
| #include <iostream> | #include <string>                                  // for allocator, operator+ | ||||||
| #include <thread> | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,10 +2,14 @@ | |||||||
| #define FTXUI_COMPONENT_BUTTON_HPP | #define FTXUI_COMPONENT_BUTTON_HPP | ||||||
|  |  | ||||||
| #include <functional> | #include <functional> | ||||||
|  | #include <string> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief A button. An action is associated to the click event. | /// @brief A button. An action is associated to the click event. | ||||||
| /// @ingroup dom | /// @ingroup dom | ||||||
| @@ -25,6 +29,7 @@ class Button : public Component { | |||||||
|   // Component implementation. |   // Component implementation. | ||||||
|   Element Render() override; |   Element Render() override; | ||||||
|   bool OnEvent(Event) override; |   bool OnEvent(Event) override; | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   Box box_; |   Box box_; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -12,3 +12,7 @@ using CapturedMouse = std::unique_ptr<CapturedMouseInterface>; | |||||||
| }  // namespace ftxui | }  // namespace ftxui | ||||||
|  |  | ||||||
| #endif /* end of include guard: FTXUI_CAPTURED_MOUSE_HPP */ | #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. | ||||||
|   | |||||||
| @@ -1,11 +1,13 @@ | |||||||
| #ifndef FTXUI_COMPONENT_CHECKBOX_HPP | #ifndef FTXUI_COMPONENT_CHECKBOX_HPP | ||||||
| #define FTXUI_COMPONENT_CHECKBOX_HPP | #define FTXUI_COMPONENT_CHECKBOX_HPP | ||||||
|  |  | ||||||
| #include <functional> | #include <string> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief A Checkbox. It can be checked or unchecked.Display an element on a | /// @brief A Checkbox. It can be checked or unchecked.Display an element on a | ||||||
| /// ftxui::Screen. | /// ftxui::Screen. | ||||||
| @@ -42,7 +44,6 @@ class CheckBox : public Component { | |||||||
|  |  | ||||||
|   int cursor_position = 0; |   int cursor_position = 0; | ||||||
|   Box box_; |   Box box_; | ||||||
|  |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| }  // namespace ftxui | }  // namespace ftxui | ||||||
|   | |||||||
| @@ -1,14 +1,17 @@ | |||||||
| #ifndef FTXUI_COMPONENT_COMPONENT_HPP | #ifndef FTXUI_COMPONENT_COMPONENT_HPP | ||||||
| #define FTXUI_COMPONENT_COMPONENT_HPP | #define FTXUI_COMPONENT_COMPONENT_HPP | ||||||
|  |  | ||||||
| #include <memory> | #include <memory>  // for unique_ptr | ||||||
| #include "ftxui/component/event.hpp" | #include <vector>  // for vector | ||||||
| #include "ftxui/dom/elements.hpp" |  | ||||||
|  | #include "ftxui/component/captured_mouse.hpp"  // for CaptureMouse | ||||||
|  | #include "ftxui/dom/elements.hpp"             // for Element | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| class Delegate; | class Delegate; | ||||||
| class Focus; | class Focus; | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief It implement rendering itself as ftxui::Element. It implement | /// @brief It implement rendering itself as ftxui::Element. It implement | ||||||
| /// keyboard navigation by responding to ftxui::Event. | /// keyboard navigation by responding to ftxui::Event. | ||||||
| @@ -53,6 +56,8 @@ class Component { | |||||||
|   void TakeFocus(); |   void TakeFocus(); | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|  |   CapturedMouse CaptureMouse(const Event& event); | ||||||
|  |  | ||||||
|   std::vector<Component*> children_; |   std::vector<Component*> children_; | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   | |||||||
| @@ -2,6 +2,8 @@ | |||||||
| #define FTXUI_COMPONENT_CONTAINER_HPP | #define FTXUI_COMPONENT_CONTAINER_HPP | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/component/event.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,16 +1,14 @@ | |||||||
| #ifndef FTXUI_COMPONENT_EVENT_HPP | #ifndef FTXUI_COMPONENT_EVENT_HPP | ||||||
| #define FTXUI_COMPONENT_EVENT_HPP | #define FTXUI_COMPONENT_EVENT_HPP | ||||||
|  |  | ||||||
| #include <array> | #include <ftxui/component/mouse.hpp>  // for Mouse | ||||||
| #include <ftxui/component/mouse.hpp> | #include <string>                     // for string, operator== | ||||||
| #include <ftxui/component/receiver.hpp> |  | ||||||
| #include <functional> |  | ||||||
| #include <string> |  | ||||||
| #include <vector> | #include <vector> | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| class ScreenInteractive; | class ScreenInteractive; | ||||||
|  | class Component; | ||||||
|  |  | ||||||
| /// @brief Represent an event. It can be key press event, a terminal resize, or | /// @brief Represent an event. It can be key press event, a terminal resize, or | ||||||
| /// more ... | /// more ... | ||||||
| @@ -53,7 +51,7 @@ struct Event { | |||||||
|   static Event Custom; |   static Event Custom; | ||||||
|  |  | ||||||
|   //--- Method section --------------------------------------------------------- |   //--- Method section --------------------------------------------------------- | ||||||
|   bool is_character() const { return type_ == Type::Character;} |   bool is_character() const { return type_ == Type::Character; } | ||||||
|   wchar_t character() const { return character_; } |   wchar_t character() const { return character_; } | ||||||
|  |  | ||||||
|   bool is_mouse() const { return type_ == Type::Mouse; } |   bool is_mouse() const { return type_ == Type::Mouse; } | ||||||
| @@ -67,13 +65,12 @@ struct Event { | |||||||
|  |  | ||||||
|   const std::string& input() const { return input_; } |   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_; } |   bool operator==(const Event& other) const { return input_ == other.input_; } | ||||||
|  |  | ||||||
|   //--- State section ---------------------------------------------------------- |   //--- State section ---------------------------------------------------------- | ||||||
|  private: |  private: | ||||||
|  |   friend Component; | ||||||
|  |   friend ScreenInteractive; | ||||||
|   enum class Type { |   enum class Type { | ||||||
|     Unknown, |     Unknown, | ||||||
|     Character, |     Character, | ||||||
| @@ -94,10 +91,9 @@ struct Event { | |||||||
|   }; |   }; | ||||||
|   std::string input_; |   std::string input_; | ||||||
|  |  | ||||||
|   ScreenInteractive* screen_; |   ScreenInteractive* screen_ = nullptr; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| }  // namespace ftxui | }  // namespace ftxui | ||||||
|  |  | ||||||
| #endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */ | #endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */ | ||||||
|   | |||||||
| @@ -2,10 +2,14 @@ | |||||||
| #define FTXUI_COMPONENT_INPUT_H_ | #define FTXUI_COMPONENT_INPUT_H_ | ||||||
|  |  | ||||||
| #include <functional> | #include <functional> | ||||||
|  | #include <string> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief An input box. The user can type text into it. | /// @brief An input box. The user can type text into it. | ||||||
| /// @ingroup component. | /// @ingroup component. | ||||||
|   | |||||||
| @@ -2,11 +2,15 @@ | |||||||
| #define FTXUI_COMPONENT_MENU | #define FTXUI_COMPONENT_MENU | ||||||
|  |  | ||||||
| #include <functional> | #include <functional> | ||||||
|  | #include <string> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief A list of items. The user can navigate through them. | /// @brief A list of items. The user can navigate through them. | ||||||
| /// @ingroup component | /// @ingroup component | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | #ifndef FTXUI_COMPONENT_MOUSE_HPP | ||||||
|  | #define FTXUI_COMPONENT_MOUSE_HPP | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| /// @brief A mouse event. It contains the coordinate of the mouse, the button | /// @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. | // Copyright 2020 Arthur Sonzogni. All rights reserved. | ||||||
| // Use of this source code is governed by the MIT license that can be found in | // Use of this source code is governed by the MIT license that can be found in | ||||||
| // the LICENSE file. | // the LICENSE file. | ||||||
|  | #endif /* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */ | ||||||
|   | |||||||
| @@ -1,11 +1,15 @@ | |||||||
| #ifndef FTXUI_COMPONENT_RADIOBOX_HPP | #ifndef FTXUI_COMPONENT_RADIOBOX_HPP | ||||||
| #define FTXUI_COMPONENT_RADIOBOX_HPP | #define FTXUI_COMPONENT_RADIOBOX_HPP | ||||||
|  |  | ||||||
| #include <functional> | #include <string> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief A list of selectable element. One and only one can be selected at | /// @brief A list of selectable element. One and only one can be selected at | ||||||
| /// the same time. | /// the same time. | ||||||
|   | |||||||
| @@ -1,13 +1,13 @@ | |||||||
| #ifndef FTXUI_COMPONENT_RECEIVER_HPP_ | #ifndef FTXUI_COMPONENT_RECEIVER_HPP_ | ||||||
| #define FTXUI_COMPONENT_RECEIVER_HPP_ | #define FTXUI_COMPONENT_RECEIVER_HPP_ | ||||||
|  |  | ||||||
| #include <atomic> | #include <atomic>              // for atomic | ||||||
| #include <condition_variable> | #include <condition_variable>  // for condition_variable | ||||||
| #include <functional> | #include <functional> | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <memory> | #include <memory>  // for unique_ptr, make_unique | ||||||
| #include <mutex> | #include <mutex>   // for mutex, unique_lock | ||||||
| #include <queue> | #include <queue>   // for queue | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -38,6 +38,7 @@ namespace ftxui { | |||||||
| // clang-format off | // clang-format off | ||||||
| template<class T> class SenderImpl; | template<class T> class SenderImpl; | ||||||
| template<class T> class ReceiverImpl; | template<class T> class ReceiverImpl; | ||||||
|  |  | ||||||
| template<class T> using Sender = std::unique_ptr<SenderImpl<T>>; | template<class T> using Sender = std::unique_ptr<SenderImpl<T>>; | ||||||
| template<class T> using Receiver = std::unique_ptr<ReceiverImpl<T>>; | template<class T> using Receiver = std::unique_ptr<ReceiverImpl<T>>; | ||||||
| template<class T> Receiver<T> MakeReceiver(); | template<class T> Receiver<T> MakeReceiver(); | ||||||
|   | |||||||
| @@ -1,20 +1,18 @@ | |||||||
| #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||||
| #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP | ||||||
|  |  | ||||||
| #include <atomic> | #include <atomic>  // for atomic | ||||||
| #include <condition_variable> |  | ||||||
| #include <ftxui/component/receiver.hpp> | #include <ftxui/component/receiver.hpp> | ||||||
| #include <functional> | #include <memory>  // for unique_ptr | ||||||
| #include <memory> | #include <string>  // for string | ||||||
| #include <mutex> |  | ||||||
| #include <queue> |  | ||||||
|  |  | ||||||
| #include "ftxui/component/captured_mouse.hpp" | #include "ftxui/component/captured_mouse.hpp"  // for CapturedMouse | ||||||
| #include "ftxui/component/event.hpp" | #include "ftxui/component/event.hpp" | ||||||
| #include "ftxui/screen/screen.hpp" | #include "ftxui/screen/screen.hpp"  // for Screen | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
| class Component; | class Component; | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| class ScreenInteractive : public Screen { | class ScreenInteractive : public Screen { | ||||||
|  public: |  public: | ||||||
|   | |||||||
| @@ -11,13 +11,8 @@ namespace ftxui { | |||||||
| // float max = 100.f, | // float max = 100.f, | ||||||
| // float increment = (max - min) * 0.05f); | // float increment = (max - min) * 0.05f); | ||||||
|  |  | ||||||
| template<class T> // T = {int, float} | template <class T>  // T = {int, float} | ||||||
| ComponentPtr Slider(std::wstring label, | ComponentPtr Slider(std::wstring label, T* value, T min, T max, T increment); | ||||||
|                     T* value, |  | ||||||
|                     T min, |  | ||||||
|                     T max, |  | ||||||
|                     T increment); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| }  // namespace ftxui | }  // namespace ftxui | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,12 +1,15 @@ | |||||||
| #ifndef FTXUI_COMPONENT_TOGGLE_H_ | #ifndef FTXUI_COMPONENT_TOGGLE_H_ | ||||||
| #define FTXUI_COMPONENT_TOGGLE_H_ | #define FTXUI_COMPONENT_TOGGLE_H_ | ||||||
|  |  | ||||||
| #include <functional> |  | ||||||
| #include <string> | #include <string> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  | struct Event; | ||||||
|  |  | ||||||
| /// @brief An horizontal list of elements. The user can navigate through them. | /// @brief An horizontal list of elements. The user can navigate through them. | ||||||
| /// @ingroup component | /// @ingroup component | ||||||
|   | |||||||
| @@ -1,16 +1,18 @@ | |||||||
| #ifndef FTXUI_DOM_NODE_HPP | #ifndef FTXUI_DOM_NODE_HPP | ||||||
| #define FTXUI_DOM_NODE_HPP | #define FTXUI_DOM_NODE_HPP | ||||||
|  |  | ||||||
| #include <memory> | #include <memory>  // for shared_ptr | ||||||
| #include <vector> | #include <vector>  // for vector | ||||||
|  |  | ||||||
| #include "ftxui/dom/requirement.hpp" | #include "ftxui/dom/requirement.hpp"  // for Requirement | ||||||
| #include "ftxui/screen/box.hpp" | #include "ftxui/screen/box.hpp"       // for Box | ||||||
| #include "ftxui/screen/screen.hpp" | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| class Node; | class Node; | ||||||
|  | class Screen; | ||||||
|  |  | ||||||
| using Element = std::shared_ptr<Node>; | using Element = std::shared_ptr<Node>; | ||||||
| using Elements = std::vector<std::shared_ptr<Node>>; | using Elements = std::vector<std::shared_ptr<Node>>; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | // IWYU pragma: private, include "ftxui/dom/elements.hpp" | ||||||
| #include <type_traits> | #include <type_traits> | ||||||
|  |  | ||||||
| template <class T> | template <class T> | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| #ifndef FTXUI_SCREEN_COLOR | #ifndef FTXUI_SCREEN_COLOR | ||||||
| #define FTXUI_SCREEN_COLOR | #define FTXUI_SCREEN_COLOR | ||||||
|  |  | ||||||
| #include <cstdint> | #include <stdint.h>  // for uint8_t | ||||||
| #include <string> | #include <string>    // for wstring | ||||||
|  |  | ||||||
| #ifdef RGB | #ifdef RGB | ||||||
| // Workaround for wingdi.h (via Windows.h) defining macros that break things. | // Workaround for wingdi.h (via Windows.h) defining macros that break things. | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| #ifndef FTXUI_SCREEN_COLOR_INFO_HPP | #ifndef FTXUI_SCREEN_COLOR_INFO_HPP | ||||||
| #define FTXUI_SCREEN_COLOR_INFO_HPP | #define FTXUI_SCREEN_COLOR_INFO_HPP | ||||||
|  |  | ||||||
|  | #include <stdint.h> | ||||||
| #include <ftxui/screen/color.hpp> | #include <ftxui/screen/color.hpp> | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								iwyu.imp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								iwyu.imp
									
									
									
									
									
										Normal 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 ] }, | ||||||
|  | ] | ||||||
| @@ -1,7 +1,11 @@ | |||||||
| #include "ftxui/component/button.hpp" | #include <functional>  // for function | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -12,7 +16,7 @@ Element Button::Render() { | |||||||
|  |  | ||||||
| bool Button::OnEvent(Event event) { | bool Button::OnEvent(Event event) { | ||||||
|   if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) { |   if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) { | ||||||
|     if (!event.screen()->CaptureMouse()) |     if (!CaptureMouse(event)) | ||||||
|       return false; |       return false; | ||||||
|  |  | ||||||
|     TakeFocus(); |     TakeFocus(); | ||||||
|   | |||||||
| @@ -1,7 +1,11 @@ | |||||||
| #include "ftxui/component/checkbox.hpp" | #include <functional>  // for function | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -27,7 +31,7 @@ bool CheckBox::OnEvent(Event event) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool CheckBox::OnMouseEvent(Event event) { | bool CheckBox::OnMouseEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |     if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   if (!box_.Contain(event.mouse().x, event.mouse().y)) |   if (!box_.Contain(event.mouse().x, event.mouse().y)) | ||||||
|     return false; |     return false; | ||||||
|   | |||||||
| @@ -1,11 +1,20 @@ | |||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/component/component.hpp" | ||||||
|  |  | ||||||
| #include <assert.h> |  | ||||||
|  |  | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
|  |  | ||||||
|  | #include "ftxui/component/captured_mouse.hpp" | ||||||
|  | #include "ftxui/component/event.hpp" | ||||||
|  | #include "ftxui/component/screen_interactive.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|  | namespace { | ||||||
|  | class CaptureMouseImpl : public CapturedMouseInterface { | ||||||
|  |  public: | ||||||
|  |   ~CaptureMouseImpl() override {} | ||||||
|  | }; | ||||||
|  | } | ||||||
|  |  | ||||||
| Component::~Component() { | Component::~Component() { | ||||||
|   Detach(); |   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. | /// @brief Detach this children from its parent. | ||||||
| /// @see Attach | /// @see Attach | ||||||
| /// @see Detach | /// @see Detach | ||||||
|   | |||||||
| @@ -1,6 +1,8 @@ | |||||||
| #include "ftxui/component/container.hpp" | #include "ftxui/component/container.hpp" | ||||||
|  |  | ||||||
|  | #include <stddef.h> | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| #include "ftxui/component/event.hpp" | #include "ftxui/component/event.hpp" | ||||||
|  |  | ||||||
| #include <iostream> | #include "ftxui/component/mouse.hpp" | ||||||
| #include "ftxui/screen/string.hpp" | #include "ftxui/screen/string.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|   | |||||||
| @@ -1,9 +1,11 @@ | |||||||
| #include "ftxui/component/input.hpp" | #include "ftxui/component/input.hpp" | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
| #include <algorithm> | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -103,7 +105,7 @@ bool Input::OnEvent(Event event) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool Input::OnMouseEvent(Event event) { | bool Input::OnMouseEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   if (!input_box_.Contain(event.mouse().x, event.mouse().y)) |   if (!input_box_.Contain(event.mouse().x, event.mouse().y)) | ||||||
|     return false; |     return false; | ||||||
|   | |||||||
| @@ -1,8 +1,13 @@ | |||||||
| #include "ftxui/component/menu.hpp" | #include "ftxui/component/menu.hpp" | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
|  | #include <stddef.h> | ||||||
| #include <algorithm> | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -28,7 +33,7 @@ Element Menu::Render() { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool Menu::OnEvent(Event event) { | bool Menu::OnEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   if (event.is_mouse()) |   if (event.is_mouse()) | ||||||
|     return OnMouseEvent(event); |     return OnMouseEvent(event); | ||||||
| @@ -63,7 +68,7 @@ bool Menu::OnEvent(Event event) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool Menu::OnMouseEvent(Event event) { | bool Menu::OnMouseEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   for (int i = 0; i < boxes_.size(); ++i) { |   for (int i = 0; i < boxes_.size(); ++i) { | ||||||
|     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) |     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) | ||||||
|   | |||||||
| @@ -1,8 +1,14 @@ | |||||||
| #include "ftxui/component/radiobox.hpp" | #include "ftxui/component/radiobox.hpp" | ||||||
| #include "ftxui/component/screen_interactive.hpp" |  | ||||||
|  |  | ||||||
|  | #include <stddef.h> | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <functional> | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -13,8 +19,9 @@ Element RadioBox::Render() { | |||||||
|   for (size_t i = 0; i < entries.size(); ++i) { |   for (size_t i = 0; i < entries.size(); ++i) { | ||||||
|     auto style = |     auto style = | ||||||
|         (focused == int(i) && is_focused) ? focused_style : unfocused_style; |         (focused == int(i) && is_focused) ? focused_style : unfocused_style; | ||||||
|     auto focus_management = |     auto focus_management = (focused != int(i)) ? nothing | ||||||
|         (focused != int(i)) ? nothing : is_focused ? focus : select; |                             : is_focused        ? focus | ||||||
|  |                                                 : select; | ||||||
|  |  | ||||||
|     const std::wstring& symbol = selected == int(i) ? checked : unchecked; |     const std::wstring& symbol = selected == int(i) ? checked : unchecked; | ||||||
|     elements.push_back(hbox(text(symbol), text(entries[i]) | style) | |     elements.push_back(hbox(text(symbol), text(entries[i]) | style) | | ||||||
| @@ -24,7 +31,7 @@ Element RadioBox::Render() { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool RadioBox::OnEvent(Event event) { | bool RadioBox::OnEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   if (event.is_mouse()) |   if (event.is_mouse()) | ||||||
|     return OnMouseEvent(event); |     return OnMouseEvent(event); | ||||||
| @@ -58,7 +65,7 @@ bool RadioBox::OnEvent(Event event) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool RadioBox::OnMouseEvent(Event event) { | bool RadioBox::OnMouseEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   for (int i = 0; i < boxes_.size(); ++i) { |   for (int i = 0; i < boxes_.size(); ++i) { | ||||||
|     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) |     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) | ||||||
|   | |||||||
| @@ -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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 "ftxui/component/receiver.hpp" | ||||||
|  | #include "gtest/gtest_pred_impl.h"  // for AssertionResult, Test, EXPECT_EQ | ||||||
| #include <thread> |  | ||||||
|  |  | ||||||
| #include "gtest/gtest.h" |  | ||||||
|  |  | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,19 +1,24 @@ | |||||||
| #include "ftxui/component/screen_interactive.hpp" | #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 "ftxui/component/captured_mouse.hpp"         // for CapturedMouse | ||||||
| #include <csignal> | #include "ftxui/component/component.hpp"              // for Component | ||||||
| #include <cstdlib> | #include "ftxui/component/event.hpp"                  // for Event | ||||||
| #include <iostream> | #include "ftxui/component/mouse.hpp"                  // for Mouse | ||||||
| #include <stack> | #include "ftxui/component/receiver.hpp"               // for ReceiverImpl | ||||||
| #include <thread> | #include "ftxui/component/terminal_input_parser.hpp"  // for TerminalInputPa... | ||||||
|  | #include "ftxui/dom/node.hpp"                         // for Node, Render | ||||||
| #include "ftxui/component/captured_mouse.hpp" | #include "ftxui/dom/requirement.hpp"                  // for Requirement | ||||||
| #include "ftxui/component/component.hpp" | #include "ftxui/screen/terminal.hpp"                  // for Terminal::Dimen... | ||||||
| #include "ftxui/component/terminal_input_parser.hpp" |  | ||||||
| #include "ftxui/screen/string.hpp" |  | ||||||
| #include "ftxui/screen/terminal.hpp" |  | ||||||
|  |  | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
| #define DEFINE_CONSOLEV2_PROPERTIES | #define DEFINE_CONSOLEV2_PROPERTIES | ||||||
| @@ -26,8 +31,9 @@ | |||||||
| #error Must be compiled in UNICODE mode | #error Must be compiled in UNICODE mode | ||||||
| #endif | #endif | ||||||
| #else | #else | ||||||
| #include <termios.h> | #include <sys/select.h>  // for select, FD_ISSET | ||||||
| #include <unistd.h> | #include <termios.h>     // for tcsetattr, tcge... | ||||||
|  | #include <unistd.h>      // for STDIN_FILENO, read | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| // Quick exit is missing in standard CLang headers | // Quick exit is missing in standard CLang headers | ||||||
| @@ -48,8 +54,7 @@ constexpr int timeout_milliseconds = 20; | |||||||
| constexpr int timeout_microseconds = timeout_milliseconds * 1000; | constexpr int timeout_microseconds = timeout_milliseconds * 1000; | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
|  |  | ||||||
| void EventListener(std::atomic<bool>* quit, | void EventListener(std::atomic<bool>* quit, Sender<Event> out) { | ||||||
|                         Sender<Event> out) { |  | ||||||
|   auto console = GetStdHandle(STD_INPUT_HANDLE); |   auto console = GetStdHandle(STD_INPUT_HANDLE); | ||||||
|   auto parser = TerminalInputParser(out->Clone()); |   auto parser = TerminalInputParser(out->Clone()); | ||||||
|   while (!*quit) { |   while (!*quit) { | ||||||
| @@ -69,8 +74,7 @@ void EventListener(std::atomic<bool>* quit, | |||||||
|  |  | ||||||
|     std::vector<INPUT_RECORD> records{number_of_events}; |     std::vector<INPUT_RECORD> records{number_of_events}; | ||||||
|     DWORD number_of_events_read = 0; |     DWORD number_of_events_read = 0; | ||||||
|     ReadConsoleInput(console, records.data(), |     ReadConsoleInput(console, records.data(), (DWORD)records.size(), | ||||||
|                      (DWORD)records.size(), |  | ||||||
|                      &number_of_events_read); |                      &number_of_events_read); | ||||||
|     records.resize(number_of_events_read); |     records.resize(number_of_events_read); | ||||||
|  |  | ||||||
| @@ -106,7 +110,7 @@ void EventListener(std::atomic<bool>* quit, Sender<Event> out) { | |||||||
|  |  | ||||||
|   char c; |   char c; | ||||||
|   while (!*quit) { |   while (!*quit) { | ||||||
|     while(read(STDIN_FILENO, &c, 1), c) |     while (read(STDIN_FILENO, &c, 1), c) | ||||||
|       parser.Add(c); |       parser.Add(c); | ||||||
|  |  | ||||||
|     emscripten_sleep(1); |     emscripten_sleep(1); | ||||||
| @@ -115,7 +119,7 @@ void EventListener(std::atomic<bool>* quit, Sender<Event> out) { | |||||||
| } | } | ||||||
|  |  | ||||||
| #else | #else | ||||||
| #include <sys/time.h> | #include <sys/time.h>  // for timeval | ||||||
|  |  | ||||||
| int CheckStdinReady(int usec_timeout) { | int CheckStdinReady(int usec_timeout) { | ||||||
|   timeval tv = {0, usec_timeout}; |   timeval tv = {0, usec_timeout}; | ||||||
| @@ -219,8 +223,7 @@ void OnResize(int /* signal */) { | |||||||
|  |  | ||||||
| class CapturedMouseImpl : public CapturedMouseInterface { | class CapturedMouseImpl : public CapturedMouseInterface { | ||||||
|  public: |  public: | ||||||
|   CapturedMouseImpl(std::function<void(void)> callback) |   CapturedMouseImpl(std::function<void(void)> callback) : callback_(callback) {} | ||||||
|       : callback_(callback) {} |  | ||||||
|   ~CapturedMouseImpl() override { callback_(); } |   ~CapturedMouseImpl() override { callback_(); } | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
| @@ -366,7 +369,7 @@ void ScreenInteractive::Loop(Component* component) { | |||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   enable({ |   enable({ | ||||||
|       //DECMode::kMouseVt200, |       // DECMode::kMouseVt200, | ||||||
|       DECMode::kMouseAnyEvent, |       DECMode::kMouseAnyEvent, | ||||||
|       DECMode::kMouseUtf8, |       DECMode::kMouseUtf8, | ||||||
|       DECMode::kMouseSgrExtMode, |       DECMode::kMouseSgrExtMode, | ||||||
| @@ -406,7 +409,7 @@ void ScreenInteractive::Loop(Component* component) { | |||||||
|       event.mouse().y -= cursor_y_; |       event.mouse().y -= cursor_y_; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     event.SetScreen(this); |     event.screen_ = this; | ||||||
|     component->OnEvent(event); |     component->OnEvent(event); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,10 +1,18 @@ | |||||||
| #include "ftxui/component/slider.hpp" | #include "ftxui/component/slider.hpp" | ||||||
|  |  | ||||||
|  | #include <memory> | ||||||
|  | #include <utility> | ||||||
|  |  | ||||||
| #include "ftxui/component/captured_mouse.hpp" | #include "ftxui/component/captured_mouse.hpp" | ||||||
|  | #include "ftxui/component/mouse.hpp" | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #include "ftxui/component/screen_interactive.hpp" | ||||||
|  | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| template<class T> | template <class T> | ||||||
| class SliderImpl : public Component { | class SliderImpl : public Component { | ||||||
|  public: |  public: | ||||||
|   SliderImpl(std::wstring label, T* value, T min, T max, T increment) |   SliderImpl(std::wstring label, T* value, T min, T max, T increment) | ||||||
| @@ -55,7 +63,7 @@ class SliderImpl : public Component { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (box_.Contain(event.mouse().x, event.mouse().y) && |     if (box_.Contain(event.mouse().x, event.mouse().y) && | ||||||
|         event.screen()->CaptureMouse()) { |         CaptureMouse(event)) { | ||||||
|       TakeFocus(); |       TakeFocus(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -63,7 +71,7 @@ class SliderImpl : public Component { | |||||||
|         event.mouse().motion == Mouse::Pressed && |         event.mouse().motion == Mouse::Pressed && | ||||||
|         gauge_box_.Contain(event.mouse().x, event.mouse().y) && |         gauge_box_.Contain(event.mouse().x, event.mouse().y) && | ||||||
|         !captured_mouse_) { |         !captured_mouse_) { | ||||||
|       captured_mouse_ = event.screen()->CaptureMouse(); |       captured_mouse_ = CaptureMouse(event); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (captured_mouse_) { |     if (captured_mouse_) { | ||||||
| @@ -105,3 +113,7 @@ template ComponentPtr Slider(std::wstring label, | |||||||
|                              float increment); |                              float increment); | ||||||
|  |  | ||||||
| }  // namespace ftxui | }  // 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. | ||||||
|   | |||||||
| @@ -1,5 +1,8 @@ | |||||||
| #include "ftxui/component/terminal_input_parser.hpp" | #include "ftxui/component/terminal_input_parser.hpp" | ||||||
|  |  | ||||||
|  | #include <utility> | ||||||
|  | #include "ftxui/component/event.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
| TerminalInputParser::TerminalInputParser(Sender<Event> out) | TerminalInputParser::TerminalInputParser(Sender<Event> out) | ||||||
| @@ -61,7 +64,6 @@ void TerminalInputParser::Send(TerminalInputParser::Output output) { | |||||||
|       return; |       return; | ||||||
|   } |   } | ||||||
|   // NOT_REACHED(). |   // NOT_REACHED(). | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| TerminalInputParser::Output TerminalInputParser::Parse() { | TerminalInputParser::Output TerminalInputParser::Parse() { | ||||||
| @@ -227,3 +229,7 @@ TerminalInputParser::Output TerminalInputParser::ParseCursorReporting( | |||||||
| } | } | ||||||
|  |  | ||||||
| }  // namespace ftxui | }  // 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. | ||||||
|   | |||||||
| @@ -1,10 +1,13 @@ | |||||||
| #ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER | #ifndef FTXUI_COMPONENT_TERMINAL_INPUT_PARSER | ||||||
| #define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER | #define FTXUI_COMPONENT_TERMINAL_INPUT_PARSER | ||||||
|  |  | ||||||
| #include "ftxui/component/event.hpp" | #include <memory>  // for unique_ptr | ||||||
| #include "ftxui/component/receiver.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| #include "ftxui/component/terminal_input_parser.hpp" | #include <gtest/gtest-message.h>    // for Message | ||||||
| #include "ftxui/component/receiver.hpp" | #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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,12 @@ | |||||||
| #include "ftxui/component/toggle.hpp" | #include <stddef.h>   // for size_t | ||||||
| #include "ftxui/component/screen_interactive.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
| @@ -60,7 +65,7 @@ bool Toggle::OnEvent(Event event) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool Toggle::OnMouseEvent(Event event) { | bool Toggle::OnMouseEvent(Event event) { | ||||||
|   if (!event.screen()->CaptureMouse()) |   if (!CaptureMouse(event)) | ||||||
|     return false; |     return false; | ||||||
|   for (int i = 0; i < boxes_.size(); ++i) { |   for (int i = 0; i < boxes_.size(); ++i) { | ||||||
|     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) |     if (!boxes_[i].Contain(event.mouse().x, event.mouse().y)) | ||||||
|   | |||||||
| @@ -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; | using namespace ftxui; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/elements.hpp"  // for unpack, Element, Decorator, Elements, border, borderWith, window | ||||||
| #include "ftxui/dom/node.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/color.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
| #include "ftxui/dom/node.hpp" |  | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/elements.hpp"     // for Element, Elements, dbox | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp"         // for Node | ||||||
|  | #include "ftxui/dom/requirement.hpp"  // for Requirement | ||||||
|  | #include "ftxui/screen/box.hpp"       // for Box | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
|  | #include "ftxui/dom/node.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/dom/requirement.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/elements.hpp"  // for Element, unpack, focus, frame, select, xframe, yframe | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp"  // for Node | ||||||
| #include "ftxui/util/autoreset.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
|  | #include <memory> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #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 { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,12 @@ | |||||||
| #include "ftxui/dom/elements.hpp" | #include <gtest/gtest-message.h>    // for Message | ||||||
| #include "ftxui/screen/screen.hpp" | #include <gtest/gtest-test-part.h>  // for TestPartResult | ||||||
| #include "gtest/gtest.h" | #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; | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|   | |||||||
| @@ -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 { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/elements.hpp"     // for Element, Elements, hbox | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp"         // for Node | ||||||
|  | #include "ftxui/dom/requirement.hpp"  // for Requirement | ||||||
|  | #include "ftxui/screen/box.hpp"       // for Box | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,13 @@ | |||||||
| #include "ftxui/dom/elements.hpp" | #include <gtest/gtest-message.h>    // for Message | ||||||
| #include "ftxui/screen/screen.hpp" | #include <gtest/gtest-test-part.h>  // for TestPartResult | ||||||
| #include "gtest/gtest.h" | #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; | ||||||
| using namespace ftxui; | using namespace ftxui; | ||||||
|   | |||||||
| @@ -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/elements.hpp"     // for Element, Elements, hflow | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp"         // for Node | ||||||
|  | #include "ftxui/dom/requirement.hpp"  // for Requirement | ||||||
|  | #include "ftxui/screen/box.hpp"       // for Box | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,10 @@ | |||||||
|  | #include <memory> | ||||||
|  | #include <utility> | ||||||
|  |  | ||||||
| #include "ftxui/dom/elements.hpp" | #include "ftxui/dom/elements.hpp" | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/screen/box.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,7 @@ | |||||||
|  | #include <utility> | ||||||
|  |  | ||||||
| #include "ftxui/dom/node.hpp" | #include "ftxui/dom/node.hpp" | ||||||
|  | #include "ftxui/screen/screen.hpp" | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
|  | #include <memory>  // for __shared_ptr_access | ||||||
|  | #include <vector>  // for vector | ||||||
|  |  | ||||||
| #include "ftxui/dom/node_decorator.hpp" | #include "ftxui/dom/node_decorator.hpp" | ||||||
|  | #include "ftxui/dom/requirement.hpp"  // for Requirement | ||||||
|  | #include "ftxui/screen/box.hpp"       // for Box | ||||||
|  |  | ||||||
| namespace ftxui { | namespace ftxui { | ||||||
|  |  | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 ArthurSonzogni
					ArthurSonzogni