mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	| @@ -1,7 +1,3 @@ | ||||
| cmake_minimum_required(VERSION 3.0) | ||||
|  | ||||
| add_subdirectory(component) | ||||
| add_subdirectory(dom) | ||||
|  | ||||
| add_executable(print_key_press print_key_press.cpp) | ||||
| target_link_libraries(print_key_press PUBLIC component) | ||||
| add_subdirectory(util) | ||||
|   | ||||
							
								
								
									
										85
									
								
								examples/html/test.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								examples/html/test.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
| <!doctype html> | ||||
| <html lang="en_US"> | ||||
| <head> | ||||
|   <meta charset="utf-8"> | ||||
|  | ||||
|  | ||||
|   <style> | ||||
|     html, body, textarea{ | ||||
|       margin:0; | ||||
|       padding:0; | ||||
|       width: 100%; | ||||
|       height: 100%; | ||||
|       overflow:hidden; | ||||
|     } | ||||
|  | ||||
|     body { | ||||
|       background-color:gray; | ||||
|     }; | ||||
|  | ||||
|     textarea { | ||||
|       white-space: pre-wrap; | ||||
|       background-color:white; | ||||
|     } | ||||
|   </style> | ||||
|  | ||||
|   <script type="text/c++"> | ||||
|     #include <iostream> | ||||
|  | ||||
|     #include "ftxui/screen/screen.hpp" | ||||
|     #include "ftxui/dom/elements.hpp" | ||||
|  | ||||
|     int main() { | ||||
|       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"), | ||||
|                     gauge(0.5) | border, | ||||
|                     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 screen = Screen::Create(Dimension::Fit(document)); | ||||
|       Render(screen, document.get()); | ||||
|       std::cout << screen.ToString() << std::endl; | ||||
|       return 0; | ||||
|     } | ||||
|   </script>  | ||||
| </head> | ||||
| <body> | ||||
|   <textarea id="box"></textarea> | ||||
| </body> | ||||
|   <script> | ||||
|     window.Module = { | ||||
|       'print': function(text) { | ||||
|         console.log(text); | ||||
|         document.getElementById("box").value += text + '\n'; | ||||
|       } | ||||
|     }; | ||||
|   </script> | ||||
| </html> | ||||
							
								
								
									
										6
									
								
								examples/util/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								examples/util/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| function(example name) | ||||
|   add_executable(${name} ${name}.cpp) | ||||
|   target_link_libraries(${name} PUBLIC component) | ||||
| endfunction(example) | ||||
|  | ||||
| example(print_key_press) | ||||
		Reference in New Issue
	
	Block a user
	 ArthurSonzogni
					ArthurSonzogni