mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Compare commits
35 Commits
v5.0.0
...
support-v4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0200632555 | ||
![]() |
ce252ff92e | ||
![]() |
afb03620da | ||
![]() |
de6749fed7 | ||
![]() |
2bcdb9ac54 | ||
![]() |
2ed61a9d31 | ||
![]() |
46042ce74a | ||
![]() |
1651ae56ca | ||
![]() |
f64e1e128e | ||
![]() |
3483022703 | ||
![]() |
7f5aed1e66 | ||
![]() |
438a7dc842 | ||
![]() |
513ec6c5e1 | ||
![]() |
234b3c8a5d | ||
![]() |
6ce88c25e5 | ||
![]() |
f74c5322bd | ||
![]() |
1e86587b68 | ||
![]() |
41c3d4dd52 | ||
![]() |
2fb0b77f02 | ||
![]() |
e2aff66b98 | ||
![]() |
22ebc823c9 | ||
![]() |
49f0277103 | ||
![]() |
ac10603fdb | ||
![]() |
a3f51ecf22 | ||
![]() |
78897ef1f4 | ||
![]() |
debcbc668c | ||
![]() |
1a7a550bfe | ||
![]() |
4ce8f6d250 | ||
![]() |
7b08dae6d0 | ||
![]() |
521d1125d9 | ||
![]() |
0903ad1608 | ||
![]() |
399549d180 | ||
![]() |
7bdca3ee68 | ||
![]() |
eb313e0f2d | ||
![]() |
d3ee655a90 |
9
.github/workflows/build.yaml
vendored
9
.github/workflows/build.yaml
vendored
@@ -66,7 +66,8 @@ jobs:
|
|||||||
-DFTXUI_BUILD_EXAMPLES:BOOL=ON
|
-DFTXUI_BUILD_EXAMPLES:BOOL=ON
|
||||||
-DFTXUI_BUILD_TESTS:BOOL=ON
|
-DFTXUI_BUILD_TESTS:BOOL=ON
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF
|
-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF
|
||||||
-DFTXUI_ENABLE_INSTALL:BOOL=ON ;
|
-DFTXUI_ENABLE_INSTALL:BOOL=ON
|
||||||
|
-DFTXUI_DEV_WARNINGS:BOOL=ON ;
|
||||||
|
|
||||||
- name: "Build"
|
- name: "Build"
|
||||||
run: >
|
run: >
|
||||||
@@ -160,7 +161,8 @@ jobs:
|
|||||||
-DFTXUI_BUILD_EXAMPLES=OFF
|
-DFTXUI_BUILD_EXAMPLES=OFF
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
-DFTXUI_BUILD_TESTS=OFF
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||||
-DFTXUI_ENABLE_INSTALL=ON;
|
-DFTXUI_ENABLE_INSTALL=ON
|
||||||
|
-DFTXUI_DEV_WARNINGS=ON ;
|
||||||
cmake --build . --target package;
|
cmake --build . --target package;
|
||||||
- uses: shogo82148/actions-upload-release-asset@v1
|
- uses: shogo82148/actions-upload-release-asset@v1
|
||||||
with:
|
with:
|
||||||
@@ -196,7 +198,8 @@ jobs:
|
|||||||
-DFTXUI_BUILD_EXAMPLES=ON
|
-DFTXUI_BUILD_EXAMPLES=ON
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
-DFTXUI_BUILD_TESTS=OFF
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||||
-DFTXUI_ENABLE_INSTALL=OFF;
|
-DFTXUI_ENABLE_INSTALL=OFF
|
||||||
|
-DFTXUI_DEV_WARNINGS=ON ;
|
||||||
cmake --build . --target doc;
|
cmake --build . --target doc;
|
||||||
cmake --build . ;
|
cmake --build . ;
|
||||||
rsync -amv
|
rsync -amv
|
||||||
|
50
CHANGELOG.md
50
CHANGELOG.md
@@ -1,8 +1,54 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
current (development)
|
4.2
|
||||||
---------------------
|
---
|
||||||
|
|
||||||
|
### Component
|
||||||
|
- Bugfix: Support Fn keys for every terminal specifications.
|
||||||
|
|
||||||
|
### Dom
|
||||||
|
- Feature: Add `hyperlink` decorator. For instance:
|
||||||
|
```cpp
|
||||||
|
auto link = text("Click here") | hyperlink("https://github.com/FTXUI")
|
||||||
|
```
|
||||||
|
See the [OSC 8 page](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
|
||||||
|
FTXUI support proposed by @aaleino in [#662](https://github.com/ArthurSonzogni/FTXUI/issues/662).
|
||||||
|
|
||||||
|
### Screen
|
||||||
|
- Fix huge performance bug affecting some compilers about unicode bisection.
|
||||||
|
|
||||||
|
### Build
|
||||||
|
- Check version compatibility when using cmake find_package()
|
||||||
|
- Fix missing includes for some gcc versions.
|
||||||
|
|
||||||
|
4.1.1
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Component
|
||||||
|
- Revert Feature: Support `ResizableSplit` with customizable separator.
|
||||||
|
|
||||||
|
### Build
|
||||||
|
- Check version compatibility when using cmake find_package()
|
||||||
|
|
||||||
|
4.1.0 (abandonned)
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Component
|
||||||
|
- Feature: Support `ResizableSplit` with customizable separator.
|
||||||
|
- Fix: Support arrow keys in application mode
|
||||||
|
- Fix: Remove useless new line when using an alternative screen.
|
||||||
|
|
||||||
|
### Dom
|
||||||
|
- Feature: Add the dashed style for border and separator.
|
||||||
|
- Feature: Add colored borders.
|
||||||
|
- Feature: Add `LinearGradient`!
|
||||||
|
- Improvement: Color::Interpolate() uses gamma correction.
|
||||||
|
- Fix: Check the `graph` area is positive.
|
||||||
|
|
||||||
|
### Build/Install
|
||||||
|
- Use globally set CMAKE_CXX_STANDARD if it is set.
|
||||||
|
- Expose the pkg-config file.
|
||||||
|
|
||||||
4.0.0
|
4.0.0
|
||||||
-----
|
-----
|
||||||
|
@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.11)
|
|||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 4.0.0
|
VERSION 4.1.1
|
||||||
|
DESCRIPTION "C++ Functional Terminal User Interface."
|
||||||
)
|
)
|
||||||
|
|
||||||
option(FTXUI_BUILD_DOCS "Set to ON to build docs" ON)
|
option(FTXUI_BUILD_DOCS "Set to ON to build docs" ON)
|
||||||
@@ -12,6 +13,7 @@ option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
|
|||||||
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
||||||
option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF)
|
option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF)
|
||||||
option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF)
|
option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF)
|
||||||
|
option(FTXUI_DEV_WARNINGS "Enable more compiler warnings and warnings as errors" OFF)
|
||||||
|
|
||||||
set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \
|
set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \
|
||||||
terminal used will be one of Microsoft and use a set of reasonnable fallback \
|
terminal used will be one of Microsoft and use a set of reasonnable fallback \
|
||||||
@@ -50,6 +52,7 @@ add_library(dom
|
|||||||
src/ftxui/dom/automerge.cpp
|
src/ftxui/dom/automerge.cpp
|
||||||
src/ftxui/dom/blink.cpp
|
src/ftxui/dom/blink.cpp
|
||||||
src/ftxui/dom/bold.cpp
|
src/ftxui/dom/bold.cpp
|
||||||
|
src/ftxui/dom/hyperlink.cpp
|
||||||
src/ftxui/dom/border.cpp
|
src/ftxui/dom/border.cpp
|
||||||
src/ftxui/dom/box_helper.cpp
|
src/ftxui/dom/box_helper.cpp
|
||||||
src/ftxui/dom/box_helper.hpp
|
src/ftxui/dom/box_helper.hpp
|
||||||
@@ -71,6 +74,7 @@ add_library(dom
|
|||||||
src/ftxui/dom/gridbox.cpp
|
src/ftxui/dom/gridbox.cpp
|
||||||
src/ftxui/dom/hbox.cpp
|
src/ftxui/dom/hbox.cpp
|
||||||
src/ftxui/dom/inverted.cpp
|
src/ftxui/dom/inverted.cpp
|
||||||
|
src/ftxui/dom/linear_gradient.cpp
|
||||||
src/ftxui/dom/node.cpp
|
src/ftxui/dom/node.cpp
|
||||||
src/ftxui/dom/node_decorator.cpp
|
src/ftxui/dom/node_decorator.cpp
|
||||||
src/ftxui/dom/paragraph.cpp
|
src/ftxui/dom/paragraph.cpp
|
||||||
|
@@ -127,6 +127,7 @@ An element can be decorated using the functions:
|
|||||||
- `strikethrough`
|
- `strikethrough`
|
||||||
- `color`
|
- `color`
|
||||||
- `bgcolor`
|
- `bgcolor`
|
||||||
|
- `hyperlink`
|
||||||
|
|
||||||
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2style_gallery_8cpp-example.html)
|
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2style_gallery_8cpp-example.html)
|
||||||
|
|
||||||
|
@@ -2,3 +2,5 @@
|
|||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
find_dependency(Threads)
|
find_dependency(Threads)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ftxui-targets.cmake")
|
@@ -4,5 +4,5 @@ add_library(ftxui::component ALIAS component)
|
|||||||
export(
|
export(
|
||||||
TARGETS screen dom component
|
TARGETS screen dom component
|
||||||
NAMESPACE ftxui::
|
NAMESPACE ftxui::
|
||||||
FILE ${PROJECT_BINARY_DIR}/ftxui-targets.cmake
|
FILE "${PROJECT_BINARY_DIR}/ftxui-targets.cmake"
|
||||||
)
|
)
|
||||||
|
@@ -27,7 +27,7 @@ set(BUILD_GMOCK OFF CACHE INTERNAL "")
|
|||||||
set(INSTALL_GTEST OFF CACHE INTERNAL "")
|
set(INSTALL_GTEST OFF CACHE INTERNAL "")
|
||||||
set(gtest_force_shared_crt ON CACHE INTERNAL "")
|
set(gtest_force_shared_crt ON CACHE INTERNAL "")
|
||||||
add_subdirectory(
|
add_subdirectory(
|
||||||
${googletest_SOURCE_DIR}
|
"${googletest_SOURCE_DIR}"
|
||||||
${googletest_BINARY_DIR}
|
"${googletest_BINARY_DIR}"
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
@@ -4,23 +4,17 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_C_COMPILER clang)
|
set(CMAKE_C_COMPILER clang)
|
||||||
set(CMAKE_CXX_COMPILER clang++)
|
set(CMAKE_CXX_COMPILER clang++)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
function(fuzz name)
|
function(fuzz name)
|
||||||
add_executable(${name}
|
add_executable(${name}
|
||||||
src/ftxui/component/${name}.cpp
|
src/ftxui/component/${name}.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(${name}
|
target_include_directories(${name} PRIVATE src)
|
||||||
PRIVATE src
|
target_link_libraries(${name} PRIVATE component)
|
||||||
)
|
target_compile_options(${name} PRIVATE -fsanitize=fuzzer,address)
|
||||||
target_link_libraries(${name}
|
target_link_libraries(${name} PRIVATE -fsanitize=fuzzer,address)
|
||||||
PRIVATE component
|
target_compile_features(${name} PRIVATE cxx_std_17)
|
||||||
)
|
|
||||||
target_compile_options(${name}
|
|
||||||
PRIVATE -fsanitize=fuzzer,address
|
|
||||||
)
|
|
||||||
target_link_libraries(${name}
|
|
||||||
PRIVATE -fsanitize=fuzzer,address
|
|
||||||
)
|
|
||||||
endfunction(fuzz)
|
endfunction(fuzz)
|
||||||
|
|
||||||
fuzz(terminal_input_parser_test_fuzzer)
|
fuzz(terminal_input_parser_test_fuzzer)
|
||||||
|
@@ -3,31 +3,58 @@ if(NOT FTXUI_ENABLE_INSTALL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(TARGETS screen dom component
|
|
||||||
EXPORT ftxui-export
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY include/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
configure_package_config_file(ftxui-config.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
|
||||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
|
||||||
)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
ftxui-config-version.cmake
|
|
||||||
VERSION ${PACKAGE_VERSION}
|
|
||||||
COMPATIBILITY AnyNewerVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
# ------------------------------------------------------------------------------
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
# Install the library and its public headers into the standard subdirectories
|
||||||
)
|
# ------------------------------------------------------------------------------
|
||||||
install(EXPORT ftxui-export
|
install(
|
||||||
FILE ftxui-config-version.cmake
|
TARGETS screen dom component
|
||||||
|
EXPORT ftxui-targets
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY include/ftxui
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Install the exported cmake targets for use in other CMake projects.
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
install(
|
||||||
|
EXPORT ftxui-targets
|
||||||
NAMESPACE ftxui::
|
NAMESPACE ftxui::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ftxui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Create and install the ftuxi-config.cmake and ftuxi-config-version.cmake files
|
||||||
|
# needed to support users of find_package()
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
configure_package_config_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ftxui-config.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake"
|
||||||
|
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/ftxui/cmake"
|
||||||
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake"
|
||||||
|
VERSION ${PACKAGE_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ftxui"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Create and install pkg-config file for easy use of library in build systems
|
||||||
|
# other than CMake:
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
configure_file(ftxui.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc @ONLY)
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||||
|
)
|
||||||
|
@@ -43,11 +43,7 @@ function(ftxui_set_options library)
|
|||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
)
|
)
|
||||||
|
|
||||||
# C++17 is used. We require fold expression at least.
|
target_compile_features(${library} PUBLIC cxx_std_17)
|
||||||
set_target_properties(${library} PROPERTIES
|
|
||||||
CXX_STANDARD 17
|
|
||||||
CXX_EXTENSIONS OFF
|
|
||||||
)
|
|
||||||
|
|
||||||
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
||||||
# to the library and the library users.
|
# to the library and the library users.
|
||||||
@@ -58,8 +54,10 @@ function(ftxui_set_options library)
|
|||||||
# Add as many warning as possible:
|
# Add as many warning as possible:
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(${library} PRIVATE "/W3")
|
if(FTXUI_DEV_WARNINGS)
|
||||||
target_compile_options(${library} PRIVATE "/WX")
|
target_compile_options(${library} PRIVATE "/W3")
|
||||||
|
target_compile_options(${library} PRIVATE "/WX")
|
||||||
|
endif()
|
||||||
target_compile_options(${library} PRIVATE "/wd4244")
|
target_compile_options(${library} PRIVATE "/wd4244")
|
||||||
target_compile_options(${library} PRIVATE "/wd4267")
|
target_compile_options(${library} PRIVATE "/wd4267")
|
||||||
target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS")
|
target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS")
|
||||||
@@ -67,13 +65,21 @@ function(ftxui_set_options library)
|
|||||||
# Force Win32 to UNICODE
|
# Force Win32 to UNICODE
|
||||||
target_compile_definitions(${library} PRIVATE UNICODE _UNICODE)
|
target_compile_definitions(${library} PRIVATE UNICODE _UNICODE)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${library} PRIVATE "-Wall")
|
if(FTXUI_DEV_WARNINGS)
|
||||||
target_compile_options(${library} PRIVATE "-Wextra")
|
target_compile_options(${library} PRIVATE "-Wall")
|
||||||
target_compile_options(${library} PRIVATE "-pedantic")
|
target_compile_options(${library} PRIVATE "-Werror")
|
||||||
target_compile_options(${library} PRIVATE "-Werror")
|
target_compile_options(${library} PRIVATE "-Wextra")
|
||||||
target_compile_options(${library} PRIVATE "-Wmissing-declarations")
|
|
||||||
target_compile_options(${library} PRIVATE "-Wdeprecated")
|
target_compile_options(${library} PRIVATE "-Wcast-align")
|
||||||
target_compile_options(${library} PRIVATE "-Wshadow")
|
target_compile_options(${library} PRIVATE "-Wdeprecated")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wmissing-declarations")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wnon-virtual-dtor")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wnull-dereference")
|
||||||
|
target_compile_options(${library} PRIVATE "-Woverloaded-virtual")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wpedantic")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wshadow")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wunused")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
if (FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
if (NOT FTXUI_BUILD_TESTS OR
|
if (NOT FTXUI_BUILD_TESTS)
|
||||||
NOT ${CMAKE_VERSION} VERSION_GREATER "3.11.4")
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -37,6 +36,8 @@ add_executable(ftxui-tests
|
|||||||
src/ftxui/dom/gauge_test.cpp
|
src/ftxui/dom/gauge_test.cpp
|
||||||
src/ftxui/dom/gridbox_test.cpp
|
src/ftxui/dom/gridbox_test.cpp
|
||||||
src/ftxui/dom/hbox_test.cpp
|
src/ftxui/dom/hbox_test.cpp
|
||||||
|
src/ftxui/dom/hyperlink_test.cpp
|
||||||
|
src/ftxui/dom/linear_gradient_test.cpp
|
||||||
src/ftxui/dom/scroll_indicator_test.cpp
|
src/ftxui/dom/scroll_indicator_test.cpp
|
||||||
src/ftxui/dom/separator_test.cpp
|
src/ftxui/dom/separator_test.cpp
|
||||||
src/ftxui/dom/spinner_test.cpp
|
src/ftxui/dom/spinner_test.cpp
|
||||||
@@ -56,8 +57,12 @@ target_link_libraries(ftxui-tests
|
|||||||
target_include_directories(ftxui-tests
|
target_include_directories(ftxui-tests
|
||||||
PRIVATE src
|
PRIVATE src
|
||||||
)
|
)
|
||||||
ftxui_set_options(ftxui-tests)
|
target_compile_features(ftxui-tests PRIVATE cxx_std_20)
|
||||||
target_compile_features(ftxui-tests PUBLIC cxx_std_20)
|
|
||||||
|
if (FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||||
|
target_compile_definitions(ftxui-tests
|
||||||
|
PRIVATE "FTXUI_MICROSOFT_TERMINAL_FALLBACK")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
gtest_discover_tests(ftxui-tests
|
gtest_discover_tests(ftxui-tests
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
find_program(iwyu_path NAMES include-what-you-use iwyu)
|
find_program(iwyu_path NAMES include-what-you-use iwyu)
|
||||||
if(iwyu_path)
|
if(iwyu_path)
|
||||||
set_property(TARGET ${lib}
|
set_property(TARGET ${lib}
|
||||||
PROPERTY ${iwyu_path} -Xiwyu
|
PROPERTY "${iwyu_path}" -Xiwyu
|
||||||
--mapping_file ${CMAKE_CURRENT_SOURCE_DIR}/iwyu.imp
|
--mapping_file "${CMAKE_CURRENT_SOURCE_DIR}/iwyu.imp"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -444,6 +444,36 @@ ftxui::Color::HSV(uint8_t hue, uint8_t saturation, uint8_t value);
|
|||||||
<script id="asciicast-xwzzghmqcqzIuyLwCpQFEqbEu" src="https://asciinema.org/a/xwzzghmqcqzIuyLwCpQFEqbEu.js" async></script>
|
<script id="asciicast-xwzzghmqcqzIuyLwCpQFEqbEu" src="https://asciinema.org/a/xwzzghmqcqzIuyLwCpQFEqbEu.js" async></script>
|
||||||
@endhtmlonly
|
@endhtmlonly
|
||||||
|
|
||||||
|
## LinearGradient #{#dom-linear-gradient}
|
||||||
|
|
||||||
|
FTXUI supports linear gradient. Either on the foreground or the background.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
Decorator color(const LinearGradient&);
|
||||||
|
Decorator bgcolor(const LinearGradient&);
|
||||||
|
```
|
||||||
|
|
||||||
|
A `ftxui::LinearGradient` is defined by an angle in degree, and a list of color
|
||||||
|
stops.
|
||||||
|
```cpp
|
||||||
|
auto gradient = LinearGradient()
|
||||||
|
.Angle(45)
|
||||||
|
.AddStop(0.0, Color::Red)
|
||||||
|
.AddStop(0.5, Color::Green)
|
||||||
|
.AddStop(1.0, Color::Blue);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use simplified constructors:
|
||||||
|
```cpp
|
||||||
|
LinearGradient(Color::Red, Color::Blue);
|
||||||
|
```
|
||||||
|
```cpp
|
||||||
|
LinearGradient(45, Color::Red, Color::Blue);
|
||||||
|
```
|
||||||
|
|
||||||
|
See [demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/linear_gradient_gallery).
|
||||||
|
|
||||||
|
|
||||||
## Style {#dom-style}
|
## Style {#dom-style}
|
||||||
In addition to colored text and colored backgrounds. Many terminals support text
|
In addition to colored text and colored backgrounds. Many terminals support text
|
||||||
effects such as: `bold`, `dim`, `underlined`, `inverted`, `blink`.
|
effects such as: `bold`, `dim`, `underlined`, `inverted`, `blink`.
|
||||||
@@ -458,6 +488,8 @@ Element strikethrough(Element);
|
|||||||
Element blink(Element);
|
Element blink(Element);
|
||||||
Decorator color(Color);
|
Decorator color(Color);
|
||||||
Decorator bgcolor(Color);
|
Decorator bgcolor(Color);
|
||||||
|
Decorator colorgrad(LinearGradient);
|
||||||
|
Decorator bgcolorgrad(LinearGradient);
|
||||||
```
|
```
|
||||||
|
|
||||||
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2style_gallery_8cpp-example.html)
|
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2style_gallery_8cpp-example.html)
|
||||||
@@ -562,8 +594,7 @@ Simple [example](https://github.com/ArthurSonzogni/FTXUI/blob/master/examples/do
|
|||||||
|
|
||||||
Complex [example](https://github.com/ArthurSonzogni/FTXUI/blob/master/examples/component/canvas_animated.cpp):
|
Complex [example](https://github.com/ArthurSonzogni/FTXUI/blob/master/examples/component/canvas_animated.cpp):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# component {#module-component}
|
# component {#module-component}
|
||||||
|
|
||||||
The `ftxui::component` module defines the logic that produces interactive
|
The `ftxui::component` module defines the logic that produces interactive
|
||||||
|
@@ -8,9 +8,7 @@ function(example name)
|
|||||||
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
|
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
|
||||||
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
|
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
|
||||||
set_target_properties(ftxui_example_${name} PROPERTIES
|
target_compile_features(ftxui_example_${name} PRIVATE cxx_std_17)
|
||||||
CXX_STANDARD 20
|
|
||||||
)
|
|
||||||
endfunction(example)
|
endfunction(example)
|
||||||
|
|
||||||
add_subdirectory(component)
|
add_subdirectory(component)
|
||||||
|
@@ -17,6 +17,7 @@ example(focus_cursor)
|
|||||||
example(gallery)
|
example(gallery)
|
||||||
example(homescreen)
|
example(homescreen)
|
||||||
example(input)
|
example(input)
|
||||||
|
example(linear_gradient_gallery)
|
||||||
example(maybe)
|
example(maybe)
|
||||||
example(menu)
|
example(menu)
|
||||||
example(menu2)
|
example(menu2)
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int value = 50;
|
int value = 50;
|
||||||
|
|
||||||
// The tree of components. This defines how to navigate using the keyboard.
|
// The tree of components. This defines how to navigate using the keyboard.
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int value = 50;
|
int value = 50;
|
||||||
|
|
||||||
// The tree of components. This defines how to navigate using the keyboard.
|
// The tree of components. This defines how to navigate using the keyboard.
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
auto on_click = [&] { counter++; };
|
auto on_click = [&] { counter++; };
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
auto action = [&] { value++; };
|
auto action = [&] { value++; };
|
||||||
auto action_renderer =
|
auto action_renderer =
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#include "ftxui/dom/canvas.hpp" // for Canvas
|
#include "ftxui/dom/canvas.hpp" // for Canvas
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int mouse_x = 0;
|
int mouse_x = 0;
|
||||||
|
@@ -8,12 +8,12 @@
|
|||||||
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
||||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
|
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
Component input_list = Container::Vertical({});
|
Component input_list = Container::Vertical({});
|
||||||
std::vector<std::string> items(100, "");
|
std::vector<std::string> items(100, "");
|
||||||
for (int i = 0; i < items.size(); ++i) {
|
for (size_t i = 0; i < items.size(); ++i) {
|
||||||
input_list->Add(Input(&(items[i]), "placeholder " + std::to_string(i)));
|
input_list->Add(Input(&(items[i]), "placeholder " + std::to_string(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::array<bool, 30> states;
|
std::array<bool, 30> states;
|
||||||
|
|
||||||
auto container = Container::Vertical({});
|
auto container = Container::Vertical({});
|
||||||
|
@@ -26,7 +26,7 @@ Component Empty() {
|
|||||||
return std::make_shared<ComponentBase>();
|
return std::make_shared<ComponentBase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto component =
|
auto component =
|
||||||
Collapsible("Collapsible 1",
|
Collapsible("Collapsible 1",
|
||||||
Inner({
|
Inner({
|
||||||
|
@@ -11,7 +11,7 @@ using namespace ftxui;
|
|||||||
|
|
||||||
// An example of how to compose multiple components into one and maintain their
|
// An example of how to compose multiple components into one and maintain their
|
||||||
// interactiveness.
|
// interactiveness.
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto left_count = 0;
|
auto left_count = 0;
|
||||||
auto right_count = 0;
|
auto right_count = 0;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "ftxui/component/loop.hpp" // for Loop
|
#include "ftxui/component/loop.hpp" // for Loop
|
||||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ScreenInteractive::FitComponent();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/component/component.hpp" // for Dropdown, Horizontal, Vertical
|
#include "ftxui/component/component.hpp" // for Dropdown, Horizontal, Vertical
|
||||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
std::vector<std::string> entries = {
|
std::vector<std::string> entries = {
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
int direction_index = 0;
|
int direction_index = 0;
|
||||||
|
@@ -31,7 +31,7 @@ Element make_grid() {
|
|||||||
return gridbox(rows);
|
return gridbox(rows);
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
float focus_x = 0.5f;
|
float focus_x = 0.5f;
|
||||||
float focus_y = 0.5f;
|
float focus_y = 0.5f;
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ Component Instance(std::string label, Decorator focusCursor) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
screen.Loop(Container::Vertical({
|
screen.Loop(Container::Vertical({
|
||||||
Instance("focus", focus),
|
Instance("focus", focus),
|
||||||
|
@@ -23,7 +23,7 @@ Component Wrap(std::string name, Component component) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::FitComponent();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
|
|
||||||
// -- Menu
|
// -- Menu
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "ftxui/dom/elements.hpp" // for text, hbox, separator, Element, operator|, vbox, border
|
#include "ftxui/dom/elements.hpp" // for text, hbox, separator, Element, operator|, vbox, border
|
||||||
#include "ftxui/util/ref.hpp" // for Ref
|
#include "ftxui/util/ref.hpp" // for Ref
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
std::string first_name;
|
std::string first_name;
|
||||||
|
56
examples/component/linear_gradient_gallery.cpp
Normal file
56
examples/component/linear_gradient_gallery.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#include <ftxui/component/component_base.hpp> // for ComponentBase, Component
|
||||||
|
#include <ftxui/dom/elements.hpp> // for operator|, Element, flex, bgcolor, text, vbox, center
|
||||||
|
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
|
||||||
|
#include <ftxui/screen/color.hpp> // for Color, Color::Blue, Color::Red
|
||||||
|
#include <memory> // for __shared_ptr_access, shared_ptr
|
||||||
|
#include <string> // for allocator, operator+, char_traits, string, to_string
|
||||||
|
|
||||||
|
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||||
|
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
|
||||||
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
using namespace ftxui;
|
||||||
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
|
int angle = 180.f;
|
||||||
|
float start = 0.f;
|
||||||
|
float end = 1.f;
|
||||||
|
|
||||||
|
std::string slider_angle_text;
|
||||||
|
std::string slider_start_text;
|
||||||
|
std::string slider_end_text;
|
||||||
|
|
||||||
|
auto slider_angle = Slider(&slider_angle_text, &angle, 0, 360);
|
||||||
|
auto slider_start = Slider(&slider_start_text, &start, 0.f, 1.f);
|
||||||
|
auto slider_end = Slider(&slider_end_text, &end, 0.f, 1.f);
|
||||||
|
|
||||||
|
auto layout = Container::Vertical({
|
||||||
|
slider_angle,
|
||||||
|
slider_start,
|
||||||
|
slider_end,
|
||||||
|
});
|
||||||
|
|
||||||
|
auto renderer = Renderer(layout, [&] {
|
||||||
|
slider_angle_text = "angle = " + std::to_string(angle) + "°";
|
||||||
|
slider_start_text = "start = " + std::to_string(int(start * 100)) + "%";
|
||||||
|
slider_end_text = "end = " + std::to_string(int(end * 100)) + "%";
|
||||||
|
|
||||||
|
auto background = text("Gradient") | center |
|
||||||
|
bgcolor(LinearGradient()
|
||||||
|
.Angle(angle)
|
||||||
|
.Stop(Color::Blue, start)
|
||||||
|
.Stop(Color::Red, end));
|
||||||
|
return vbox({
|
||||||
|
background | flex,
|
||||||
|
layout->Render(),
|
||||||
|
}) |
|
||||||
|
flex;
|
||||||
|
});
|
||||||
|
|
||||||
|
screen.Loop(renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copyright 2023 Arthur Sonzogni. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be found in
|
||||||
|
// the LICENSE file.
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> entries = {
|
std::vector<std::string> entries = {
|
||||||
"entry 1",
|
"entry 1",
|
||||||
"entry 2",
|
"entry 2",
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/component/component_options.hpp" // for MenuOption
|
#include "ftxui/component/component_options.hpp" // for MenuOption
|
||||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
||||||
#include "ftxui/dom/elements.hpp" // for text, separator, bold, hcenter, vbox, hbox, gauge, Element, operator|, border
|
#include "ftxui/dom/elements.hpp" // for text, separator, bold, hcenter, vbox, hbox, gauge, Element, operator|, border
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ MenuEntryOption Colored(ftxui::Color c) {
|
|||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
|
@@ -24,7 +24,7 @@ MenuEntryOption Colored(ftxui::Color c) {
|
|||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> entries;
|
std::vector<std::string> entries;
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ Component Window(std::string title, Component component) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int menu_selected[] = {0, 0, 0};
|
int menu_selected[] = {0, 0, 0};
|
||||||
std::vector<std::vector<std::string>> menu_entries = {
|
std::vector<std::vector<std::string>> menu_entries = {
|
||||||
{
|
{
|
||||||
|
@@ -30,7 +30,7 @@ Component HMenu3(std::vector<std::string>* entries, int* selected);
|
|||||||
Component HMenu4(std::vector<std::string>* entries, int* selected);
|
Component HMenu4(std::vector<std::string>* entries, int* selected);
|
||||||
Component HMenu5(std::vector<std::string>* entries, int* selected);
|
Component HMenu5(std::vector<std::string>* entries, int* selected);
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
std::vector<std::string> entries{
|
std::vector<std::string> entries{
|
||||||
|
@@ -27,7 +27,7 @@ Component Text(const std::string& t) {
|
|||||||
return Renderer([t] { return text(t) | borderEmpty; });
|
return Renderer([t] { return text(t) | borderEmpty; });
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
std::vector<std::string> tab_values{
|
std::vector<std::string> tab_values{
|
||||||
"Tab 1", "Tab 2", "Tab 3", "A very very long tab", "탭",
|
"Tab 1", "Tab 2", "Tab 3", "A very very long tab", "탭",
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, filler, text, hbox, separator, center, vbox, bold, border, clear_under, dbox, size, GREATER_THAN, HEIGHT
|
#include "ftxui/dom/elements.hpp" // for operator|, Element, filler, text, hbox, separator, center, vbox, bold, border, clear_under, dbox, size, GREATER_THAN, HEIGHT
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ void Nested(std::string path) {
|
|||||||
screen.Loop(renderer);
|
screen.Loop(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::FitComponent();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
auto button_quit = Button("Quit", screen.ExitLoopClosure());
|
auto button_quit = Button("Quit", screen.ExitLoopClosure());
|
||||||
auto button_nested = Button("Nested", [] { Nested(""); });
|
auto button_nested = Button("Nested", [] { Nested(""); });
|
||||||
|
@@ -134,7 +134,7 @@ std::string Stringify(Event event) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
|
|
||||||
std::vector<Event> keys;
|
std::vector<Event> keys;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> radiobox_list = {
|
std::vector<std::string> radiobox_list = {
|
||||||
"Use gcc",
|
"Use gcc",
|
||||||
"Use clang",
|
"Use clang",
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> entries;
|
std::vector<std::string> entries;
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, text, bold, border, center, color
|
#include "ftxui/dom/elements.hpp" // for operator|, Element, text, bold, border, center, color
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ScreenInteractive::FitComponent();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
auto middle = Renderer([] { return text("middle") | center; });
|
auto middle = Renderer([] { return text("middle") | center; });
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
int value = 50;
|
int value = 50;
|
||||||
auto slider = Slider("Value:", &value, 0, 100, 1);
|
auto slider = Slider("Value:", &value, 0, 100, 1);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
std::array<int, 30> values;
|
std::array<int, 30> values;
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (int i = 0; i < values.size(); ++i) {
|
||||||
@@ -20,10 +20,10 @@ int main(int argc, const char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto layout_horizontal = Container::Horizontal({});
|
auto layout_horizontal = Container::Horizontal({});
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (auto& value : values) {
|
||||||
// In C++17:
|
// In C++17:
|
||||||
SliderOption<int> option;
|
SliderOption<int> option;
|
||||||
option.value = &values[i];
|
option.value = &value;
|
||||||
option.max = 100;
|
option.max = 100;
|
||||||
option.increment = 5;
|
option.increment = 5;
|
||||||
option.direction = GaugeDirection::Up;
|
option.direction = GaugeDirection::Up;
|
||||||
|
@@ -23,7 +23,7 @@ Element ColorString(int red, int green, int blue) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
int red = 128;
|
int red = 128;
|
||||||
int green = 25;
|
int green = 25;
|
||||||
int blue = 100;
|
int blue = 100;
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> tab_values{
|
std::vector<std::string> tab_values{
|
||||||
"tab_1",
|
"tab_1",
|
||||||
"tab_2",
|
"tab_2",
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> tab_values{
|
std::vector<std::string> tab_values{
|
||||||
"tab_1",
|
"tab_1",
|
||||||
"tab_2",
|
"tab_2",
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::string> toggle_1_entries = {
|
std::vector<std::string> toggle_1_entries = {
|
||||||
"On",
|
"On",
|
||||||
"Off",
|
"Off",
|
||||||
|
@@ -1,19 +1,21 @@
|
|||||||
set(DIRECTORY_LIB dom)
|
set(DIRECTORY_LIB dom)
|
||||||
|
|
||||||
example(border)
|
example(border)
|
||||||
|
example(border_colored)
|
||||||
example(border_style)
|
example(border_style)
|
||||||
|
example(canvas)
|
||||||
example(color_gallery)
|
example(color_gallery)
|
||||||
example(color_info_palette256)
|
example(color_info_palette256)
|
||||||
example(color_truecolor_HSV)
|
example(color_truecolor_HSV)
|
||||||
example(color_truecolor_RGB)
|
example(color_truecolor_RGB)
|
||||||
example(dbox)
|
example(dbox)
|
||||||
example(canvas)
|
|
||||||
example(gauge)
|
example(gauge)
|
||||||
example(gauge_direction)
|
example(gauge_direction)
|
||||||
example(graph)
|
example(graph)
|
||||||
example(gridbox)
|
example(gridbox)
|
||||||
example(hflow)
|
example(hflow)
|
||||||
example(html_like)
|
example(html_like)
|
||||||
|
example(linear_gradient)
|
||||||
example(package_manager)
|
example(package_manager)
|
||||||
example(paragraph)
|
example(paragraph)
|
||||||
example(separator)
|
example(separator)
|
||||||
@@ -25,6 +27,7 @@ example(style_bold)
|
|||||||
example(style_color)
|
example(style_color)
|
||||||
example(style_dim)
|
example(style_dim)
|
||||||
example(style_gallery)
|
example(style_gallery)
|
||||||
|
example(style_hyperlink)
|
||||||
example(style_inverted)
|
example(style_inverted)
|
||||||
example(style_strikethrough)
|
example(style_strikethrough)
|
||||||
example(style_underlined)
|
example(style_underlined)
|
||||||
|
40
examples/dom/border_colored.cpp
Normal file
40
examples/dom/border_colored.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, Fit, borderDouble, borderHeavy, borderLight, borderRounded, vbox
|
||||||
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
|
#include <iostream> // for endl, cout, ostream
|
||||||
|
#include <memory> // for allocator
|
||||||
|
|
||||||
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
using namespace ftxui;
|
||||||
|
|
||||||
|
auto make_boxed = [] {
|
||||||
|
return vbox({
|
||||||
|
text("borderLight") | borderStyled(LIGHT, Color::Red),
|
||||||
|
text("borderDashed") | borderStyled(DASHED, Color::Green),
|
||||||
|
text("borderHeavy") | borderStyled(HEAVY, Color::Blue),
|
||||||
|
text("borderDouble") | borderStyled(DOUBLE, Color::Yellow),
|
||||||
|
text("borderRounded") | borderStyled(ROUNDED, Color::Cyan),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto document = hbox({
|
||||||
|
make_boxed(),
|
||||||
|
separator() | color(Color::Red),
|
||||||
|
make_boxed(),
|
||||||
|
separator() | color(Color::Red),
|
||||||
|
make_boxed(),
|
||||||
|
}) |
|
||||||
|
borderStyled(ROUNDED, Color::Red);
|
||||||
|
|
||||||
|
auto screen =
|
||||||
|
Screen::Create(Dimension::Fit(document), Dimension::Fit(document));
|
||||||
|
Render(screen, document);
|
||||||
|
screen.Print();
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
@@ -6,11 +6,12 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
auto document = vbox({
|
auto document = vbox({
|
||||||
text("borderLight") | borderLight,
|
text("borderLight") | borderLight,
|
||||||
|
text("borderDashed") | borderDashed,
|
||||||
text("borderHeavy") | borderHeavy,
|
text("borderHeavy") | borderHeavy,
|
||||||
text("borderDouble") | borderDouble,
|
text("borderDouble") | borderDouble,
|
||||||
text("borderRounded") | borderRounded,
|
text("borderRounded") | borderRounded,
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
auto c = Canvas(100, 100);
|
auto c = Canvas(100, 100);
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
std::vector<std::vector<ColorInfo>> info_columns = ColorInfoSorted2D();
|
std::vector<std::vector<ColorInfo>> info_columns = ColorInfoSorted2D();
|
||||||
|
|
||||||
// Draw every columns
|
// Draw every columns
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int saturation = 255;
|
int saturation = 255;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int saturation = 255;
|
int saturation = 255;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = dbox({
|
auto document = dbox({
|
||||||
vbox({
|
vbox({
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto cell = [](const char* t) { return text(t) | border; };
|
auto cell = [](const char* t) { return text(t) | border; };
|
||||||
auto document = //
|
auto document = //
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto make_box = [](int dimx, int dimy) {
|
auto make_box = [](int dimx, int dimy) {
|
||||||
std::string title = std::to_string(dimx) + "x" + std::to_string(dimy);
|
std::string title = std::to_string(dimx) + "x" + std::to_string(dimy);
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/box.hpp" // for ftxui
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
26
examples/dom/linear_gradient.cpp
Normal file
26
examples/dom/linear_gradient.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include <ftxui/dom/elements.hpp> // for bgcolor, operator|, operator|=, text, center, Element
|
||||||
|
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient
|
||||||
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
|
#include <memory> // for allocator, shared_ptr
|
||||||
|
|
||||||
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
|
#include "ftxui/screen/color.hpp" // for Color, Color::DeepPink1, Color::DeepSkyBlue1, Color::Yellow, ftxui
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
using namespace ftxui;
|
||||||
|
auto document = text("gradient") | center;
|
||||||
|
|
||||||
|
document |= bgcolor(LinearGradient()
|
||||||
|
.Angle(45)
|
||||||
|
.Stop(Color::DeepPink1)
|
||||||
|
.Stop(Color::DeepSkyBlue1));
|
||||||
|
auto screen = Screen::Create(Dimension::Full(), Dimension::Full());
|
||||||
|
Render(screen, document);
|
||||||
|
screen.Print();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copyright 2023 Arthur Sonzogni. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be found in
|
||||||
|
// the LICENSE file.
|
@@ -12,7 +12,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
struct Task {
|
struct Task {
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/box.hpp" // for ftxui
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
std::string p =
|
std::string p =
|
||||||
R"(In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes' theorem, a person's age can be used to more accurately assess the probability that they have cancer, compared to the assessment of the probability of cancer made without knowledge of the person's age. One of the many applications of Bayes' theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes' theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of related evidence. Bayesian inference is fundamental to Bayesian statistics.)";
|
R"(In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes' theorem, a person's age can be used to more accurately assess the probability that they have cancer, compared to the assessment of the probability of cancer made without knowledge of the person's age. One of the many applications of Bayes' theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes' theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of related evidence. Bayesian inference is fundamental to Bayesian statistics.)";
|
||||||
|
|
||||||
std::string reset_position;
|
std::string reset_position;
|
||||||
for (int i = 0;; ++i) {
|
while (true) {
|
||||||
auto document = vbox({
|
auto document = vbox({
|
||||||
hflow(paragraph(p)),
|
hflow(paragraph(p)),
|
||||||
separator(),
|
separator(),
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = hbox({
|
auto document = hbox({
|
||||||
text("left-column"),
|
text("left-column"),
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/box.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
auto document = vbox({
|
auto document = vbox({
|
||||||
@@ -16,6 +16,12 @@ int main(int argc, const char* argv[]) {
|
|||||||
hbox(text("left"), separatorLight(), text("right")),
|
hbox(text("left"), separatorLight(), text("right")),
|
||||||
}) | borderLight,
|
}) | borderLight,
|
||||||
|
|
||||||
|
vbox({
|
||||||
|
text("separatorDashed"),
|
||||||
|
separatorDashed(),
|
||||||
|
hbox(text("left"), separatorDashed(), text("right")),
|
||||||
|
}) | borderDashed,
|
||||||
|
|
||||||
vbox({
|
vbox({
|
||||||
text("separatorHeavy"),
|
text("separatorHeavy"),
|
||||||
separatorHeavy(),
|
separatorHeavy(),
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto make_box = [](const std::string& title) {
|
auto make_box = [](const std::string& title) {
|
||||||
return window(text(title) | hcenter | bold,
|
return window(text(title) | hcenter | bold,
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -1,59 +1,60 @@
|
|||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
|
||||||
#include <memory> // for allocator
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
|
#include <memory> // for allocator
|
||||||
|
|
||||||
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, Fit, filler, hbox
|
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, filler, Fit, hbox
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for Color, operator""_rgb, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::DeepSkyBlue4, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::SkyBlue1, Color::White, Color::Yellow, Color::YellowLight, ftxui
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::White, Color::Yellow, Color::YellowLight
|
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
auto document = hbox({
|
||||||
auto document =
|
vbox({
|
||||||
hbox(
|
color(Color::Default, text("Default")),
|
||||||
vbox(
|
color(Color::Black, text("Black")),
|
||||||
color(Color::Default, text("Default")),
|
color(Color::GrayDark, text("GrayDark")),
|
||||||
color(Color::Black, text("Black")),
|
color(Color::GrayLight, text("GrayLight")),
|
||||||
color(Color::GrayDark, text("GrayDark")),
|
color(Color::White, text("White")),
|
||||||
color(Color::GrayLight, text("GrayLight")),
|
color(Color::Blue, text("Blue")),
|
||||||
color(Color::White, text("White")),
|
color(Color::BlueLight, text("BlueLight")),
|
||||||
color(Color::Blue, text("Blue")),
|
color(Color::Cyan, text("Cyan")),
|
||||||
color(Color::BlueLight, text("BlueLight")),
|
color(Color::CyanLight, text("CyanLight")),
|
||||||
color(Color::Cyan, text("Cyan")),
|
color(Color::Green, text("Green")),
|
||||||
color(Color::CyanLight, text("CyanLight")),
|
color(Color::GreenLight, text("GreenLight")),
|
||||||
color(Color::Green, text("Green")),
|
color(Color::Magenta, text("Magenta")),
|
||||||
color(Color::GreenLight, text("GreenLight")),
|
color(Color::MagentaLight, text("MagentaLight")),
|
||||||
color(Color::Magenta, text("Magenta")),
|
color(Color::Red, text("Red")),
|
||||||
color(Color::MagentaLight, text("MagentaLight")),
|
color(Color::RedLight, text("RedLight")),
|
||||||
color(Color::Red, text("Red")),
|
color(Color::Yellow, text("Yellow")),
|
||||||
color(Color::RedLight, text("RedLight")),
|
color(Color::YellowLight, text("YellowLight")),
|
||||||
color(Color::Yellow, text("Yellow")),
|
color(0x66ff66_rgb, text("Phosphor")),
|
||||||
color(Color::YellowLight, text("YellowLight")),
|
color(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
|
||||||
color(0x66ff66_rgb, text("Phosphor"))
|
text("Skyblue to DeepSkyBlue")),
|
||||||
),
|
}),
|
||||||
vbox(
|
vbox({
|
||||||
bgcolor(Color::Default, text("Default")),
|
bgcolor(Color::Default, text("Default")),
|
||||||
bgcolor(Color::Black, text("Black")),
|
bgcolor(Color::Black, text("Black")),
|
||||||
bgcolor(Color::GrayDark, text("GrayDark")),
|
bgcolor(Color::GrayDark, text("GrayDark")),
|
||||||
bgcolor(Color::GrayLight, text("GrayLight")),
|
bgcolor(Color::GrayLight, text("GrayLight")),
|
||||||
bgcolor(Color::White, text("White")),
|
bgcolor(Color::White, text("White")),
|
||||||
bgcolor(Color::Blue, text("Blue")),
|
bgcolor(Color::Blue, text("Blue")),
|
||||||
bgcolor(Color::BlueLight, text("BlueLight")),
|
bgcolor(Color::BlueLight, text("BlueLight")),
|
||||||
bgcolor(Color::Cyan, text("Cyan")),
|
bgcolor(Color::Cyan, text("Cyan")),
|
||||||
bgcolor(Color::CyanLight, text("CyanLight")),
|
bgcolor(Color::CyanLight, text("CyanLight")),
|
||||||
bgcolor(Color::Green, text("Green")),
|
bgcolor(Color::Green, text("Green")),
|
||||||
bgcolor(Color::GreenLight, text("GreenLight")),
|
bgcolor(Color::GreenLight, text("GreenLight")),
|
||||||
bgcolor(Color::Magenta, text("Magenta")),
|
bgcolor(Color::Magenta, text("Magenta")),
|
||||||
bgcolor(Color::MagentaLight, text("MagentaLight")),
|
bgcolor(Color::MagentaLight, text("MagentaLight")),
|
||||||
bgcolor(Color::Red, text("Red")),
|
bgcolor(Color::Red, text("Red")),
|
||||||
bgcolor(Color::RedLight, text("RedLight")),
|
bgcolor(Color::RedLight, text("RedLight")),
|
||||||
bgcolor(Color::Yellow, text("Yellow")),
|
bgcolor(Color::Yellow, text("Yellow")),
|
||||||
bgcolor(Color::YellowLight, text("YellowLight")),
|
bgcolor(Color::YellowLight, text("YellowLight")),
|
||||||
bgcolor(0x66ff66_rgb, text("Phosphor"))
|
bgcolor(0x66ff66_rgb, text("Phosphor")),
|
||||||
),
|
bgcolor(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
|
||||||
filler()
|
text("Skyblue to DeepSkyBlue")),
|
||||||
);
|
}),
|
||||||
// clang-format on
|
filler(),
|
||||||
|
});
|
||||||
|
|
||||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||||
Render(screen, document);
|
Render(screen, document);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
@@ -19,7 +19,8 @@ int main(int argc, const char* argv[]) {
|
|||||||
text("blink") | blink , text(" ") ,
|
text("blink") | blink , text(" ") ,
|
||||||
text("strikethrough") | strikethrough , text(" ") ,
|
text("strikethrough") | strikethrough , text(" ") ,
|
||||||
text("color") | color(Color::Blue) , text(" ") ,
|
text("color") | color(Color::Blue) , text(" ") ,
|
||||||
text("bgcolor") | bgcolor(Color::Blue) ,
|
text("bgcolor") | bgcolor(Color::Blue) , text(" ") ,
|
||||||
|
text("hyperlink") | hyperlink("https://github.com/ArthurSonzogni/FTXUI"),
|
||||||
});
|
});
|
||||||
// clang-format on
|
// clang-format on
|
||||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||||
|
25
examples/dom/style_hyperlink.cpp
Normal file
25
examples/dom/style_hyperlink.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include <ftxui/dom/elements.hpp> // for text, operator|, bold, Fit, hbox, Element
|
||||||
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
|
#include <memory> // for allocator
|
||||||
|
|
||||||
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
using namespace ftxui;
|
||||||
|
auto document = //
|
||||||
|
hbox({
|
||||||
|
text("This text is an "),
|
||||||
|
text("hyperlink") | hyperlink("https://www.google.com"),
|
||||||
|
text(". Do you like it?"),
|
||||||
|
});
|
||||||
|
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||||
|
Render(screen, document);
|
||||||
|
screen.Print();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = hbox({
|
auto document = hbox({
|
||||||
text("This text is "),
|
text("This text is "),
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
hbox({
|
hbox({
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White, ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
auto table = Table({
|
auto table = Table({
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto document = //
|
auto document = //
|
||||||
vbox({
|
vbox({
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for ftxui
|
#include "ftxui/screen/color.hpp" // for ftxui
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto make_box = [](int dimx, int dimy) {
|
auto make_box = [](int dimx, int dimy) {
|
||||||
std::string title = std::to_string(dimx) + "x" + std::to_string(dimy);
|
std::string title = std::to_string(dimx) + "x" + std::to_string(dimy);
|
||||||
|
43
flake.lock
generated
Normal file
43
flake.lock
generated
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678901627,
|
||||||
|
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1679734080,
|
||||||
|
"narHash": "sha256-z846xfGLlon6t9lqUzlNtBOmsgQLQIZvR6Lt2dImk1M=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "dbf5322e93bcc6cfc52268367a8ad21c09d76fea",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
61
flake.nix
Normal file
61
flake.nix
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
description = "C++ Functional Terminal User Interface library";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {self, nixpkgs, flake-utils}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let pkgs = import nixpkgs { inherit system; }; in
|
||||||
|
{
|
||||||
|
packages.ftxui = pkgs.stdenv.mkDerivation rec {
|
||||||
|
pname = "ftxui";
|
||||||
|
version = "v4.0.0";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "ArthurSonzogni";
|
||||||
|
repo = "FTXUI";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-3kAhHDUwzwdvHc8JZAcA14tGqa6w69qrN1JXhSxNBQY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.cmake
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DFTXUI_ENABLE_INSTALL=ON"
|
||||||
|
"-DFTXUI_BUILD_EXAMPLES=OFF"
|
||||||
|
"-DFTXUI_BUILD_TESTS=OFF"
|
||||||
|
"-DFTXUI_BUILD_DOCS=OFF"
|
||||||
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://arthursonzogni.github.io/FTXUI/";
|
||||||
|
description = "C++ Functional Terminal User Interface.";
|
||||||
|
longDescription = ''
|
||||||
|
Functional Terminal (X) User interface
|
||||||
|
|
||||||
|
A simple C++ library for terminal based user interfaces!
|
||||||
|
Feature
|
||||||
|
- Functional style. Inspired by [1] and React
|
||||||
|
- Simple and elegant syntax (in my opinion)
|
||||||
|
- Keyboard & mouse navigation.
|
||||||
|
- Support for UTF8 and fullwidth chars (→ 测试)
|
||||||
|
- Support for animations. Demo 1, Demo 2
|
||||||
|
- Support for drawing. Demo
|
||||||
|
- No dependencies
|
||||||
|
- Cross platform: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
|
||||||
|
- Learn by examples, and tutorials
|
||||||
|
- Multiple packages: CMake FetchContent (preferred), vcpkg, pkgbuild, conan, nix, etc...
|
||||||
|
- Good practises: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
|
||||||
|
'';
|
||||||
|
license = pkgs.lib.licenses.mit;
|
||||||
|
platforms = pkgs.lib.platforms.all;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
9
ftxui.pc.in
Normal file
9
ftxui.pc.in
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||||
|
libdir="@CMAKE_INSTALL_FULL_LIBDIR@"
|
||||||
|
includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@"
|
||||||
|
|
||||||
|
Name: @PROJECT_NAME@
|
||||||
|
Description: @CMAKE_PROJECT_DESCRIPTION@
|
||||||
|
Version: @PROJECT_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -lftxui-component -lftxui-dom -lftxui-screen
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "ftxui/dom/canvas.hpp"
|
#include "ftxui/dom/canvas.hpp"
|
||||||
#include "ftxui/dom/flexbox_config.hpp"
|
#include "ftxui/dom/flexbox_config.hpp"
|
||||||
|
#include "ftxui/dom/linear_gradient.hpp"
|
||||||
#include "ftxui/dom/node.hpp"
|
#include "ftxui/dom/node.hpp"
|
||||||
#include "ftxui/screen/box.hpp"
|
#include "ftxui/screen/box.hpp"
|
||||||
#include "ftxui/screen/color.hpp"
|
#include "ftxui/screen/color.hpp"
|
||||||
@@ -20,7 +21,15 @@ using Elements = std::vector<Element>;
|
|||||||
using Decorator = std::function<Element(Element)>;
|
using Decorator = std::function<Element(Element)>;
|
||||||
using GraphFunction = std::function<std::vector<int>(int, int)>;
|
using GraphFunction = std::function<std::vector<int>(int, int)>;
|
||||||
|
|
||||||
enum BorderStyle { LIGHT, HEAVY, DOUBLE, ROUNDED, EMPTY };
|
enum BorderStyle {
|
||||||
|
LIGHT,
|
||||||
|
DASHED,
|
||||||
|
HEAVY,
|
||||||
|
DOUBLE,
|
||||||
|
ROUNDED,
|
||||||
|
EMPTY,
|
||||||
|
};
|
||||||
|
|
||||||
enum class GaugeDirection { Left, Up, Right, Down };
|
enum class GaugeDirection { Left, Up, Right, Down };
|
||||||
|
|
||||||
// Pipe elements into decorator togethers.
|
// Pipe elements into decorator togethers.
|
||||||
@@ -37,6 +46,7 @@ Element text(std::string text);
|
|||||||
Element vtext(std::string text);
|
Element vtext(std::string text);
|
||||||
Element separator();
|
Element separator();
|
||||||
Element separatorLight();
|
Element separatorLight();
|
||||||
|
Element separatorDashed();
|
||||||
Element separatorHeavy();
|
Element separatorHeavy();
|
||||||
Element separatorDouble();
|
Element separatorDouble();
|
||||||
Element separatorEmpty();
|
Element separatorEmpty();
|
||||||
@@ -59,11 +69,14 @@ Element gaugeDown(float progress);
|
|||||||
Element gaugeDirection(float progress, GaugeDirection);
|
Element gaugeDirection(float progress, GaugeDirection);
|
||||||
Element border(Element);
|
Element border(Element);
|
||||||
Element borderLight(Element);
|
Element borderLight(Element);
|
||||||
|
Element borderDashed(Element);
|
||||||
Element borderHeavy(Element);
|
Element borderHeavy(Element);
|
||||||
Element borderDouble(Element);
|
Element borderDouble(Element);
|
||||||
Element borderRounded(Element);
|
Element borderRounded(Element);
|
||||||
Element borderEmpty(Element);
|
Element borderEmpty(Element);
|
||||||
Decorator borderStyled(BorderStyle);
|
Decorator borderStyled(BorderStyle);
|
||||||
|
Decorator borderStyled(BorderStyle, Color);
|
||||||
|
Decorator borderStyled(Color);
|
||||||
Decorator borderWith(const Pixel&);
|
Decorator borderWith(const Pixel&);
|
||||||
Element window(Element title, Element content);
|
Element window(Element title, Element content);
|
||||||
Element spinner(int charset_index, size_t image_index);
|
Element spinner(int charset_index, size_t image_index);
|
||||||
@@ -88,11 +101,17 @@ Element blink(Element);
|
|||||||
Element strikethrough(Element);
|
Element strikethrough(Element);
|
||||||
Decorator color(Color);
|
Decorator color(Color);
|
||||||
Decorator bgcolor(Color);
|
Decorator bgcolor(Color);
|
||||||
|
Decorator color(const LinearGradient&);
|
||||||
|
Decorator bgcolor(const LinearGradient&);
|
||||||
Element color(Color, Element);
|
Element color(Color, Element);
|
||||||
Element bgcolor(Color, Element);
|
Element bgcolor(Color, Element);
|
||||||
|
Element color(const LinearGradient&, Element);
|
||||||
|
Element bgcolor(const LinearGradient&, Element);
|
||||||
Decorator focusPosition(int x, int y);
|
Decorator focusPosition(int x, int y);
|
||||||
Decorator focusPositionRelative(float x, float y);
|
Decorator focusPositionRelative(float x, float y);
|
||||||
Element automerge(Element child);
|
Element automerge(Element child);
|
||||||
|
Decorator hyperlink(std::string link);
|
||||||
|
Element hyperlink(std::string link, Element child);
|
||||||
|
|
||||||
// --- Layout is
|
// --- Layout is
|
||||||
// Horizontal, Vertical or stacked set of elements.
|
// Horizontal, Vertical or stacked set of elements.
|
||||||
|
52
include/ftxui/dom/linear_gradient.hpp
Normal file
52
include/ftxui/dom/linear_gradient.hpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#ifndef FTXUI_DOM_LINEAR_GRADIENT_HPP
|
||||||
|
#define FTXUI_DOM_LINEAR_GRADIENT_HPP
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ftxui/screen/color.hpp" // for Colors
|
||||||
|
|
||||||
|
namespace ftxui {
|
||||||
|
|
||||||
|
/// @brief A class representing the settings for linear-gradient color effect.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```cpp
|
||||||
|
/// LinearGradient()
|
||||||
|
/// .Angle(45)
|
||||||
|
/// .Stop(Color::Red, 0.0)
|
||||||
|
/// .Stop(Color::Green, 0.5)
|
||||||
|
/// .Stop(Color::Blue, 1.0);
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// There are also shorthand constructors:
|
||||||
|
/// ```cpp
|
||||||
|
/// LinearGradient(Color::Red, Color::Blue);
|
||||||
|
/// LinearGradient(45, Color::Red, Color::Blue);
|
||||||
|
/// ```
|
||||||
|
struct LinearGradient {
|
||||||
|
float angle = 0.f;
|
||||||
|
struct Stop {
|
||||||
|
Color color = Color::Default;
|
||||||
|
std::optional<float> position;
|
||||||
|
};
|
||||||
|
std::vector<Stop> stops;
|
||||||
|
|
||||||
|
// Simple constructor
|
||||||
|
LinearGradient();
|
||||||
|
LinearGradient(Color begin, Color end);
|
||||||
|
LinearGradient(float angle, Color begin, Color end);
|
||||||
|
|
||||||
|
// Modifier using the builder pattern.
|
||||||
|
LinearGradient& Angle(float angle);
|
||||||
|
LinearGradient& Stop(Color color, float position);
|
||||||
|
LinearGradient& Stop(Color color);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ftxui
|
||||||
|
|
||||||
|
#endif // FTXUI_DOM_LINEAR_GRADIENT_HPP
|
||||||
|
|
||||||
|
// Copyright 2023 Arthur Sonzogni. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be found in
|
||||||
|
// the LICENSE file.
|
@@ -2,7 +2,8 @@
|
|||||||
#define FTXUI_SCREEN_COLOR_HPP
|
#define FTXUI_SCREEN_COLOR_HPP
|
||||||
|
|
||||||
#include <cstdint> // for uint8_t
|
#include <cstdint> // for uint8_t
|
||||||
#include <string> // for wstring
|
#include <string> // for string
|
||||||
|
#include <vector> // for vector
|
||||||
|
|
||||||
#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,8 +1,9 @@
|
|||||||
#ifndef FTXUI_SCREEN_SCREEN_HPP
|
#ifndef FTXUI_SCREEN_SCREEN_HPP
|
||||||
#define FTXUI_SCREEN_SCREEN_HPP
|
#define FTXUI_SCREEN_SCREEN_HPP
|
||||||
|
|
||||||
|
#include <cstdint> // for uint8_t
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string> // for string, allocator, basic_string
|
#include <string> // for string, basic_string, allocator
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#include "ftxui/screen/box.hpp" // for Box
|
#include "ftxui/screen/box.hpp" // for Box
|
||||||
@@ -20,6 +21,10 @@ struct Pixel {
|
|||||||
// like: a⃦, this can potentially contains multiple codepoitns.
|
// like: a⃦, this can potentially contains multiple codepoitns.
|
||||||
std::string character = " ";
|
std::string character = " ";
|
||||||
|
|
||||||
|
// The hyperlink associated with the pixel.
|
||||||
|
// 0 is the default value, meaning no hyperlink.
|
||||||
|
uint8_t hyperlink = 0;
|
||||||
|
|
||||||
// Colors:
|
// Colors:
|
||||||
Color background_color = Color::Default;
|
Color background_color = Color::Default;
|
||||||
Color foreground_color = Color::Default;
|
Color foreground_color = Color::Default;
|
||||||
@@ -99,6 +104,11 @@ class Screen {
|
|||||||
Cursor cursor() const { return cursor_; }
|
Cursor cursor() const { return cursor_; }
|
||||||
void SetCursor(Cursor cursor) { cursor_ = cursor; }
|
void SetCursor(Cursor cursor) { cursor_ = cursor; }
|
||||||
|
|
||||||
|
// Store an hyperlink in the screen. Return the id of the hyperlink. The id is
|
||||||
|
// used to identify the hyperlink when the user click on it.
|
||||||
|
uint8_t RegisterHyperlink(std::string link);
|
||||||
|
const std::string& Hyperlink(uint8_t id) const;
|
||||||
|
|
||||||
Box stencil;
|
Box stencil;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -106,6 +116,7 @@ class Screen {
|
|||||||
int dimy_;
|
int dimy_;
|
||||||
std::vector<std::vector<Pixel>> pixels_;
|
std::vector<std::vector<Pixel>> pixels_;
|
||||||
Cursor cursor_;
|
Cursor cursor_;
|
||||||
|
std::vector<std::string> hyperlinks_ = {""};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define FTXUI_SCREEN_STRING_HPP
|
#define FTXUI_SCREEN_STRING_HPP
|
||||||
|
|
||||||
#include <stddef.h> // for size_t
|
#include <stddef.h> // for size_t
|
||||||
|
#include <cstdint> // for uint8_t
|
||||||
#include <string> // for string, wstring, to_string
|
#include <string> // for string, wstring, to_string
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
26
iwyu.imp
26
iwyu.imp
@@ -14,6 +14,32 @@
|
|||||||
{ include: ["<gtest/gtest-printers.h>", "private", "<gtest/gtest.h>", "public" ] },
|
{ include: ["<gtest/gtest-printers.h>", "private", "<gtest/gtest.h>", "public" ] },
|
||||||
{ include: ["<gtest/gtest-test-part.h>", "private", "<gtest/gtest.h>", "public" ] },
|
{ include: ["<gtest/gtest-test-part.h>", "private", "<gtest/gtest.h>", "public" ] },
|
||||||
{ include: ["<gtest/gtest-typed-test.h>", "private", "<gtest/gtest.h>", "public" ] },
|
{ include: ["<gtest/gtest-typed-test.h>", "private", "<gtest/gtest.h>", "public" ] },
|
||||||
|
{ include: ["<assert.h>", "private", "<cassert>", "public" ] },
|
||||||
|
{ include: ["<complex.h>", "private", "<ccomplex>", "public" ] },
|
||||||
|
{ include: ["<ctype.h>", "private", "<cctype>", "public" ] },
|
||||||
|
{ include: ["<errno.h>", "private", "<cerrno>", "public" ] },
|
||||||
|
{ include: ["<fenv.h>", "private", "<cfenv>", "public" ] },
|
||||||
|
{ include: ["<float.h>", "private", "<cfloat>", "public" ] },
|
||||||
|
{ include: ["<inttypes.h>", "private", "<cinttypes>", "public" ] },
|
||||||
|
{ include: ["<iso646.h>", "private", "<ciso646>", "public" ] },
|
||||||
|
{ include: ["<limits.h>", "private", "<climits>", "public" ] },
|
||||||
|
{ include: ["<locale.h>", "private", "<clocale>", "public" ] },
|
||||||
|
{ include: ["<math.h>", "private", "<cmath>", "public" ] },
|
||||||
|
{ include: ["<setjmp.h>", "private", "<csetjmp>", "public" ] },
|
||||||
|
{ include: ["<signal.h>", "private", "<csignal>", "public" ] },
|
||||||
|
{ include: ["<stdalign.h>", "private", "<cstdalign>", "public" ] },
|
||||||
|
{ include: ["<stdarg.h>", "private", "<cstdarg>", "public" ] },
|
||||||
|
{ include: ["<stdbool.h>", "private", "<cstdbool>", "public" ] },
|
||||||
|
{ include: ["<stddef.h>", "private", "<cstddef>", "public" ] },
|
||||||
|
{ include: ["<stdint.h>", "private", "<cstdint>", "public" ] },
|
||||||
|
{ include: ["<stdio.h>", "private", "<cstdio>", "public" ] },
|
||||||
|
{ include: ["<stdlib.h>", "private", "<cstdlib>", "public" ] },
|
||||||
|
{ include: ["<string.h>", "private", "<cstring>", "public" ] },
|
||||||
|
{ include: ["<tgmath.h>", "private", "<ctgmath>", "public" ] },
|
||||||
|
{ include: ["<time.h>", "private", "<ctime>", "public" ] },
|
||||||
|
{ include: ["<uchar.h>", "private", "<cuchar>", "public" ] },
|
||||||
|
{ include: ["<wchar.h>", "private", "<cwchar>", "public" ] },
|
||||||
|
{ include: ["<wctype.h>", "private", "<cwctype>", "public" ] },
|
||||||
{ symbol: ["ftxui", "private", "", "public" ] },
|
{ symbol: ["ftxui", "private", "", "public" ] },
|
||||||
{ symbol: ["char_traits", "private", "<string>", "public" ] },
|
{ symbol: ["char_traits", "private", "<string>", "public" ] },
|
||||||
{ symbol: ["ECHO", "private", "<termios.h>", "public" ] },
|
{ symbol: ["ECHO", "private", "<termios.h>", "public" ] },
|
||||||
|
@@ -124,10 +124,10 @@ TEST(ButtonTest, Animation) {
|
|||||||
Screen screen(12, 3);
|
Screen screen(12, 3);
|
||||||
Render(screen, container->Render());
|
Render(screen, container->Render());
|
||||||
EXPECT_EQ(screen.ToString(),
|
EXPECT_EQ(screen.ToString(),
|
||||||
"\x1B[1m\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m \x1B[22m "
|
"\x1B[1m\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m \x1B[22m "
|
||||||
" \x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;192;192;192m\x1B[48;2;0;0;"
|
" \x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;191;191;191m\x1B[48;2;0;0;"
|
||||||
"0m btn1 \x1B[22m btn2 "
|
"0m btn1 \x1B[22m btn2 "
|
||||||
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;192;192;192m\x1B[48;2;0;0;"
|
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;191;191;191m\x1B[48;2;0;0;"
|
||||||
"0m \x1B[22m \x1B[39m\x1B[49m");
|
"0m \x1B[22m \x1B[39m\x1B[49m");
|
||||||
}
|
}
|
||||||
selected = 1;
|
selected = 1;
|
||||||
@@ -135,10 +135,10 @@ TEST(ButtonTest, Animation) {
|
|||||||
Screen screen(12, 3);
|
Screen screen(12, 3);
|
||||||
Render(screen, container->Render());
|
Render(screen, container->Render());
|
||||||
EXPECT_EQ(screen.ToString(),
|
EXPECT_EQ(screen.ToString(),
|
||||||
"\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m \x1B[1m "
|
"\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m \x1B[1m "
|
||||||
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;192;192;192m\x1B[48;2;0;0;"
|
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;191;191;191m\x1B[48;2;0;0;"
|
||||||
"0m btn1 \x1B[1m btn2 "
|
"0m btn1 \x1B[1m btn2 "
|
||||||
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;192;192;192m\x1B[48;2;0;0;"
|
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;191;191;191m\x1B[48;2;0;0;"
|
||||||
"0m \x1B[1m \x1B[22m\x1B[39m\x1B[49m");
|
"0m \x1B[1m \x1B[22m\x1B[39m\x1B[49m");
|
||||||
}
|
}
|
||||||
animation::Params params(2s);
|
animation::Params params(2s);
|
||||||
@@ -148,12 +148,12 @@ TEST(ButtonTest, Animation) {
|
|||||||
Render(screen, container->Render());
|
Render(screen, container->Render());
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
screen.ToString(),
|
screen.ToString(),
|
||||||
"\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m "
|
"\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m "
|
||||||
"\x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m "
|
"\x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m "
|
||||||
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m "
|
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m "
|
||||||
"btn1 \x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m btn2 "
|
"btn1 \x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m btn2 "
|
||||||
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m "
|
"\x1B[22m\x1B[39m\x1B[49m\r\n\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m "
|
||||||
" \x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m "
|
" \x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m "
|
||||||
"\x1B[22m\x1B[39m\x1B[49m");
|
"\x1B[22m\x1B[39m\x1B[49m");
|
||||||
}
|
}
|
||||||
EXPECT_EQ(selected, 1);
|
EXPECT_EQ(selected, 1);
|
||||||
@@ -164,12 +164,12 @@ TEST(ButtonTest, Animation) {
|
|||||||
Render(screen, container->Render());
|
Render(screen, container->Render());
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
screen.ToString(),
|
screen.ToString(),
|
||||||
"\x1B[1m\x1B[38;2;223;223;223m\x1B[48;2;64;64;64m "
|
"\x1B[1m\x1B[38;2;226;226;226m\x1B[48;2;93;93;93m "
|
||||||
"\x1B[22m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m "
|
"\x1B[22m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m "
|
||||||
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;223;223;223m\x1B[48;2;64;64;64m "
|
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;226;226;226m\x1B[48;2;93;93;93m "
|
||||||
"btn1 \x1B[22m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m btn2 "
|
"btn1 \x1B[22m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m btn2 "
|
||||||
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;223;223;223m\x1B[48;2;64;64;64m "
|
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;226;226;226m\x1B[48;2;93;93;93m "
|
||||||
" \x1B[22m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m "
|
" \x1B[22m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m "
|
||||||
"\x1B[39m\x1B[49m");
|
"\x1B[39m\x1B[49m");
|
||||||
}
|
}
|
||||||
container->OnAnimation(params);
|
container->OnAnimation(params);
|
||||||
@@ -178,12 +178,12 @@ TEST(ButtonTest, Animation) {
|
|||||||
Render(screen, container->Render());
|
Render(screen, container->Render());
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
screen.ToString(),
|
screen.ToString(),
|
||||||
"\x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;128m "
|
"\x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;127m "
|
||||||
"\x1B[22m\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m "
|
"\x1B[22m\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m "
|
||||||
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;"
|
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;"
|
||||||
"128m btn1 \x1B[22m\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m btn2 "
|
"127m btn1 \x1B[22m\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m btn2 "
|
||||||
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;255;255;255m\x1B[48;2;128;128;"
|
"\x1B[39m\x1B[49m\r\n\x1B[1m\x1B[38;2;254;254;254m\x1B[48;2;127;127;"
|
||||||
"128m \x1B[22m\x1B[38;2;192;192;192m\x1B[48;2;0;0;0m "
|
"127m \x1B[22m\x1B[38;2;191;191;191m\x1B[48;2;0;0;0m "
|
||||||
"\x1B[39m\x1B[49m");
|
"\x1B[39m\x1B[49m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -96,8 +96,7 @@ MenuOption GeneratorMenuOption(const char* data, size_t size) {
|
|||||||
MenuOption option;
|
MenuOption option;
|
||||||
option.underline = GeneratorUnderlineOption(data, size);
|
option.underline = GeneratorUnderlineOption(data, size);
|
||||||
option.entries = GeneratorMenuEntryOption(data, size);
|
option.entries = GeneratorMenuEntryOption(data, size);
|
||||||
option.direction =
|
option.direction = static_cast<MenuOption::Direction>(GeneratorInt(data, size) % 4);
|
||||||
static_cast<MenuOption::Direction>(GeneratorInt(data, size) % 4);
|
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#include <algorithm> // for max, min
|
#include <algorithm> // for max, min
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
|
#include <cstdint> // for uint32_t
|
||||||
#include <functional> // for function
|
#include <functional> // for function
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
#include <string> // for string, allocator
|
#include <string> // for string, allocator
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user