mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 18:48:11 +08:00 
			
		
		
		
	Refactor directory structure.
The goal is to increase the separation in between: * ftxui::screen * ftxui::dom * ftxui::component
This commit is contained in:
		| @@ -2,18 +2,17 @@ | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/input.hpp" | ||||
| #include "ftxui/component/component_vertical.hpp" | ||||
| #include "ftxui/component/input.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/util/string.hpp" | ||||
|  | ||||
| using namespace ftxui::component; | ||||
| using namespace ftxui::dom; | ||||
| using namespace ftxui; | ||||
|  | ||||
| class MyComponent : ComponentVertical { | ||||
|  public: | ||||
|   MyComponent(ftxui::component::Delegate* delegate) | ||||
|   MyComponent(Delegate* delegate) | ||||
|       : ComponentVertical(delegate), | ||||
|         input_1(delegate->NewChild()), | ||||
|         input_2(delegate->NewChild()), | ||||
| @@ -45,7 +44,7 @@ class MyComponent : ComponentVertical { | ||||
| }; | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   auto screen = ftxui::ScreenInteractive::TerminalOutput(); | ||||
|   auto screen = ScreenInteractive::TerminalOutput(); | ||||
|   MyComponent component(screen.delegate()); | ||||
|   component.on_enter = screen.ExitLoopClosure(); | ||||
|   screen.Loop(); | ||||
|   | ||||
| @@ -2,18 +2,15 @@ | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/menu.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
|  | ||||
| int main(int argc, const char *argv[]) | ||||
| { | ||||
|   auto screen = ftxui::ScreenInteractive::FixedSize(30, 3); | ||||
|   ftxui::component::Menu menu(screen.delegate()); | ||||
|   menu.entries = { | ||||
|     L"entry 1", | ||||
|     L"entry 2", | ||||
|     L"entry 3" | ||||
|   }; | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui::component; | ||||
|   using namespace ftxui::screen; | ||||
|   auto screen = ScreenInteractive::FixedSize(30, 3); | ||||
|   Menu menu(screen.delegate()); | ||||
|   menu.entries = {L"entry 1", L"entry 2", L"entry 3"}; | ||||
|   menu.selected = 0; | ||||
|   menu.on_enter = screen.ExitLoopClosure(); | ||||
|  | ||||
|   | ||||
| @@ -2,10 +2,10 @@ | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/menu.hpp" | ||||
| #include "ftxui/component/component_horizontal.hpp" | ||||
| #include "ftxui/component/component_vertical.hpp" | ||||
| #include "ftxui/component/menu.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/util/string.hpp" | ||||
|  | ||||
| using namespace ftxui::component; | ||||
| @@ -13,7 +13,7 @@ using namespace ftxui::dom; | ||||
|  | ||||
| class MyComponent : ComponentHorizontal { | ||||
|   public: | ||||
|    MyComponent(ftxui::component::Delegate* delegate) | ||||
|    MyComponent(Delegate* delegate) | ||||
|        : ComponentHorizontal(delegate), | ||||
|          left_menu(delegate->NewChild()), | ||||
|          right_menu(delegate->NewChild()) { | ||||
| @@ -66,7 +66,7 @@ class MyComponent : ComponentHorizontal { | ||||
|  | ||||
| int main(int argc, const char *argv[]) | ||||
| { | ||||
|   auto screen = ftxui::ScreenInteractive::TerminalOutput(); | ||||
|   auto screen = ScreenInteractive::TerminalOutput(); | ||||
|   MyComponent component(screen.delegate()); | ||||
|   component.on_enter = screen.ExitLoopClosure(); | ||||
|   screen.Loop(); | ||||
|   | ||||
| @@ -3,16 +3,15 @@ | ||||
|  | ||||
| #include "ftxui/component/component_horizontal.hpp" | ||||
| #include "ftxui/component/menu.hpp" | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/util/string.hpp" | ||||
|  | ||||
| using namespace ftxui; | ||||
| using namespace ftxui::component; | ||||
| using namespace ftxui::dom; | ||||
|  | ||||
| class MyComponent : ComponentHorizontal { | ||||
|   public: | ||||
|    MyComponent(ftxui::component::Delegate* delegate) | ||||
|    MyComponent(Delegate* delegate) | ||||
|        : ComponentHorizontal(delegate), | ||||
|          menu_1(delegate->NewChild()), | ||||
|          menu_2(delegate->NewChild()), | ||||
| @@ -76,8 +75,7 @@ class MyComponent : ComponentHorizontal { | ||||
|  | ||||
| int main(int argc, const char *argv[]) | ||||
| { | ||||
|   //auto screen = ftxui::ScreenInteractive::TerminalOutput(); | ||||
|   auto screen = ftxui::ScreenInteractive::Fullscreen(); | ||||
|   auto screen = ScreenInteractive::TerminalOutput(); | ||||
|   MyComponent component(screen.delegate()); | ||||
|   component.on_enter = screen.ExitLoopClosure(); | ||||
|   screen.Loop(); | ||||
|   | ||||
| @@ -2,18 +2,17 @@ | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/component/component_vertical.hpp" | ||||
| #include "ftxui/component/toggle.hpp" | ||||
| #include "ftxui/component/menu.hpp" | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/component/toggle.hpp" | ||||
| #include "ftxui/util/string.hpp" | ||||
|  | ||||
| using namespace ftxui; | ||||
| using namespace ftxui::component; | ||||
| using namespace ftxui::dom; | ||||
|  | ||||
| class MyComponent : ComponentVertical { | ||||
|   public: | ||||
|    MyComponent(ftxui::component::Delegate* delegate) | ||||
|    MyComponent(Delegate* delegate) | ||||
|        : ComponentVertical(delegate), | ||||
|          toggle(delegate->NewChild()), | ||||
|          menu(delegate->NewChild()) { | ||||
| @@ -39,7 +38,7 @@ class MyComponent : ComponentVertical { | ||||
|   | ||||
| int main(int argc, const char *argv[]) | ||||
| { | ||||
|   auto screen = ftxui::ScreenInteractive::TerminalOutput(); | ||||
|   auto screen = ScreenInteractive::TerminalOutput(); | ||||
|   MyComponent component(screen.delegate()); | ||||
|   component.on_enter = screen.ExitLoopClosure(); | ||||
|   screen.Loop(); | ||||
|   | ||||
| @@ -2,19 +2,18 @@ | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/screen_interactive.hpp" | ||||
| #include "ftxui/component/toggle.hpp" | ||||
| #include "ftxui/component/component_horizontal.hpp" | ||||
| #include "ftxui/component/component_vertical.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/component/toggle.hpp" | ||||
| #include "ftxui/util/string.hpp" | ||||
|  | ||||
| using namespace ftxui; | ||||
| using namespace ftxui::component; | ||||
| using namespace ftxui::dom; | ||||
|  | ||||
| class MyComponent : ComponentVertical { | ||||
|  public: | ||||
|   MyComponent(ftxui::component::Delegate* delegate) | ||||
|   MyComponent(Delegate* delegate) | ||||
|       : ComponentVertical(delegate), | ||||
|         toggle_1(delegate->NewChild()), | ||||
|         toggle_2(delegate->NewChild()), | ||||
| @@ -62,7 +61,7 @@ class MyComponent : ComponentVertical { | ||||
| }; | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   auto screen = ftxui::ScreenInteractive::TerminalOutput(); | ||||
|   auto screen = ScreenInteractive::TerminalOutput(); | ||||
|   MyComponent component(screen.delegate()); | ||||
|   component.on_enter = screen.ExitLoopClosure(); | ||||
|   screen.Loop(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Arthur Sonzogni
					Arthur Sonzogni