mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Update document WIP.
This commit is contained in:
		 ArthurSonzogni
					ArthurSonzogni
				
			
				
					committed by
					
						 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
			
				
	
			
			
			 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
						parent
						
							177df31d41
						
					
				
				
					commit
					75c424cea9
				
			| @@ -23,3 +23,4 @@ example(vbox_hbox) | ||||
| example(hflow) | ||||
| example(paragraph) | ||||
| example(html_like) | ||||
| example(window) | ||||
|   | ||||
| @@ -3,41 +3,33 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document = hbox({ | ||||
|       window(text(L" main frame ") | hcenter, | ||||
|              vbox({ | ||||
|                  text(L"Line 1"), | ||||
|                  text(L"Line 2"), | ||||
|                  text(L"Line 3"), | ||||
|                  vbox({ | ||||
|                      text(L"Line 4"), | ||||
|                      text(L"Line 5"), | ||||
|                      text(L"Line 6"), | ||||
|                  }) | border, | ||||
|                  hbox({ | ||||
|                      window(text(L"frame 2"), vbox({ | ||||
|                                                   text(L"Line 4"), | ||||
|                                                   text(L"Line 5"), | ||||
|                                                   text(L"Line 6"), | ||||
|                                               })), | ||||
|                      window(text(L"frame 3"), vbox({ | ||||
|                                                   text(L"Line 7"), | ||||
|                                                   text(L"Line 8"), | ||||
|                                                   text(L"Line 9"), | ||||
|                                               })), | ||||
|                  }), | ||||
|                  text(L"footer footer footer footer footer"), | ||||
|              })), | ||||
|       filler(), | ||||
|   }); | ||||
|   auto document =  // | ||||
|       hbox({ | ||||
|           vbox({ | ||||
|               text(L"Line 1"), | ||||
|               text(L"Line 2"), | ||||
|               text(L"Line 3"), | ||||
|           }) | border, | ||||
|  | ||||
|           vbox({ | ||||
|               text(L"Line 4"), | ||||
|               text(L"Line 5"), | ||||
|               text(L"Line 6"), | ||||
|           }) | border, | ||||
|  | ||||
|           vbox({ | ||||
|               text(L"Line 7"), | ||||
|               text(L"Line 8"), | ||||
|               text(L"Line 9"), | ||||
|           }) | border, | ||||
|       }); | ||||
|   auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document)); | ||||
|   Render(screen, document); | ||||
|   std::cout << screen.ToString() << std::endl; | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document = dbox({ | ||||
|   | ||||
| @@ -3,12 +3,11 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   using namespace std::chrono_literals; | ||||
|   | ||||
| @@ -4,13 +4,12 @@ | ||||
|  | ||||
| #include <chrono> | ||||
| #include <cmath> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| class Graph { | ||||
|  public: | ||||
|   std::vector<int> operator()(int width, int height) { | ||||
|   | ||||
| @@ -2,12 +2,11 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto make_box = [](size_t dimx, size_t dimy) { | ||||
|   | ||||
| @@ -3,13 +3,12 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   using namespace std::chrono_literals; | ||||
|   | ||||
| @@ -3,14 +3,15 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
| #include <list> | ||||
| #include <thread> | ||||
| #include <vector> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
| /// @example examples/dom/package_manage.cpp | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   | ||||
| @@ -2,12 +2,11 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   std::wstring p = | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document = hbox({ | ||||
|   | ||||
| @@ -2,12 +2,11 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto make_box = [](const std::wstring title) { | ||||
|   | ||||
| @@ -3,13 +3,12 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   using namespace std::chrono_literals; | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document =  // | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document =  // | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   // clang-format off | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document =  // | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   // clang-format off | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document = hbox({ | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document =  // | ||||
|   | ||||
| @@ -2,11 +2,10 @@ | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| #include "ftxui/dom/elements.hpp" | ||||
| #include "ftxui/screen/screen.hpp" | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document =  // | ||||
|   | ||||
							
								
								
									
										15
									
								
								examples/dom/window.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								examples/dom/window.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| // Copyright 2020 Arthur Sonzogni. All rights reserved. | ||||
| // Use of this source code is governed by the MIT license that can be found in | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <ftxui/dom/elements.hpp> | ||||
| #include <ftxui/screen/screen.hpp> | ||||
| #include <iostream> | ||||
|  | ||||
| int main(int argc, const char* argv[]) { | ||||
|   using namespace ftxui; | ||||
|   auto document = window(text(L"Title"), text(L"content")); | ||||
|   auto screen = Screen::Create(Dimension::Fixed(30), Dimension::Fixed(6)); | ||||
|   Render(screen, document); | ||||
|   std::cout << screen.ToString() << std::endl; | ||||
| } | ||||
| @@ -26,8 +26,8 @@ | ||||
|   <script type="text/c++"> | ||||
|     #include <iostream> | ||||
|  | ||||
|     #include "ftxui/screen/screen.hpp" | ||||
|     #include "ftxui/dom/elements.hpp" | ||||
|     #include <ftxui/screen/screen.hpp> | ||||
|     #include <ftxui/dom/elements.hpp> | ||||
|  | ||||
|     int main() { | ||||
|       using namespace ftxui; | ||||
|   | ||||
| @@ -3,13 +3,12 @@ | ||||
| // the LICENSE file. | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ftxui/component/component.hpp> | ||||
| #include <ftxui/component/screen_interactive.hpp> | ||||
| #include <ftxui/screen/string.hpp> | ||||
| #include <iostream> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ftxui/component/component.hpp" | ||||
| #include "ftxui/component/screen_interactive.hpp" | ||||
| #include "ftxui/screen/string.hpp" | ||||
|  | ||||
| using namespace ftxui; | ||||
|  | ||||
| class DrawKey : public Component { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user