33 Commits

Author SHA1 Message Date
Miko
1dde570c0b Merge 6e7c0cb212 into 2f0afe7b14 2025-05-31 01:16:23 +07:00
Miko
6e7c0cb212 Add mention of ftxui.util module 2025-05-29 15:03:54 +00:00
Miko
2d12c4b3db Merge branch 'main' into main 2025-05-29 10:59:54 -04:00
Toyosatomimi no Miko
88a9132d75 Missing italic declaration 2025-05-15 15:31:39 -04:00
Toyosatomimi no Miko
83b83e30ec Missing header (number 2) 2025-05-15 15:24:11 -04:00
Toyosatomimi no Miko
bc45cd6ad5 Missing header 2025-05-15 15:19:03 -04:00
Toyosatomimi no Miko
cdf8144bf1 This should fix the problem. Forgot to export these 2025-05-15 15:07:49 -04:00
Toyosatomimi no Miko
ed5f04ccc0 Update examples for testing modules 2025-05-15 14:54:42 -04:00
Miko
4b8c8ea00d Merge branch 'ArthurSonzogni:main' into main 2025-05-11 17:12:31 -04:00
Miko
9e1120c146 Merge branch 'main' into main 2025-05-10 22:01:04 -04:00
Miko
006ec1cbed Merge branch 'ArthurSonzogni:main' into main 2025-05-04 19:27:15 -04:00
Miko
16c25ae441 Merge branch 'main' into main 2025-05-01 17:09:57 -04:00
Miko
05b4bffe3b Merge branch 'main' into main 2025-04-30 14:39:52 -04:00
Toyosatomimi no Miko
ffc6dcd3bf Add ftxui module for all submodules 2025-04-19 09:54:02 -04:00
ArthurSonzogni
f6dceabdc9 tweaks 2025-04-11 15:07:58 +02:00
ArthurSonzogni
cb8ebdeb44 fix workflows 3 2025-04-11 02:03:18 +02:00
ArthurSonzogni
dd37fba100 Fix workflow 2 2025-04-11 01:48:07 +02:00
ArthurSonzogni
4d627c1ffb Fix workflow. 2025-04-11 01:43:23 +02:00
ArthurSonzogni
1dff6a5c35 Compile examples with modules. 2025-04-11 01:39:07 +02:00
ArthurSonzogni
0c67566427 Update 2025-04-10 14:45:45 +02:00
ArthurSonzogni
85c3dc45ca Add Changelog and remove flag. 2025-04-09 12:35:46 +02:00
Miko
84f691e9d3 Merge branch 'ArthurSonzogni:main' into main 2025-04-08 11:45:52 -04:00
Miko
2e36aa061a Merge branch 'ArthurSonzogni:main' into main 2025-03-29 22:17:54 -04:00
Miko
8ed06a4812 Merge branch 'ArthurSonzogni:main' into main 2025-03-29 12:26:56 -04:00
Toyosatomimi no Miko
571f6dcdcf Trailing newline 2025-03-29 12:26:07 -04:00
Toyosatomimi no Miko
e57c275512 Make modules opt-in (for pre-C++20 builds not to break) 2025-03-28 08:28:05 -04:00
Miko
1c37cdd192 Merge branch 'ArthurSonzogni:main' into main 2025-03-28 08:22:58 -04:00
Miko
772d4ebeed Merge branch 'ArthurSonzogni:main' into main 2025-03-27 23:56:08 -04:00
Miko
5f5bc9019d Delete modules/CMakeLists.txt
No longer needed
2025-03-28 03:54:48 +00:00
Miko
f87b6a4d12 Update CMakeLists.txt
Directly go to `modules/ftxui`
2025-03-28 03:54:25 +00:00
Toyosatomimi no Miko
0d50fa25fe I assume the version produced by CMake was supposed to be bumped up to 6.0.0, fixing this 2025-03-25 19:09:35 -04:00
Toyosatomimi no Miko
730ebeed1d Add my own project (using FTXUI modules) for an example 2025-03-25 18:59:58 -04:00
Toyosatomimi no Miko
69928b374e Add modules support 2025-03-25 18:49:18 -04:00
265 changed files with 2347 additions and 5086 deletions

View File

@@ -1 +0,0 @@
bazel/test/

View File

@@ -1,10 +1,7 @@
common --enable_bzlmod
common --enable_workspace
build --features=layering_check build --features=layering_check
build --enable_bzlmod build --enable_bzlmod
build --enable_platform_specific_config build --enable_platform_specific_config
build:linux --cxxopt=-std=c++20 build:linux --cxxopt=-std=c++20
build:macos --cxxopt=-std=c++20 build:macos --cxxopt=-std=c++20
build:windows --cxxopt=/std:c++20 build:windows --cxxopt=-std:c++20

View File

@@ -2,6 +2,3 @@
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium BasedOnStyle: Chromium
Standard: Cpp11 Standard: Cpp11
InsertBraces: true
InsertNewlineAtEOF: true

View File

@@ -1,212 +0,0 @@
# FTXUI - Functional Terminal (X) User Interface
FTXUI is a cross-platform C++ library for terminal-based user interfaces with a functional programming approach, inspired by React.
**ALWAYS reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the information here.**
## Working Effectively
### Build System Setup and Commands
- Bootstrap and build the repository:
```bash
# Basic build (library only) - fast
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel $(nproc)
# Build time: ~30 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
# Build with examples
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DFTXUI_BUILD_EXAMPLES=ON
cmake --build build --parallel $(nproc)
# Build time: ~70 seconds. NEVER CANCEL. Set timeout to 180+ seconds.
# Build with examples and tests
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DFTXUI_BUILD_EXAMPLES=ON -DFTXUI_BUILD_TESTS=ON
cmake --build build --parallel $(nproc)
# Build time: ~113 seconds (includes GoogleTest download). NEVER CANCEL. Set timeout to 300+ seconds.
```
- Alternative build with Ninja (faster):
```bash
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFTXUI_BUILD_EXAMPLES=ON
ninja -C build
# Build time: ~62 seconds. NEVER CANCEL. Set timeout to 180+ seconds.
```
- Run unit tests:
```bash
# Configure with tests enabled first, then:
cd build && ctest --output-on-failure
# Test time: ~4 seconds (302 tests). NEVER CANCEL. Set timeout to 60+ seconds.
```
### Bazel Support
- FTXUI also supports Bazel build system
- **WARNING**: Bazel may fail due to network connectivity issues in sandboxed environments
- If Bazel is available:
```bash
bazel build //... # Build everything
bazel test //... # Run tests
```
## Validation
### Manual Testing After Changes
- **ALWAYS manually validate changes by building and running examples after making code modifications**
- Run example applications to verify functionality:
```bash
# Build an example first
cmake --build build --target ftxui_example_border
# Run examples (they are interactive, use timeout to terminate)
timeout 2s build/examples/dom/ftxui_example_border
timeout 2s build/examples/dom/ftxui_example_color_gallery
timeout 2s build/examples/component/ftxui_example_button
```
- Examples should produce visual terminal output with borders, colors, and UI components
- **CRITICAL**: Always run at least one DOM example and one Component example to verify both modules work
### Code Quality and Formatting
- Always run formatting before committing:
```bash
./tools/format.sh
# Format time: ~7 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
```
- The format script adds license headers and runs clang-format on all source files
- **Required**: Run formatting or the CI (.github/workflows/build.yaml) will fail
### Build Validation Requirements
- ALWAYS build with both `-DFTXUI_BUILD_EXAMPLES=ON` and `-DFTXUI_BUILD_TESTS=ON` when making changes
- Run the complete test suite with `ctest --output-on-failure`
- All 302 tests must pass
- **Scenario Testing**: Run at least these validation scenarios:
1. Build library only (basic validation)
2. Build with examples and run 2-3 different examples
3. Build with tests and run complete test suite
4. Run formatting tool to ensure code style compliance
## Project Structure
### Key Directories
```
/home/runner/work/FTXUI/FTXUI/
├── include/ftxui/ # Public header files
│ ├── component/ # Interactive component headers
│ ├── dom/ # DOM element headers
│ ├── screen/ # Screen and rendering headers
│ └── util/ # Utility headers
├── src/ftxui/ # Implementation files
│ ├── component/ # Interactive components (buttons, menus, etc.)
│ ├── dom/ # DOM elements (layout, styling, text)
│ ├── screen/ # Screen rendering and terminal handling
│ └── util/ # Utilities
├── examples/ # Example applications
│ ├── component/ # Interactive component examples
│ └── dom/ # DOM element examples
├── cmake/ # CMake configuration files
├── tools/ # Development tools (formatting, etc.)
└── .github/workflows/ # CI/CD configuration
```
### Core Library Modules
FTXUI is organized into three main modules that depend on each other:
```
┌component──┐ (Interactive UI components)
│┌dom──────┐│ (Layout and styling elements)
││┌screen─┐││ (Terminal rendering and input)
└┴┴───────┴┴┘
```
1. **screen**: Low-level terminal handling, colors, pixels, input
2. **dom**: Layout elements (hbox, vbox, text, borders, etc.)
3. **component**: Interactive components (buttons, menus, input fields)
### CMake Build Options
| Option | Description | Default |
|-----------------------------------|----------------------------------|---------|
| FTXUI_BUILD_EXAMPLES | Build example applications | OFF |
| FTXUI_BUILD_DOCS | Build documentation | OFF |
| FTXUI_BUILD_TESTS | Build and enable tests | OFF |
| FTXUI_BUILD_MODULES | Build C++20 modules | OFF |
| FTXUI_ENABLE_INSTALL | Generate install targets | ON |
| FTXUI_MICROSOFT_TERMINAL_FALLBACK | Windows terminal compatibility | ON/OFF |
## Common Tasks
### Building Examples
```bash
# Build specific examples
cmake --build build --target ftxui_example_border
cmake --build build --target ftxui_example_button
cmake --build build --target ftxui_example_menu
# List all available examples
find build -name "ftxui_example_*" -type f
```
### Running Tests
```bash
# Run all tests
cd build && ctest
# Run tests with verbose output
cd build && ctest --verbose
# Run specific test pattern
cd build && ctest -R "Button" --verbose
```
### Working with Source Code
- **Component Development**: Modify files in `src/ftxui/component/` for interactive elements
- **DOM Development**: Modify files in `src/ftxui/dom/` for layout and styling
- **Screen Development**: Modify files in `src/ftxui/screen/` for terminal rendering
- **Adding Examples**: Add new `.cpp` files in `examples/component/` or `examples/dom/`
- **Header Files**: Public APIs are in `include/ftxui/[module]/`
### Integration Patterns
When adding FTXUI to a project, use CMake FetchContent (recommended):
```cmake
include(FetchContent)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v6.1.9
)
FetchContent_MakeAvailable(ftxui)
target_link_libraries(your_target PRIVATE
ftxui::component # For interactive components
ftxui::dom # For layout elements
ftxui::screen # For basic rendering
)
```
## Troubleshooting
### Build Issues
- If CMake configuration fails, ensure C++20 support: `cmake --version` (need 3.12+)
- If Ninja build fails, fall back to Make: `cmake -S . -B build` (without `-G Ninja`)
- If tests fail to build, GoogleTest download might have failed - check network connectivity
- Build artifacts are in `build/` directory - delete with `rm -rf build` to clean
### Example Issues
- Examples are interactive terminal applications - use `timeout` to terminate them
- If examples don't display correctly, terminal might not support colors/Unicode
- Examples require terminal size of at least 80x24 for proper display
### Formatting Issues
- Format script requires clang-format to be installed
- If format script fails, check that source files are not read-only
- Format script modifies files in-place - commit changes afterwards
## Critical Reminders
- **NEVER CANCEL long-running builds** - they may take 2-3 minutes
- **ALWAYS run the formatting tool** before committing changes
- **ALWAYS build and test examples** when making component/dom changes
- **SET APPROPRIATE TIMEOUTS**: 300+ seconds for builds, 60+ seconds for tests
- **BUILD TIMING EXPECTATIONS**:
- Basic library: ~30 seconds
- With examples: ~70 seconds
- With examples + tests: ~113 seconds (first time, includes GoogleTest download)
- Subsequent builds: ~60-70 seconds
- Tests execution: ~4 seconds
- Formatting: ~7 seconds

View File

@@ -56,13 +56,6 @@ jobs:
CXX: ${{ matrix.cxx }} CXX: ${{ matrix.cxx }}
run: bazel test --test_output=all ... run: bazel test --test_output=all ...
- name: "Bazel Smoke test"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: bazel build //... --enable_bzlmod --override_module=ftxui=../..
working-directory: bazel/test
test_cmake: test_cmake:
name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}" name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}"
strategy: strategy:
@@ -216,3 +209,144 @@ jobs:
-DFTXUI_ENABLE_INSTALL=ON -DFTXUI_ENABLE_INSTALL=ON
-DFTXUI_DEV_WARNINGS=ON ; -DFTXUI_DEV_WARNINGS=ON ;
cmake --build . cmake --build .
# Create a release on new v* tags
release:
needs:
- test_cmake
- test_bazel
if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
name: "Create release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: "Create release"
uses: softprops/action-gh-release@v1
id: create_release
with:
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build artifact for the release
package_compiled:
name: "Build packages"
needs: release
strategy:
matrix:
include:
- os: ubuntu-latest
asset_path: build/ftxui*Linux*
- os: macos-latest
asset_path: build/ftxui*Darwin*
- os: windows-latest
asset_path: build/ftxui*Win64*
runs-on: ${{ matrix.os }}
steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Install cmake"
uses: lukka/get-cmake@latest
- name: "Build packages"
run: >
mkdir build;
cd build;
cmake ..
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
-DFTXUI_BUILD_DOCS=OFF
-DFTXUI_BUILD_EXAMPLES=OFF
-DFTXUI_BUILD_TESTS=OFF
-DFTXUI_BUILD_TESTS_FUZZER=OFF
-DFTXUI_ENABLE_INSTALL=ON
-DFTXUI_DEV_WARNINGS=ON ;
cmake --build . --target package;
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true
# Build "source" artifact for the release. This is the same as the github
# "source" archive, but with a stable URL. This is useful for the Bazel
# Central Repository.
package_source:
name: "Build source package"
needs: release
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Create source package"
run: >
git archive --format=tar.gz -o source.tar.gz HEAD
- name: "Upload source package"
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: source.tar.gz
overwrite: true
documentation:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Install cmake"
uses: lukka/get-cmake@latest
- name: "Install emsdk"
uses: mymindstorm/setup-emsdk@v7
- name: "Install Doxygen/Graphviz"
run: >
sudo apt-get update;
sudo apt-get install doxygen graphviz;
- name: "Build documentation"
run: >
mkdir build;
cd build;
emcmake cmake ..
-DCMAKE_BUILD_TYPE=Release
-DFTXUI_BUILD_DOCS=ON
-DFTXUI_BUILD_EXAMPLES=ON
-DFTXUI_BUILD_TESTS=OFF
-DFTXUI_BUILD_TESTS_FUZZER=OFF
-DFTXUI_ENABLE_INSTALL=OFF
-DFTXUI_DEV_WARNINGS=ON ;
cmake --build . --target doc;
cmake --build . ;
rsync -amv
--include='*/'
--include='*.html'
--include='*.css'
--include='*.mjs'
--include='*.js'
--include='*.wasm'
--exclude='*'
examples
doc/doxygen/html;
- name: "Deploy"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/doc/doxygen/html/
enable_jekyll: false
allow_empty_commit: false
force_orphan: true
publish_branch: gh-pages

View File

@@ -12,10 +12,6 @@ jobs:
steps: steps:
- name: "Checkout repository" - name: "Checkout repository"
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Need full history.
fetch-tags: true # Need tags.
- name: "Install cmake" - name: "Install cmake"
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest
@@ -34,12 +30,7 @@ jobs:
sudo apt-get install graphviz; sudo apt-get install graphviz;
- name: "Build documentation" - name: "Build documentation"
run: |
python3 ./tools/build_multiversion_doc.py
- name: "Build examples"
run: > run: >
mkdir -p multiversion_docs/main/examples;
mkdir build; mkdir build;
cd build; cd build;
emcmake cmake .. emcmake cmake ..
@@ -50,7 +41,8 @@ jobs:
-DFTXUI_BUILD_TESTS_FUZZER=OFF -DFTXUI_BUILD_TESTS_FUZZER=OFF
-DFTXUI_ENABLE_INSTALL=OFF -DFTXUI_ENABLE_INSTALL=OFF
-DFTXUI_DEV_WARNINGS=OFF; -DFTXUI_DEV_WARNINGS=OFF;
cmake --build .; cmake --build . --target doc;
cmake --build . ;
rsync -amv rsync -amv
--include='*/' --include='*/'
--include='*.html' --include='*.html'
@@ -60,13 +52,13 @@ jobs:
--include='*.wasm' --include='*.wasm'
--exclude='*' --exclude='*'
examples examples
../multiversion_docs/ doc/doxygen/html;
- name: "Deploy" - name: "Deploy"
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: multiversion_docs publish_dir: build/doc/doxygen/html/
enable_jekyll: false enable_jekyll: false
allow_empty_commit: false allow_empty_commit: false
force_orphan: true force_orphan: true

9
.gitignore vendored
View File

@@ -24,12 +24,10 @@ out/
!BUILD.bazel !BUILD.bazel
!MODULE.bazel !MODULE.bazel
!.bazelrc !.bazelrc
!.bazelignore
# .github directory: # .github directory:
!.github/**/*.yaml !.github/**/*.yaml
!.github/**/*.yml !.github/**/*.yml
!.github/**/*.md
# cmake directory: # cmake directory:
!cmake/**/*.in !cmake/**/*.in
@@ -38,10 +36,6 @@ out/
# bazel directory: # bazel directory:
!bazel/**/*.bzl !bazel/**/*.bzl
!.bcr/* !.bcr/*
!bazel/test/*.bazel
!bazel/test/*.bazelrc
!bazel/test/*.cpp
!bazel/test/*.md
# doc directory: # doc directory:
!doc/**/Doxyfile.in !doc/**/Doxyfile.in
@@ -50,7 +44,6 @@ out/
!doc/**/*.html !doc/**/*.html
!doc/**/*.xml !doc/**/*.xml
!doc/**/*.md !doc/**/*.md
!doc/*.md
# examples directory: # examples directory:
!examples/**/*.cpp !examples/**/*.cpp
@@ -76,6 +69,4 @@ out/
# tools directory: # tools directory:
!tools/**/*.sh !tools/**/*.sh
!tools/**/*.py
!tools/**/*.cpp !tools/**/*.cpp
build/

View File

@@ -13,18 +13,16 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load(":bazel/ftxui.bzl", "ftxui_cc_library") load(":bazel/ftxui.bzl", "ftxui_cc_library")
load(":bazel/ftxui.bzl", "generate_examples") load(":bazel/ftxui.bzl", "generate_examples")
load(":bazel/ftxui.bzl", "windows_copts") load(":bazel/ftxui.bzl", "windows_copts")
load(":bazel/ftxui.bzl", "pthread_linkopts")
# A meta target depending on all of the ftxui submodules. # A meta target depending on all of the ftxui submodules.
# Note that component depends on dom and screen, so ftxui re-exports all headers. # Note that component depends on dom and screen, so ftxui is just an alias for
# component.
# ┌component──┐ # ┌component──┐
# │┌dom──────┐│ # │┌dom──────┐│
# ││┌screen─┐││ # ││┌screen─┐││
# └┴┴───────┴┴┘ # └┴┴───────┴┴┘
ftxui_cc_library( alias(name = "ftxui", actual = ":component")
name = "ftxui",
hdrs = glob(["include/ftxui/**/*.hpp"]),
deps = [":component"],
)
# @ftxui:screen is a module that provides a screen buffer and color management # @ftxui:screen is a module that provides a screen buffer and color management
# for terminal applications. A screen is a 2D array of cells, each cell can # for terminal applications. A screen is a 2D array of cells, each cell can
@@ -161,12 +159,6 @@ ftxui_cc_library(
"src/ftxui/component/resizable_split.cpp", "src/ftxui/component/resizable_split.cpp",
"src/ftxui/component/screen_interactive.cpp", "src/ftxui/component/screen_interactive.cpp",
"src/ftxui/component/slider.cpp", "src/ftxui/component/slider.cpp",
"src/ftxui/component/task.cpp",
"src/ftxui/component/task_internal.hpp",
"src/ftxui/component/task_queue.cpp",
"src/ftxui/component/task_queue.hpp",
"src/ftxui/component/task_runner.cpp",
"src/ftxui/component/task_runner.hpp",
"src/ftxui/component/terminal_input_parser.cpp", "src/ftxui/component/terminal_input_parser.cpp",
"src/ftxui/component/terminal_input_parser.hpp", "src/ftxui/component/terminal_input_parser.hpp",
"src/ftxui/component/util.cpp", "src/ftxui/component/util.cpp",
@@ -178,9 +170,6 @@ ftxui_cc_library(
# Private header from ftxui:screen. # Private header from ftxui:screen.
"src/ftxui/screen/string_internal.hpp", "src/ftxui/screen/string_internal.hpp",
"src/ftxui/screen/util.hpp", "src/ftxui/screen/util.hpp",
# Private header.
"include/ftxui/util/warn_windows_macro.hpp",
], ],
hdrs = [ hdrs = [
"include/ftxui/component/animation.hpp", "include/ftxui/component/animation.hpp",
@@ -195,6 +184,7 @@ ftxui_cc_library(
"include/ftxui/component/screen_interactive.hpp", "include/ftxui/component/screen_interactive.hpp",
"include/ftxui/component/task.hpp", "include/ftxui/component/task.hpp",
], ],
linkopts = pthread_linkopts(),
deps = [ deps = [
":dom", ":dom",
":screen", ":screen",
@@ -217,6 +207,7 @@ cc_test(
"src/ftxui/component/menu_test.cpp", "src/ftxui/component/menu_test.cpp",
"src/ftxui/component/modal_test.cpp", "src/ftxui/component/modal_test.cpp",
"src/ftxui/component/radiobox_test.cpp", "src/ftxui/component/radiobox_test.cpp",
"src/ftxui/component/receiver_test.cpp",
"src/ftxui/component/resizable_split_test.cpp", "src/ftxui/component/resizable_split_test.cpp",
"src/ftxui/component/slider_test.cpp", "src/ftxui/component/slider_test.cpp",
"src/ftxui/component/terminal_input_parser_test.cpp", "src/ftxui/component/terminal_input_parser_test.cpp",

View File

@@ -24,34 +24,7 @@ Next
import ftxui.util; import ftxui.util;
``` ```
Thanks @mikomikotaishi for PR #1015. Thanks @mikomikotaishi for PR #1015.
- Remove dependency on 'pthread'.
- Bugfix: Bazel target @ftxui is now visible. Thanks @dskkato in #1157.
### General
- Breaking. Move to `std::string_view` instead of `const std::string&` where
applicable. This yields better interoperability with string literals and
avoids unnecessary copies. Thanks @mikomikotaishi for PR #1154
### Component
- Feature: POSIX Piped Input Handling.
- Allows FTXUI applications to read data from stdin (when piped) while still receiving keyboard input from the terminal.
- Enabled by default.
- Can be disabled using `ScreenInteractive::HandlePipedInput(false)`.
- Only available on Linux and macOS.
Thanks @HarryPehkonen for PR #1094.
- Fix ScreenInteractive::FixedSize screen stomps on the preceding terminal
output. Thanks @zozowell in #1064.
- Fix vertical `ftxui::Slider`. The "up" key was previously decreasing the
value. Thanks @its-pablo in #1093 for reporting the issue.
- Fix Windows UTF-16 key input handling. Emoji and other code points outside the
Basic Multilingual Plane (BMP) are now correctly processed. Thanks @739C1AE2
in #1160 for fixing the issue.
### Dom
- Fix integer overflow in `ComputeShrinkHard`. Thanks @its-pablo in #1137 for
reporting and fixing the issue.
- Add specialization for `vbox/hbox/dbox` to allow a container of Element as
as input. Thanks @nbusser in #1117.
6.1.9 (2025-05-07) 6.1.9 (2025-05-07)
------------ ------------

View File

@@ -144,20 +144,26 @@ add_library(component
src/ftxui/component/resizable_split.cpp src/ftxui/component/resizable_split.cpp
src/ftxui/component/screen_interactive.cpp src/ftxui/component/screen_interactive.cpp
src/ftxui/component/slider.cpp src/ftxui/component/slider.cpp
src/ftxui/component/task.cpp
src/ftxui/component/task_internal.hpp
src/ftxui/component/task_queue.cpp
src/ftxui/component/task_queue.hpp
src/ftxui/component/task_runner.cpp
src/ftxui/component/task_runner.hpp
src/ftxui/component/terminal_input_parser.cpp src/ftxui/component/terminal_input_parser.cpp
src/ftxui/component/terminal_input_parser.hpp src/ftxui/component/terminal_input_parser.hpp
src/ftxui/component/util.cpp src/ftxui/component/util.cpp
src/ftxui/component/window.cpp src/ftxui/component/window.cpp
) )
target_link_libraries(dom PUBLIC screen) target_link_libraries(dom
target_link_libraries(component PUBLIC dom) PUBLIC screen
)
target_link_libraries(component
PUBLIC dom
)
if (NOT EMSCRIPTEN)
find_package(Threads)
target_link_libraries(component
PUBLIC Threads::Threads
)
endif()
include(cmake/ftxui_set_options.cmake) include(cmake/ftxui_set_options.cmake)
ftxui_set_options(screen) ftxui_set_options(screen)
@@ -178,8 +184,8 @@ include(cmake/ftxui_install.cmake)
include(cmake/ftxui_package.cmake) include(cmake/ftxui_package.cmake)
include(cmake/ftxui_modules.cmake) include(cmake/ftxui_modules.cmake)
add_subdirectory(examples)
add_subdirectory(doc) add_subdirectory(doc)
add_subdirectory(examples)
# You can generate ./examples_modules/ by running # You can generate ./examples_modules/ by running
# ./tools/generate_examples_modules.sh # ./tools/generate_examples_modules.sh

View File

@@ -1,4 +1,3 @@
<p align="center"> <p align="center">
<img src="https://github.com/ArthurSonzogni/FTXUI/assets/4759106/6925b6da-0a7e-49d9-883c-c890e1f36007" alt="Demo image"></img> <img src="https://github.com/ArthurSonzogni/FTXUI/assets/4759106/6925b6da-0a7e-49d9-883c-c890e1f36007" alt="Demo image"></img>
<br/> <br/>
@@ -19,16 +18,10 @@
<br/> <br/>
<a href="https://arthursonzogni.github.io/FTXUI/">Documentation</a> · <a href="https://arthursonzogni.github.io/FTXUI/">Documentation</a> ·
<a href="https://github.com/ArthurSonzogni/FTXUI/issues">Report a Bug</a> · <a href="https://github.com/ArthurSonzogni/FTXUI/issues">Report a Bug</a> ·
<a href="https://arthursonzogni.github.io/FTXUI/examples/">Examples</a> . <a href="https://arthursonzogni.github.io/FTXUI/examples.html">Examples</a> .
<a href="https://github.com/ArthurSonzogni/FTXUI/issues">Request Feature</a> · <a href="https://github.com/ArthurSonzogni/FTXUI/issues">Request Feature</a> ·
<a href="https://github.com/ArthurSonzogni/FTXUI/pulls">Send a Pull Request</a> <a href="https://github.com/ArthurSonzogni/FTXUI/pulls">Send a Pull Request</a>
<br/>
<a href="https://github.com/ArthurSonzogni/">English</a> |
<a href="https://github.com/ArthurSonzogni/ftxui-translations/tree/zh-CH">中文翻译</a> |
<a href="https://github.com/ArthurSonzogni/ftxui-translations/tree/zh-CH">繁體中文</a> |
<a href="https://github.com/ArthurSonzogni/ftxui-translations/tree/ja">日本語</a>
</p> </p>
# FTXUI # FTXUI
@@ -46,8 +39,8 @@ A simple cross-platform C++ library for terminal based user interfaces!
* Support for [UTF8](https://en.wikipedia.org/wiki/UTF-8) and [fullwidth chars](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) (→ 测试) * Support for [UTF8](https://en.wikipedia.org/wiki/UTF-8) and [fullwidth chars](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) (→ 测试)
* Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style) * Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style)
* Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated) * Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated)
* No dependencies. * No dependencies
* [C++20 Module support](https://arthursonzogni.github.io/FTXUI/cpp20-modules.html) * Module support
* **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!). * **Cross platform**: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!).
* Learn by [examples](#documentation), and [tutorials](#documentation) * Learn by [examples](#documentation), and [tutorials](#documentation)
* Multiple packages: * Multiple packages:
@@ -57,9 +50,7 @@ A simple cross-platform C++ library for terminal based user interfaces!
- [Conan](https://conan.io/center/recipes/ftxui) [Debian package](https://tracker.debian.org/pkg/ftxui) - [Conan](https://conan.io/center/recipes/ftxui) [Debian package](https://tracker.debian.org/pkg/ftxui)
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui) - [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui)
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/) - [Arch Linux](https://aur.archlinux.org/packages/ftxui/)
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui) - [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
- [XMake](https://xmake.io) repository [package](https://github.com/xmake-io/xmake-repo/blob/dev/packages/f/ftxui/xmake.lua)
- [Nix](https://github.com/ArthurSonzogni/FTXUI/blob/main/flake.nix)
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc... * Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
## Documentation ## Documentation
@@ -105,7 +96,7 @@ Element can be arranged together:
- inside a grid with `gridbox` - inside a grid with `gridbox`
- wrap along one direction using the `flexbox`. - wrap along one direction using the `flexbox`.
Element can become flexible using the `flex` decorator. Element can become flexible using the the `flex` decorator.
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2vbox_hbox_8cpp-example.html) using `hbox`, `vbox` and `filler`. [Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2vbox_hbox_8cpp-example.html) using `hbox`, `vbox` and `filler`.
@@ -369,9 +360,6 @@ Feel free to add your projects here:
- [FTB - tertminal file browser](https://github.com/Cyxuan0311/FTB) - [FTB - tertminal file browser](https://github.com/Cyxuan0311/FTB)
- [openJuice](https://github.com/mikomikotaishi/openJuice) - [openJuice](https://github.com/mikomikotaishi/openJuice)
- [SHOOT!](https://github.com/ShingZhanho/ENGG1340-Project-25Spring) - [SHOOT!](https://github.com/ShingZhanho/ENGG1340-Project-25Spring)
- [VerifySN (Fast Hash Tool)](https://github.com/d06i/verifySN)
- [tic-tac-toe](https://github.com/birland/tic-tac-toe)
- [typing-speed-test](https://github.com/ymcx/typing-speed-test)
### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam) ### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam)
@@ -388,8 +376,6 @@ Several games using the FTXUI have been made during the Game Jam:
- [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md) - [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md)
- [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md) - [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md)
## Build using CMake ## Build using CMake
It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on. It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on.
@@ -425,13 +411,9 @@ cc_binary(
name = "your_target", name = "your_target",
srcs = ["your_source.cc"], srcs = ["your_source.cc"],
deps = [ deps = [
# Choose submodules "@ftxui//:ftxui_component",
"@ftxui//:component", "@ftxui//:ftxui_dom",
"@ftxui//:dom", "@ftxui//:ftxui_screen",
"@ftxui//:screen",
# Or use the single ftxui target (includes all modules)
# "@ftxui//:ftxui",
], ],
) )
``` ```
@@ -447,7 +429,6 @@ If you don't, FTXUI may be used from the following packages:
- [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui), - [Ubuntu package](https://launchpad.net/ubuntu/+source/ftxui),
- [Arch Linux](https://aur.archlinux.org/packages/ftxui/), - [Arch Linux](https://aur.archlinux.org/packages/ftxui/),
- [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui), - [OpenSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui),
[Nix](https://github.com/ArthurSonzogni/FTXUI/blob/main/flake.nix),
[![Packaging status](https://repology.org/badge/vertical-allrepos/libftxui.svg)](https://repology.org/project/libftxui/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/libftxui.svg)](https://repology.org/project/libftxui/versions)
@@ -456,7 +437,7 @@ If you choose to build and link FTXUI yourself, `ftxui-component` must be first
g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . . g++ . . . -lftxui-component -lftxui-dom -lftxui-screen . . .
``` ```
To build FTXUI with modules, check [documentation](https://arthursonzogni.github.io/FTXUI/cpp20-modules.html) To build FTXUI with modules, ensure that you are using a generator like Ninja or Visual Studio that supports modules, and pass the flag `FTXUI_BUILD_MODULES`.
## Contributors ## Contributors

View File

@@ -43,6 +43,16 @@ def windows_copts():
"//conditions:default": [], "//conditions:default": [],
}) })
def pthread_linkopts():
return select({
# With MSVC, threading is already built-in (you don't need -pthread.
"@rules_cc//cc/compiler:msvc-cl": [],
"@rules_cc//cc/compiler:clang-cl": [],
"@rules_cc//cc/compiler:clang": ["-pthread"],
"@rules_cc//cc/compiler:gcc": ["-pthread"],
"//conditions:default": ["-pthread"],
})
def ftxui_cc_library( def ftxui_cc_library(
name, name,
srcs = [], srcs = [],

View File

@@ -1 +0,0 @@
../../.bazelrc

View File

@@ -1,23 +0,0 @@
# Copyright 2025 Arthur Sonzogni. All rights reserved.
# Use of this source code is governed by the MIT license that can be found in
# the LICENSE file.
# Test using individual submodules
cc_binary(
name = "smoke",
srcs = ["smoke.cpp"],
deps = [
"@ftxui//:component",
"@ftxui//:dom",
"@ftxui//:screen",
],
)
# Test using the single ftxui target
cc_binary(
name = "smoke_single_dependency",
srcs = ["smoke.cpp"],
deps = [
"@ftxui",
],
)

View File

@@ -1,9 +0,0 @@
# Copyright 2025 Arthur Sonzogni. All rights reserved.
# Use of this source code is governed by the MIT license that can be found in
# the LICENSE file.
module(
name = "ftxui_integration_test",
version = "0.0.1",
)
bazel_dep(name = "ftxui", version = "6.1.9")

View File

@@ -1,38 +0,0 @@
# FTXUI Bazel Integration Test
This directory contains integration tests to verify that FTXUI can be properly consumed as an external dependency using Bazel with Bzlmod.
## Purpose
These tests ensure that:
- FTXUI's public API is correctly exposed to external projects
- Both single-target (`@ftxui//:ftxui`) and submodule-based dependencies work correctly
- Headers are properly re-exported and accessible from downstream projects
## Build Instructions
To build all targets:
```bash
bazel build //... --enable_bzlmod --override_module=ftxui=../..
```
To build individual targets:
```bash
# Test using individual submodules
bazel build //:smoke --enable_bzlmod --override_module=ftxui=../..
# Test using the single ftxui target
bazel build //:smoke_single_dependency --enable_bzlmod --override_module=ftxui=../..
```
## Run the Examples
```bash
# Run the submodules version
./bazel-bin/smoke
# Run the single-target version
./bazel-bin/smoke_single_dependency
```

View File

@@ -1,4 +0,0 @@
# Copyright 2025 Arthur Sonzogni. All rights reserved.
# Use of this source code is governed by the MIT license that can be found in
# the LICENSE file.
workspace(name = "ftxui_smoke_test")

View File

@@ -1,16 +0,0 @@
// Copyright 2025 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp>
int main() {
using namespace ftxui;
auto screen = ScreenInteractive::TerminalOutput();
auto component = Button("Quit", screen.ExitLoopClosure());
screen.Loop(component);
return 0;
}

View File

@@ -13,7 +13,7 @@ include(FetchContent)
FetchContent_Declare(googletest FetchContent_Declare(googletest
GIT_REPOSITORY "https://github.com/google/googletest" GIT_REPOSITORY "https://github.com/google/googletest"
GIT_TAG 52eb8108c5bdec04579160ae17225d66034bd723 # v1.17.0 GIT_TAG 23ef29555ef4789f555f1ba8c51b4c52975f0907
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
) )

View File

@@ -11,9 +11,6 @@ include(CMakePackageConfigHelpers)
install( install(
TARGETS screen dom component TARGETS screen dom component
EXPORT ftxui-targets EXPORT ftxui-targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
) )
install( install(

View File

@@ -6,78 +6,76 @@ add_library(ftxui-modules)
target_sources(ftxui-modules target_sources(ftxui-modules
PUBLIC FILE_SET CXX_MODULES FILES PUBLIC FILE_SET CXX_MODULES FILES
src/ftxui/ftxui.cppm
src/ftxui/component.cppm src/ftxui/component.cppm
src/ftxui/component/animation.cppm src/ftxui/component/Animation.cppm
src/ftxui/component/captured_mouse.cppm src/ftxui/component/CapturedMouse.cppm
src/ftxui/component/component.cppm src/ftxui/component/Component.cppm
src/ftxui/component/component_base.cppm src/ftxui/component/ComponentBase.cppm
src/ftxui/component/component_options.cppm src/ftxui/component/ComponentOptions.cppm
src/ftxui/component/event.cppm src/ftxui/component/Event.cppm
src/ftxui/component/loop.cppm src/ftxui/component/Loop.cppm
src/ftxui/component/mouse.cppm src/ftxui/component/Mouse.cppm
src/ftxui/component/receiver.cppm src/ftxui/component/Receiver.cppm
src/ftxui/component/screen_interactive.cppm src/ftxui/component/ScreenInteractive.cppm
src/ftxui/component/task.cppm src/ftxui/component/Task.cppm
src/ftxui/dom.cppm src/ftxui/dom.cppm
src/ftxui/dom/canvas.cppm src/ftxui/dom/Canvas.cppm
src/ftxui/dom/deprecated.cppm src/ftxui/dom/Deprecated.cppm
src/ftxui/dom/direction.cppm src/ftxui/dom/Direction.cppm
src/ftxui/dom/elements.cppm src/ftxui/dom/Elements.cppm
src/ftxui/dom/flexbox_config.cppm src/ftxui/dom/FlexboxConfig.cppm
src/ftxui/dom/linear_gradient.cppm src/ftxui/dom/LinearGradient.cppm
src/ftxui/dom/node.cppm src/ftxui/dom/Node.cppm
src/ftxui/dom/requirement.cppm src/ftxui/dom/Requirement.cppm
src/ftxui/dom/selection.cppm src/ftxui/dom/Selection.cppm
src/ftxui/dom/table.cppm src/ftxui/dom/Table.cppm
src/ftxui/screen.cppm src/ftxui/screen.cppm
src/ftxui/screen/box.cppm src/ftxui/screen/Box.cppm
src/ftxui/screen/color.cppm src/ftxui/screen/Color.cppm
src/ftxui/screen/color_info.cppm src/ftxui/screen/ColorInfo.cppm
src/ftxui/screen/deprecated.cppm src/ftxui/screen/Deprecated.cppm
src/ftxui/screen/image.cppm src/ftxui/screen/Image.cppm
src/ftxui/screen/pixel.cppm src/ftxui/screen/Pixel.cppm
src/ftxui/screen/screen.cppm src/ftxui/screen/Screen.cppm
src/ftxui/screen/string.cppm src/ftxui/screen/String.cppm
src/ftxui/screen/terminal.cppm src/ftxui/screen/Terminal.cppm
src/ftxui/util.cppm src/ftxui/util.cppm
src/ftxui/util/autoreset.cppm src/ftxui/util/AutoReset.cppm
src/ftxui/util/ref.cppm src/ftxui/util/Ref.cppm
) )
target_link_libraries(ftxui-modules target_link_libraries(ftxui-modules
PUBLIC PUBLIC
ftxui::screen ftxui::screen
ftxui::dom ftxui::dom
ftxui::component ftxui::component
) )
target_compile_features(ftxui-modules PUBLIC cxx_std_20) target_compile_features(ftxui-modules PUBLIC cxx_std_20)
# TODO: Explain why this is needed.
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(ftxui-modules PUBLIC -fmodules-ts) target_compile_options(${name} PUBLIC -fmodules-ts)
endif () endif ()
add_library(ftxui::modules ALIAS ftxui-modules) add_library(ftxui::modules ALIAS ftxui-modules)
if(FTXUI_ENABLE_INSTALL) if(FTXUI_ENABLE_INSTALL)
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS ftxui-modules install(TARGETS ftxui-modules
EXPORT ftxui-targets EXPORT ftxui-targets
FILE_SET CXX_MODULES FILE_SET CXX_MODULES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
FILE_SET HEADERS FILE_SET HEADERS
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
INCLUDES INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ftxui
) )
install(EXPORT ftxui-targets install(EXPORT ftxui-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
CXX_MODULES_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui CXX_MODULES_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
) )
install(FILES my_package-config.cmake install(FILES my_package-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
) )
endif() endif()

View File

@@ -101,5 +101,6 @@ endfunction()
if (EMSCRIPTEN) if (EMSCRIPTEN)
string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS") string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ASYNCIFY")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s PROXY_TO_PTHREAD") string(APPEND CMAKE_EXE_LINKER_FLAGS " -s PROXY_TO_PTHREAD")
endif() endif()

View File

@@ -19,10 +19,11 @@ add_executable(ftxui-tests
src/ftxui/component/menu_test.cpp src/ftxui/component/menu_test.cpp
src/ftxui/component/modal_test.cpp src/ftxui/component/modal_test.cpp
src/ftxui/component/radiobox_test.cpp src/ftxui/component/radiobox_test.cpp
src/ftxui/util/ref_test.cpp
src/ftxui/component/receiver_test.cpp
src/ftxui/component/resizable_split_test.cpp src/ftxui/component/resizable_split_test.cpp
src/ftxui/component/screen_interactive_test.cpp src/ftxui/component/screen_interactive_test.cpp
src/ftxui/component/slider_test.cpp src/ftxui/component/slider_test.cpp
src/ftxui/component/task_test.cpp
src/ftxui/component/terminal_input_parser_test.cpp src/ftxui/component/terminal_input_parser_test.cpp
src/ftxui/component/toggle_test.cpp src/ftxui/component/toggle_test.cpp
src/ftxui/dom/blink_test.cpp src/ftxui/dom/blink_test.cpp
@@ -50,7 +51,6 @@ add_executable(ftxui-tests
src/ftxui/dom/vbox_test.cpp src/ftxui/dom/vbox_test.cpp
src/ftxui/screen/color_test.cpp src/ftxui/screen/color_test.cpp
src/ftxui/screen/string_test.cpp src/ftxui/screen/string_test.cpp
src/ftxui/util/ref_test.cpp
) )
target_link_libraries(ftxui-tests target_link_libraries(ftxui-tests

View File

@@ -35,26 +35,16 @@ foreach(example IN LISTS EXAMPLES)
endforeach() endforeach()
macro(write_example_list file title page examples) macro(write_example_list file title page examples)
file(WRITE "${file}" "@page ${page} ${title}\n") file(APPEND "${file}" "@page ${page} ${title}\n")
file(APPEND "${file}" "@tableofcontents\n") file(APPEND "${file}" "@tableofcontents\n")
foreach(example IN LISTS ${examples}) foreach(example IN LISTS ${examples})
get_filename_component(name "${example}" NAME_WE) get_filename_component(name "${example}" NAME_WE)
file(APPEND "${file}" "# ${name}\n") file(APPEND "${file}" "# ${name}\n")
# Add a markdown to the demo. URL example:
# https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated
file(APPEND "${file}" "[Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=${example})\n")
file(APPEND "${file}" "@include examples/${example}.cpp\n") file(APPEND "${file}" "@include examples/${example}.cpp\n")
file(APPEND "${file}" "\n")
endforeach()
# Reference to the examples
foreach(example IN LISTS ${examples})
get_filename_component(name "${example}" NAME_WE)
file(APPEND "${file}" "@example examples/${example}.cpp\n") file(APPEND "${file}" "@example examples/${example}.cpp\n")
endforeach() endforeach()
endmacro() endmacro()
write_example_list("${CMAKE_CURRENT_BINARY_DIR}/dom_examples.md" write_example_list("${CMAKE_CURRENT_BINARY_DIR}/dom_examples.md"

View File

@@ -157,7 +157,7 @@ ABBREVIATE_BRIEF = "The $name class" \
# description. # description.
# The default value is: NO. # The default value is: NO.
ALWAYS_DETAILED_SEC = YES ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those # inherited members of a class in the documentation of that class as if those
@@ -285,8 +285,6 @@ TAB_SIZE = 2
# @} or use a double escape (\\{ and \\}) # @} or use a double escape (\\{ and \\})
ALIASES = ALIASES =
ALIASES += iframe{1}="<div class=\"iframe-wrapper\"><iframe src='\1' width='100%' height='400' frameborder='0' allowfullscreen></iframe></div>"
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For # only. Doxygen will then generate output that is more tailored for C. For
@@ -294,7 +292,7 @@ ALIASES += iframe{1}="<div class=\"iframe-wrapper\"><iframe src='\1' width='100%
# members will be omitted, etc. # members will be omitted, etc.
# The default value is: NO. # The default value is: NO.
OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored # Python sources only. Doxygen will then generate output that is more tailored
@@ -345,8 +343,7 @@ OPTIMIZE_OUTPUT_SLICE = NO
# #
# Note see also the list of default file extension mappings. # Note see also the list of default file extension mappings.
EXTENSION_MAPPING = EXTENSION_MAPPING = md=Markdown
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable # according to the Markdown format, which allows for more readable
@@ -365,7 +362,7 @@ MARKDOWN_SUPPORT = YES
# Minimum value: 0, maximum value: 99, default value: 5. # Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 5 TOC_INCLUDE_HEADINGS = 3
# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to # The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to
# generate identifiers for the Markdown headings. Note: Every identifier is # generate identifiers for the Markdown headings. Note: Every identifier is
@@ -376,7 +373,7 @@ TOC_INCLUDE_HEADINGS = 5
# The default value is: DOXYGEN. # The default value is: DOXYGEN.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
MARKDOWN_ID_STYLE = GITHUB MARKDOWN_ID_STYLE = DOXYGEN
# When enabled doxygen tries to link words that correspond to documented # When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can # classes, or namespaces to their corresponding documentation. Such a link can
@@ -400,7 +397,7 @@ BUILTIN_STL_SUPPORT = YES
# enable parsing support. # enable parsing support.
# The default value is: NO. # The default value is: NO.
CPP_CLI_SUPPORT = NO CPP_CLI_SUPPORT = YES
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
@@ -418,7 +415,7 @@ SIP_SUPPORT = NO
# should set this option to NO. # should set this option to NO.
# The default value is: YES. # The default value is: YES.
IDL_PROPERTY_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES then doxygen will reuse the documentation of the first # tag is set to YES then doxygen will reuse the documentation of the first
@@ -474,7 +471,7 @@ INLINE_SIMPLE_STRUCTS = NO
# types are typedef'ed and only the typedef is referenced, never the tag name. # types are typedef'ed and only the typedef is referenced, never the tag name.
# The default value is: NO. # The default value is: NO.
TYPEDEF_HIDES_STRUCT = YES TYPEDEF_HIDES_STRUCT = NO
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
# cache is used to resolve symbols given their name and scope. Since this can be # cache is used to resolve symbols given their name and scope. Since this can be
@@ -500,7 +497,7 @@ LOOKUP_CACHE_SIZE = 0
# DOT_NUM_THREADS setting. # DOT_NUM_THREADS setting.
# Minimum value: 0, maximum value: 32, default value: 1. # Minimum value: 0, maximum value: 32, default value: 1.
NUM_PROC_THREADS = 4 NUM_PROC_THREADS = 1
# If the TIMESTAMP tag is set different from NO then each generated page will # If the TIMESTAMP tag is set different from NO then each generated page will
# contain the date or date and time when the page was generated. Setting this to # contain the date or date and time when the page was generated. Setting this to
@@ -819,7 +816,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty. # tag is left empty.
LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_layout.xml
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing # The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib # the reference definitions. This must be a list of .bib files. The .bib
@@ -952,13 +949,11 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/getting-started.md \ @CMAKE_CURRENT_SOURCE_DIR@/getting-started.md \
@CMAKE_CURRENT_SOURCE_DIR@/installation.md \ @CMAKE_CURRENT_SOURCE_DIR@/installation.md \
@CMAKE_CURRENT_SOURCE_DIR@/module.md \ @CMAKE_CURRENT_SOURCE_DIR@/module.md \
@CMAKE_CURRENT_SOURCE_DIR@/module-screen.md \
@CMAKE_CURRENT_SOURCE_DIR@/module-dom.md \
@CMAKE_CURRENT_SOURCE_DIR@/module-component.md \
@CMAKE_CURRENT_SOURCE_DIR@ \ @CMAKE_CURRENT_SOURCE_DIR@ \
@CMAKE_SOURCE_DIR@/include \ @CMAKE_SOURCE_DIR@/include \
@CMAKE_SOURCE_DIR@/src \ @CMAKE_SOURCE_DIR@/src \
@CMAKE_CURRENT_BINARY_DIR@ \ @CMAKE_CURRENT_BINARY_DIR@ \
@CMAKE_SOURCE_DIR@/CHANGELOG.md \
@CMAKE_SOURCE_DIR@/examples \ @CMAKE_SOURCE_DIR@/examples \
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
@@ -1001,12 +996,48 @@ INPUT_FILE_ENCODING =
FILE_PATTERNS = *.c \ FILE_PATTERNS = *.c \
*.cc \ *.cc \
*.cxx \
*.cpp \ *.cpp \
*.c++ \
*.java \
*.ii \
*.ixx \
*.ipp \ *.ipp \
*.i++ \
*.inl \
*.idl \
*.ddl \
*.odl \
*.h \ *.h \
*.hh \
*.hxx \
*.hpp \ *.hpp \
*.h++ \
*.cs \
*.d \
*.php \
*.php4 \
*.php5 \
*.phtml \
*.inc \
*.m \
*.markdown \
*.md \ *.md \
*.cppm \ *.mm \
*.dox \
*.py \
*.pyw \
*.f90 \
*.f95 \
*.f03 \
*.f08 \
*.f \
*.for \
*.tcl \
*.vhd \
*.vhdl \
*.ucf \
*.qsf
# The RECURSIVE tag can be used to specify whether or not subdirectories should # The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well. # be searched for input files as well.
@@ -1135,7 +1166,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub # (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output. # and want to reuse the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/introduction.md USE_MDFILE_AS_MAINPAGE = introduction.md
# The Fortran standard specifies that for fixed formatted Fortran code all # The Fortran standard specifies that for fixed formatted Fortran code all
# characters from position 72 are to be considered as comment. A common # characters from position 72 are to be considered as comment. A common
@@ -1241,7 +1272,7 @@ VERBATIM_HEADERS = YES
# classes, structs, unions or interfaces. # classes, structs, unions or interfaces.
# The default value is: YES. # The default value is: YES.
ALPHABETICAL_INDEX = NO ALPHABETICAL_INDEX = YES
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# that should be ignored while generating the index headers. The IGNORE_PREFIX # that should be ignored while generating the index headers. The IGNORE_PREFIX
@@ -1694,7 +1725,7 @@ FULL_SIDEBAR = YES
# Minimum value: 0, maximum value: 20, default value: 4. # Minimum value: 0, maximum value: 20, default value: 4.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
ENUM_VALUES_PER_LINE = 1 ENUM_VALUES_PER_LINE = 4
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
# to set the initial width (in pixels) of the frame in which the tree is shown. # to set the initial width (in pixels) of the frame in which the tree is shown.
@@ -2196,7 +2227,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation. # captures the structure of the code including all documentation.
# The default value is: NO. # The default value is: NO.
GENERATE_XML = NO GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -2529,7 +2560,7 @@ CLASS_GRAPH = YES
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
COLLABORATION_GRAPH = NO COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
# groups, showing the direct groups dependencies. Explicit enabling a group # groups, showing the direct groups dependencies. Explicit enabling a group
@@ -2614,7 +2645,7 @@ INCLUDE_GRAPH = NO
# The default value is: YES. # The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
INCLUDED_BY_GRAPH = NO INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call # If the CALL_GRAPH tag is set to YES then doxygen will generate a call
# dependency graph for every global function or class method. # dependency graph for every global function or class method.

View File

@@ -1,271 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.12.0 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="no" title=""/>
<tab type="pages" visible="yes" title="Pages" intro=""/>
<tab type="topics" visible="yes" title="Reference" intro=""/>
<tab type="modules" visible="yes" title="" intro="">
<tab type="modulelist" visible="yes" title="" intro=""/>
<tab type="modulemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="concepts" visible="yes" title="">
</tab>
<tab type="interfaces" visible="yes" title="">
<tab type="interfacelist" visible="yes" title="" intro=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="structs" visible="yes" title="">
<tab type="structlist" visible="yes" title="" intro=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
</tab>
<tab type="exceptions" visible="yes" title="">
<tab type="exceptionlist" visible="yes" title="" intro=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_HEADERFILE"/>
<inheritancegraph visible="yes"/>
<collaborationgraph visible="yes"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<concepts visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a concept page -->
<concept>
<briefdescription visible="yes"/>
<includes visible="$SHOW_HEADERFILE"/>
<definition visible="yes" title=""/>
<detaileddescription title=""/>
<authorsection visible="yes"/>
</concept>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="yes"/>
<includedbygraph visible="yes"/>
<sourcelink visible="yes"/>
<memberdecl>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<properties title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="no"/>
<authorsection visible="no"/>
<detaileddescription title=""/>
<groupgraph visible="yes"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<modules visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
</group>
<!-- Layout definition for a C++20 module page -->
<module>
<briefdescription visible="yes"/>
<exportedmodules visible="yes"/>
<memberdecl>
<concepts visible="yes" title=""/>
<classes visible="yes" title=""/>
<enums title=""/>
<typedefs title=""/>
<functions title=""/>
<variables title=""/>
<membergroups title=""/>
</memberdecl>
<detaileddescription title=""/>
<memberdecl>
<files visible="yes"/>
</memberdecl>
</module>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>

View File

@@ -1,78 +0,0 @@
@page cpp20-modules C++20 Modules
> [!WARNING]
> This feature is still in development, and the API may change in future releases.
> Your contribution is needed to help us improve the compatibility and usability
> of C++ modules in FTXUI. If you encounter any issues or have suggestions,
> please open an issue.
FTXUI experimentally supports
[C++20 modules](https://en.cppreference.com/w/cpp/language/modules) to reduce
compilation times and improve code organization. Each part of the library has a
corresponding module, split into partitions per each header.
Use the FTXUI_BUILD_MODULES option to build the FTXUI project itself to provide C++20 modules,
for example with CMake and Ninja:
```sh
cmake \
-DCMAKE_GENERATOR=Ninja \
-DFTXUI_BUILD_MODULES=ON \
..
ninja
```
> [!NOTE]
> To use modules, you need a C++≥20 compatible compiler, CMake version 3.20 or
> higher, and use a compatible generator like Ninja. Note that Makefile
> generators **do not support modules**.
Then, in your own code you can consume the modules and code as normal:
```cpp
import ftxui;
using ftxui::Button;
using ftxui::ScreenInteractive;
int main() {
auto screen = ScreenInteractive::TerminalOutput();
auto button = Button("Click me", screen.QuitClosure());
screen.Loop(button);
return 0;
}
```
Note, the `ftxui` convenience module which simply pulls together all the modules:
```cpp
export import ftxui.component;
export import ftxui.dom;
export import ftxui.screen;
export import ftxui.util;
```
You can instead import only the module(s) you need if desired.
To properly find and link the modules with CMake, use `target_link_libraries` to get the right
compiler, linker, etc. flags.
```cmake
target_link_libraries(my_executable
#...whatever...
PRIVATE ftxui::modules
)
```
### Module list
The modules directly reference the corresponding header, or a group of related
headers to provide a more convenient interface. The following modules
are available:
- `ftxui`
- `ftxui.component`
- `ftxui.dom`
- `ftxui.screen`
- `ftxui.util`

View File

@@ -2,9 +2,16 @@
<!-- start footer part --> <!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW--> <!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby <a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div> </div>
<!--END GENERATE_TREEVIEW--> <!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW--> <!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW--> <!--END !GENERATE_TREEVIEW-->
</body> </body>
</html> </html>

View File

@@ -20,129 +20,32 @@
<script type="text/javascript" src="$relpath^doxygen-awesome-paragraph-link.js"></script> <script type="text/javascript" src="$relpath^doxygen-awesome-paragraph-link.js"></script>
<script type="text/javascript" src="$relpath^doxygen-awesome-interactive-toc.js"></script> <script type="text/javascript" src="$relpath^doxygen-awesome-interactive-toc.js"></script>
<script type="text/javascript" src="$relpath^doxygen-awesome-tabs.js"></script> <script type="text/javascript" src="$relpath^doxygen-awesome-tabs.js"></script>
<script type="module"> <script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init() DoxygenAwesomeFragmentCopyButton.init()
DoxygenAwesomeParagraphLink.init() DoxygenAwesomeParagraphLink.init()
DoxygenAwesomeInteractiveToc.init() DoxygenAwesomeInteractiveToc.init()
DoxygenAwesomeTabs.init() DoxygenAwesomeTabs.init()
await new Promise(r => window.addEventListener('DOMContentLoaded', r)); window.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll(".headertitle").forEach(div => {
// Remove title when a img[alt='title-img'] is present. // Hide progressively the title.
// Find an image with the alt "img-title". if (div.textContent != "Getting Started" &&
const img = document.querySelector("img[alt='title-img']"); div.textContent != "Installation" &&
const header = document.querySelector(".headertitle"); div.textContent != "Modules" &&
true) {
return;
}
div.style.display = "none";
if (img && header) { // Show progressively the image.
// Hide the header title progressively. const img = document.querySelector("img.inline");
header.style.display = "none"; img.style.maxHeight = "40vh";
img.style.maxWidth = "100%";
// Show progressively the image. img.style.objectFit = "contain";
img.style.maxHeight = "40vh"; });
img.style.maxWidth = "100%";
img.style.objectFit = "contain";
}
// In the "examples.html" page. Turn every link with text
// "examples/<...>
//
// Add a "demo" link toward.
// https://arthursonzogni.github.io/FTXUI/examples/?file=<...>
const examples = document.querySelectorAll("a")
examples.forEach((example) => {
if (!example.textContent.startsWith("examples/")) {
return;
}
// Remove the ".cpp" extension from the example name.
const exampleName = example.textContent.replace("examples/", "").replace(".cpp", "");
const a = document.createElement("a");
a.textContent = "[demo]";
a.href = "https://arthursonzogni.github.io/FTXUI/examples/?file=" + exampleName;
a.style.marginRight= "1em";
a.style.fontWeight = "bold";
example.parentElement.insertBefore(a, example)
}); });
// If the current URL ends with -example.html, we can add a link to the demo
// as well using the div.title textContent.
const url = new URL(window.location.href);
if (url.pathname.endsWith("-example.html")) {
// Get the title text.
const title = document.querySelector("div.title").textContent;
const example = title.replace("examples/", "").replace(".cpp", "");
// Create a link to the demo.
const a = document.createElement("a");
a.textContent = "[demo]";
a.href = "https://arthursonzogni.github.io/FTXUI/examples/?file=" + example;
a.style.marginLeft = "1em";
a.style.fontWeight = "bold";
a.style.display = "inline-block";
// Insert the link after the title.
const titleDiv = document.querySelector("div.title");
if (titleDiv) {
titleDiv.insertBefore(a, titleDiv.nextSibling);
}
}
</script> </script>
<script type="module">
// Ignore non english pages and/or the main page.
const excluded_lang = [
"/de",
"/es",
"/fr",
"/it",
"/ja",
"/ja",
"/ko"
"/ru",
"/zh-CH",
"/zh-TW",
]
if (excluded_lang.some(lang => window.location.pathname.startsWith(lang)) ||
window.location.pathname.endsWith("index.html")) {
return;
}
// Click on the navtree, except for the main page where this is already done
// automatically.
let delay = 0;
while(true) {
const navtree = document.querySelector("div.item.selected");
if (!navtree) {
delay *= 2;
delay += 1;
await new Promise(resolve => setTimeout(resolve, delay));
continue;
}
// Include only selected navtree items.
console.log("navtree.textContent", navtree.textContent);
if (!navtree.textContent.includes("Getting Started") &&
!navtree.textContent.includes("Installation") &&
!navtree.textContent.includes("ftxui / screen") &&
!navtree.textContent.includes("ftxui / dom") &&
!navtree.textContent.includes("ftxui / component") &&
!navtree.textContent.includes("Reference")) {
break;
}
// Find the first link inside the navtree.
const link = navtree.querySelector("a");
if (link) {
// Simulate a click on the link.
link.click();
break;
}
}
</script>
$treeview $treeview
$search $search
$mathjax $mathjax

View File

@@ -16,11 +16,6 @@ This page serves as an entry point for the available integration methods.
- @subpage installation_vcpkg - @subpage installation_vcpkg
- @subpage installation_conan - @subpage installation_conan
- @subpage installation_manual - @subpage installation_manual
- @subpage installation_nix
- @subpage installation_debian
- @subpage installation_arch
- @subpage installation_opensuse
- @subpage installation_xmake
## Next Steps ## Next Steps

View File

@@ -1,34 +0,0 @@
@page installation_arch Arch Linux
FTXUI is packaged on the AUR. Install using an AUR helper:
```bash
yay -S ftxui
```
You can also manually download the PKGBUILD from <https://aur.archlinux.org/packages/ftxui>.
Once installed, you can use it in your CMake projects by adding the following to your `CMakeLists.txt`:
```cmake
find_package(ftxui REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
```
> [!note]
> This is an unofficial package. That means it is not maintained by the FTXUI
> team, but by the community. The package maintainers seems to actively update
> the package to the latest version. Thanks to the maintainers for their work!
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -10,7 +10,7 @@ This page explains how to depend on FTXUI using [CMake](https://cmake.org).
This approach downloads FTXUI at configure time and doesn't require a system-wide install. This approach downloads FTXUI at configure time and doesn't require a system-wide install.
```cmake ```fortran
include(FetchContent) include(FetchContent)
FetchContent_Declare(ftxui FetchContent_Declare(ftxui
@@ -34,8 +34,8 @@ This ensures reproducible builds and easy dependency management.
If FTXUI is installed system-wide or via a package manager (e.g. vcpkg or Conan), you can use: If FTXUI is installed system-wide or via a package manager (e.g. vcpkg or Conan), you can use:
```cmake ```fortran
find_package(ftxui REQUIRED) fortranind_package(ftxui REQUIRED)
add_executable(main main.cpp) add_executable(main main.cpp)
target_link_libraries(main target_link_libraries(main
@@ -51,7 +51,7 @@ Make sure the package is visible in your `CMAKE_PREFIX_PATH`.
You can also add FTXUI as a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules), keeping it as part of your repository: You can also add FTXUI as a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules), keeping it as part of your repository:
```cmake ```fortran
git submodule add https://github.com/ArthurSonzogni/FTXUI external/ftxui git submodule add https://github.com/ArthurSonzogni/FTXUI external/ftxui
git submodule update --init --recursive git submodule update --init --recursive
``` ```
@@ -66,7 +66,7 @@ git submodule update --init --recursive
Then in your `CMakeLists.txt`: Then in your `CMakeLists.txt`:
```cmake ```fortran
add_subdirectory(external/ftxui) add_subdirectory(external/ftxui)
add_executable(main main.cpp) add_executable(main main.cpp)

View File

@@ -1,99 +1,15 @@
@page installation_conan Conan @page installation_conan Conan
@tableofcontents @tableofcontents
FTXUI can be easily obtained and integrated into your project using the Conan package manager. ## Conan Package
## Prerequisites Unofficial support for FTXUI exists on Conan Center:
First, ensure that Conan is installed on your system. If not, you can install it via pip: - https://conan.io/center/recipes/ftxui
```powershell ## TODO
pip install conan
```
Conan often works in tandem with CMake, so you will need to have CMake installed as well. Once you have confirmed both Conan and CMake are installed, create a project directory, for example, `ftxui-demo`:
```powershell This page is incomplete. If you use FTXUI with Conan and can provide a minimal working setup, feel free to contribute.
mkdir C:\ftxui-demo
cd C:\ftxui-demo
```
## Configuration
After ensuring your environment is set up correctly, create a Conan configuration file `conanfile.txt`. This file is used to declare your project's dependencies. The community-maintained package for FTXUI can be found on [Conan Center](https://conan.io/center/recipes/ftxui).
> [!note]
> This is an unofficial build script. This means it is not maintained by the FTXUI
> team but by the community. The package maintainer appears to actively update it
> to the latest releases. Many thanks to the maintainer for their work!
@todo If you are familiar with the process, please consider adding an "official" build script to Conan Center.
This could be a GitHub Action that automatically updates Conan Center upon new releases.
```ini
[requires]
ftxui/6.0.2
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout
```
## Install Dependencies and Build
Once configured, run the following command to install FTXUI and its dependencies:
```powershell
conan install . --output-folder=build --build=missing
```
This will download and install `ftxui/6.0.2` along with all its dependencies from Conan's remote repositories.
After the installation completes, you can test it by creating a `demo.cpp` file in your project directory:
```cpp
#include <ftxui/screen/screen.hpp>
#include <ftxui/dom/elements.hpp>
#include <iostream>
int main() {
using namespace ftxui;
auto document = hbox({
text(" Hello "),
text("FTXUI ") | bold | color(Color::Red),
text(" world! ")
});
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << screen.ToString() << std::endl;
return 0;
}
```
If the test is successful, you can then create a `CMakeLists.txt` file in the project directory:
```cmake
cmake_minimum_required(VERSION 3.20)
project(ftxui-demo)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 20)
# Find the FTXUI package installed via Conan
find_package(ftxui CONFIG REQUIRED)
# Create the executable
add_executable(demo demo.cpp)
# Link the executable to the FTXUI library
target_link_libraries(demo PRIVATE ftxui::component)
```
@todo 中国大陆在这方面的下载可能会受限制,需要一个替代的方案
---
<div class="section_buttons"> <div class="section_buttons">

View File

@@ -1,42 +0,0 @@
@page installation_debian Debian/Ubuntu
## Debian and Ubuntu Packages (Unofficial)
Pre-built packages are provided by the distributions. Install with:
```bash
sudo apt install libftxui-dev
```
The following packages are available:
- `ftxui-doc`
- `ftxui-examples`
- `libftxui-component<version>`
- `libftxui-dev`
- `libftxui-dom<version>`
- `libftxui-screen<version>`
Once installed, you can use it in your CMake projects by adding the following to
your `CMakeLists.txt`:
```cmake
find_package(ftxui REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
```
> [!note]
> This is an **unofficial** package. That means it is not maintained by the FTXUI
> team, but by the community.
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -1,35 +0,0 @@
@page installation_manual Manual
@tableofcontents
## Building from Source (Official)
Clone and build the project using CMake:
```bash
git clone https://github.com/ArthurSonzogni/FTXUI.git
cd FTXUI
cmake -S . -B build -D FTXUI_ENABLE_INSTALL=ON
cmake --build build -j
sudo cmake --install build
```
Once installed you can use it in your CMake projects by adding the following to your `CMakeLists.txt`:
```cmake
find_package(ftxui REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
```
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -1,38 +0,0 @@
@page installation_nix Nix
> [!note]
> FTXUI author is not very knowledgeable about Nix. This page has been mostly
> generated by AI. If you have any suggestions to improve it, please open a
> PR.
## Nix Flake
FTXUI ships with a `flake.nix` providing both packages and a development shell.
### Build the Library
```bash
nix build github:ArthurSonzogni/FTXUI
```
The resulting package is accessible via the `result` link.
### Use as a Dependency
Add FTXUI to your flake inputs:
```nix
{
inputs.ftxui.url = "github:ArthurSonzogni/FTXUI";
}
```
Then reference `ftxui.packages.<system>.ftxui` in your outputs.
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -1,32 +0,0 @@
@page installation_opensuse openSUSE
## openSUSE Package (Unofficial)
FTXUI seems to be available from the `devel:libraries:c_c++` repository.
```bash
sudo zypper addrepo https://download.opensuse.org/repositories/devel:libraries:c_c++/openSUSE_Leap_$releasever/devel:libraries:c_c++.repo
sudo zypper install ftxui
```
See <https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui> for details.
> [!note]
> This is an **unofficial** package. That means it is not maintained by the FTXUI
> team, but by the community.
--
> [!note]
> The FTXUI author is not very knowledgeable about openSUSE. This page has been
> mostly generated by AI. If you have any suggestions to improve it, please open
> a PR.
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -1,74 +1,15 @@
@page installation_vcpkg Vcpkg @page installation_vcpkg Vcpkg
@tableofcontents @tableofcontents
# Vcpkg Package ## Vcpkg Package
FTXUI is available in the [Vcpkg registry](https://vcpkg.link/ports/ftxui) FTXUI is available in the Vcpkg registry:
To use it, you can add the following to your `vcpkg.json`:
```json
{
"name": "your-project",
"version-string": "0.1.0",
"dependencies": [
{
"name": "ftxui",
"version>=": "6.1.9"
}
]
}
```
# Install FTXUI using Vcpkg
```bash
vcpkg install --triplet x64-linux # or x64-windows / arm64-osx etc.
```
# Configure your build system.
If you are using CMake, you can use the following in your `CMakeLists.txt`:
**CMakeLists.txt**
```cmake
cmake_minimum_required(VERSION 3.15)
project(my_project)
# Make sure vcpkg toolchain file is passed at configure time
find_package(ftxui CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
```
**main.cpp**
```cpp
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/component/component.hpp>
#include <ftxui/component/component_options.hpp>
int main() {
using namespace ftxui;
auto screen = ScreenInteractive::TerminalOutput();
auto button = Button("Click me", [] { std::cout << "Clicked!\n"; });
screen.Loop(button);
}
```
**Configure and build the project**
```bash
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build
./build/main
```
- https://vcpkg.link/ports/ftxui
## TODO
This page is incomplete. If you use FTXUI with Vcpkg, please help improve this page by contributing working configuration examples.
<div class="section_buttons"> <div class="section_buttons">

View File

@@ -1,40 +0,0 @@
@page installation_xmake XMake
@tableofcontents
## XMake Package (Unofficial)
FTXUI is available in the [xmake-repo](https://github.com/xmake-io/xmake-repo/blob/dev/packages/f/ftxui/xmake.lua)
Example `xmake.lua` snippet:
```lua
add_requires("ftxui", {system = false})
target("demo")
set_kind("binary")
add_files("src/*.cpp")
add_packages("ftxui")
```
Refer to the [XMake documentation](https://xmake.io) for further options.
> [!note]
> This is an **unofficial** package. That means it is not maintained by the FTXUI
> team, but by the community.
---
> [!note]
> The FTXUI author is not very knowledgeable about openSUSE. This page has been
> mostly generated by AI. If you have any suggestions to improve it, please open
> a PR.
---
<div class="section_buttons">
| Previous |
|:------------------|
| [Getting Started](getting-started.html) |
</div>

View File

@@ -73,16 +73,3 @@ Expected output:
| [Getting Started](getting-started.html) | | [Getting Started](getting-started.html) |
</div> </div>
@defgroup screen ftxui/screen
Please check the [tutorial](module-screen.html) of the `ftxui/screen` module.
@defgroup dom ftxui/dom
Please check the [tutorial](module-dom.html) of the `ftxui/dom` module.
@defgroup component ftxui/component
Please check the [tutorial](module-component.html) of the `ftxui/component`
module.

View File

@@ -1,8 +1,6 @@
@page module-component ftxui / component @page module-component Module component
@tableofcontents @tableofcontents
![title-img](https://nsm09.casimages.com/img/2025/05/31//2505310207423242518595349.png)
The `ftxui::component` module defines the logic that produces interactive The `ftxui::component` module defines the logic that produces interactive
components that respond to user events (keyboard, mouse, etc.). components that respond to user events (keyboard, mouse, etc.).
@@ -14,7 +12,7 @@ A `ftxui::Component` is a shared pointer to a `ftxui::ComponentBase`. The latter
- `ftxui::ComponentBase::Render()`: How to render the interface. - `ftxui::ComponentBase::Render()`: How to render the interface.
- `ftxui::ComponentBase::OnEvent()`: How to react to events. - `ftxui::ComponentBase::OnEvent()`: How to react to events.
- `ftxui::ComponentBase::Add()`: Construct a parent/child relationship - `ftxui::ComponentBase::Add()`: Construct a parent/child relationship
between two components. The tree of components is used to define how to between two components. The tree of component is used to define how to
navigate using the keyboard. navigate using the keyboard.
`ftxui::Element` are used to render a single frame. `ftxui::Element` are used to render a single frame.
@@ -29,9 +27,9 @@ frame, and updating its state on events.
All predefined components are available in All predefined components are available in
["ftxui/dom/component.hpp"](./component_8hpp.html) ["ftxui/dom/component.hpp"](./component_8hpp.html)
\include ftxui/component/component.hpp \include{strip ftxui/component/component.hpp
# Input {#component-input} ## Input {#component-input}
[Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2input_8cpp-example.html): [Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2input_8cpp-example.html):
@@ -43,9 +41,9 @@ Produced by: `ftxui::Input()` from "ftxui/component/component.hpp"
<script id="asciicast-223719" src="https://asciinema.org/a/223719.js" async></script> <script id="asciicast-223719" src="https://asciinema.org/a/223719.js" async></script>
@endhtmlonly @endhtmlonly
## Filtered input ### Filtered input
One can filter out the characters received by the input component, using On can filter out the characters received by the input component, using
`ftxui::CatchEvent`. `ftxui::CatchEvent`.
```cpp ```cpp
@@ -63,7 +61,7 @@ input |= CatchEvent([&](Event event) {
}); });
``` ```
# Menu {#component-menu} ## Menu {#component-menu}
Defines a menu object. It contains a list of entries, one of them is selected. Defines a menu object. It contains a list of entries, one of them is selected.
@@ -78,7 +76,7 @@ Produced by: `ftxui::Menu()` from "ftxui/component/component.hpp"
<script id="asciicast-223720" src="https://asciinema.org/a/223720.js" async></script> <script id="asciicast-223720" src="https://asciinema.org/a/223720.js" async></script>
@endhtmlonly @endhtmlonly
# Toggle {#component-toggle} ## Toggle {#component-toggle}
A special kind of menu. The entries are displayed horizontally. A special kind of menu. The entries are displayed horizontally.
@@ -92,7 +90,7 @@ Produced by: `ftxui::Toggle()` from "ftxui/component/component.hpp"
<script id="asciicast-223722" src="https://asciinema.org/a/223722.js" async></script> <script id="asciicast-223722" src="https://asciinema.org/a/223722.js" async></script>
@endhtmlonly @endhtmlonly
# CheckBox {#component-checkbox} ## CheckBox {#component-checkbox}
This component defines a checkbox. It is a single entry that can be turned This component defines a checkbox. It is a single entry that can be turned
on/off. on/off.
@@ -107,7 +105,7 @@ Produced by: `ftxui::Checkbox()` from "ftxui/component/component.hpp"
<script id="asciicast-223724" src="https://asciinema.org/a/223724.js" async></script> <script id="asciicast-223724" src="https://asciinema.org/a/223724.js" async></script>
@endhtmlonly @endhtmlonly
# RadioBox {#component-radiobox} ## RadioBox {#component-radiobox}
A radiobutton component. This is a list of entries, where one can be turned on. A radiobutton component. This is a list of entries, where one can be turned on.
@@ -121,10 +119,10 @@ Produced by: `ftxui::Radiobox()` from "ftxui/component/component.hpp"
<script id="asciicast-223725" src="https://asciinema.org/a/223725.js" async></script> <script id="asciicast-223725" src="https://asciinema.org/a/223725.js" async></script>
@endhtmlonly @endhtmlonly
# Dropdown {#component-dropdown} ## Dropdown {#component-dropdown}
A drop-down menu is a component that, when opened, displays a list of elements A drop down menu is a component that when checked display a list of element for
for the user to select from. the user to select one.
[Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2dropdown_8cpp-example.html): [Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2dropdown_8cpp-example.html):
@@ -132,7 +130,7 @@ for the user to select from.
Produced by: `ftxui::Dropdown()` from "ftxui/component/component.hpp" Produced by: `ftxui::Dropdown()` from "ftxui/component/component.hpp"
# Slider {#component-slider} ## Slider {#component-slider}
Represents a slider object that consists of a range with binned intermediate Represents a slider object that consists of a range with binned intermediate
intervals. It can be created by `ftxui::Slider()`. intervals. It can be created by `ftxui::Slider()`.
@@ -143,7 +141,7 @@ intervals. It can be created by `ftxui::Slider()`.
Produced by: `ftxui::Slider()` from "ftxui/component/component.hpp" Produced by: `ftxui::Slider()` from "ftxui/component/component.hpp"
# Renderer {#component-renderer} ## Renderer {#component-renderer}
Produced by: `ftxui::Renderer()` from \ref ftxui/component/component.hpp. This Produced by: `ftxui::Renderer()` from \ref ftxui/component/component.hpp. This
component decorate another one by using a different function to render an component decorate another one by using a different function to render an
@@ -172,7 +170,7 @@ auto component = [...]
component = component | border | bold; component = component | border | bold;
``` ```
# CatchEvent {#component-catchevent} ## CatchEvent {#component-catchevent}
Produced by: `ftxui::CatchEvent()` from \ref ftxui/component/component.hpp. Produced by: `ftxui::CatchEvent()` from \ref ftxui/component/component.hpp.
This component decorate others, catching events before the underlying component. This component decorate others, catching events before the underlying component.
@@ -202,17 +200,17 @@ component = component
; ;
``` ```
# Collapsible {#component-collapsible} ## Collapsible {#component-collapsible}
Useful for visual elements whose visibility can be toggled on or off by the Useful for visual elements whose visibility can be toggle on/off by the user.
user. Essentially, this is the combination of the `ftxui::Checkbox()` and Essentially, this the combination of the `ftxui::Checkbox()` and
`ftxui::Maybe()` components. `ftxui::Maybe()` components.
```cpp ```cpp
auto collapsible = Collapsible("Show more", inner_element); auto collabsible = Collapsible("Show more", inner_element);
``` ```
# Maybe {#component-maybe} ## Maybe {#component-maybe}
Produced by: `ftxui::Maybe()` from \ref ftxui/component/component.hpp. Produced by: `ftxui::Maybe()` from \ref ftxui/component/component.hpp.
This component can be utilized to show/hide any other component via a boolean or This component can be utilized to show/hide any other component via a boolean or
@@ -239,25 +237,25 @@ component = component
; ;
``` ```
# Container {#component-container} ## Container {#component-container}
## Horizontal {#component-horizontal} ### Horizontal {#component-horizontal}
Produced by: `ftxui::Container::Horizontal()` from Produced by: `ftxui::Container::Horizontal()` from
"ftxui/component/component.hpp". It displays a list of components horizontally "ftxui/component/component.hpp". It displays a list of components horizontally
and handles keyboard/mouse navigation. and handle keyboard/mouse navigation.
## Vertical {#component-vertical} ### Vertical {#component-vertical}
Produced by: `ftxui::Container::Vertical()` from Produced by: `ftxui::Container::Vertical()` from
"ftxui/component/component.hpp". It displays a list of components vertically "ftxui/component/component.hpp". It displays a list of components vertically
and handles keyboard/mouse navigation. and handles keyboard/mouse navigation.
## Tab {#component-tab} ### Tab {#component-tab}
Produced by: `ftxui::Container::Tab()` from Produced by: `ftxui::Container::Tab()` from
"ftxui/component/component.hpp". It takes a list of components and displays "ftxui/component/component.hpp". It take a list of component and display only
only one of them. This is useful for implementing a tab bar. one of them. This is useful for implementing a tab bar.
[Vertical](https://arthursonzogni.github.io/FTXUI/examples_2component_2tab_vertical_8cpp-example.html): [Vertical](https://arthursonzogni.github.io/FTXUI/examples_2component_2tab_vertical_8cpp-example.html):
@@ -268,7 +266,7 @@ only one of them. This is useful for implementing a tab bar.
![ezgif com-gif-maker (2)](https://user-images.githubusercontent.com/4759106/147250217-fe447e0f-7a99-4e08-948a-995087d9b40e.gif) ![ezgif com-gif-maker (2)](https://user-images.githubusercontent.com/4759106/147250217-fe447e0f-7a99-4e08-948a-995087d9b40e.gif)
# ResizableSplit {#component-resizable-split} ## ResizableSplit {#component-resizable-split}
It defines a horizontal or vertical separation between two children components. It defines a horizontal or vertical separation between two children components.
The position of the split is variable and controllable using the mouse. The position of the split is variable and controllable using the mouse.
@@ -287,7 +285,7 @@ from "ftxui/component/component.hpp"
<script id="asciicast-tprMH2EdkUoMb7D2YxgMGgpzx" src="https://asciinema.org/a/tprMH2EdkUoMb7D2YxgMGgpzx.js" async></script> <script id="asciicast-tprMH2EdkUoMb7D2YxgMGgpzx" src="https://asciinema.org/a/tprMH2EdkUoMb7D2YxgMGgpzx.js" async></script>
@endhtmlonly @endhtmlonly
# Force a frame redraw. {#component-force-redraw} ## Force a frame redraw. {#component-force-redraw}
Typically, `ftxui::ScreenInteractive::Loop()` is responsible for drawing a new Typically, `ftxui::ScreenInteractive::Loop()` is responsible for drawing a new
frame whenever a new group of events (e.g keyboard, mouse, window resize, etc.) frame whenever a new group of events (e.g keyboard, mouse, window resize, etc.)

View File

@@ -1,8 +1,6 @@
@page module-dom ftxui / dom @page module-dom Module dom
@tableofcontents @tableofcontents
![title-img](https://nsm09.casimages.com/img/2025/05/31//2505310207423242518595347.png)
This module defines a hierarchical set of `ftxui::Element`. An element manages This module defines a hierarchical set of `ftxui::Element`. An element manages
the layout and can be responsive to the terminal dimension changes. Note the the layout and can be responsive to the terminal dimension changes. Note the
following example where this module is used to create a simple layout with a following example where this module is used to create a simple layout with a
@@ -45,7 +43,7 @@ corresponding header file:
\include{strip} "ftxui/dom/elements.hpp" \include{strip} "ftxui/dom/elements.hpp"
# text # {#dom-text} ## text ## {#dom-text}
The most simple widget. It displays a text. The most simple widget. It displays a text.
```cpp ```cpp
@@ -55,7 +53,7 @@ text("I am a piece of text");
I am a piece of text. I am a piece of text.
``` ```
# vtext {#dom-vtext} ## vtext {#dom-vtext}
Identical to `ftxui::text`, but displayed vertically. Identical to `ftxui::text`, but displayed vertically.
@@ -73,7 +71,7 @@ L
O O
``` ```
# paragraph {#dom-paragraph} ## paragraph {#dom-paragraph}
Similar to `ftxui::text`, but the individual word are wrapped along multiple Similar to `ftxui::text`, but the individual word are wrapped along multiple
lines, depending on the width of its container. lines, depending on the width of its container.
@@ -97,7 +95,7 @@ namespace ftxui {
``` ```
# border {#dom-border} ## border {#dom-border}
Adds a border around an element. Adds a border around an element.
@@ -136,7 +134,7 @@ namespace ftxui {
``` ```
# window # {#dom-window} ## window ## {#dom-window}
A `ftxui::window` is a `ftxui::border`, but with an additional header. To add a A `ftxui::window` is a `ftxui::border`, but with an additional header. To add a
window around an element, wrap it and specify a string as the header. window around an element, wrap it and specify a string as the header.
@@ -152,7 +150,7 @@ Terminal output:
└───────────┘ └───────────┘
``` ```
# separator {#dom-separator} ## separator {#dom-separator}
Displays a vertical/horizontal line to visually split the content of a Displays a vertical/horizontal line to visually split the content of a
container in two. container in two.
@@ -198,7 +196,7 @@ namespace ftxui {
} }
``` ```
# gauge {#dom-gauge} ## gauge {#dom-gauge}
This is a visual element that represents a ratio of progress. This is a visual element that represents a ratio of progress.
@@ -207,7 +205,7 @@ Code:
border(gauge(0.5)) border(gauge(0.5))
``` ```
Terminal output: Teminal output:
```bash ```bash
┌────────────────────────────────────────────────────────────────────────────┐ ┌────────────────────────────────────────────────────────────────────────────┐
│██████████████████████████████████████ │ │██████████████████████████████████████ │
@@ -226,7 +224,7 @@ namespace {
} }
``` ```
# graph {#dom-graph} ## graph {#dom-graph}
@htmlonly @htmlonly
<script id="asciicast-223726" src="https://asciinema.org/a/223726.js" async></script> <script id="asciicast-223726" src="https://asciinema.org/a/223726.js" async></script>
@@ -237,7 +235,7 @@ See:
Element graph(GraphFunction); Element graph(GraphFunction);
``` ```
# Colors {#dom-colors} ## Colors {#dom-colors}
Most terminal consoles can display colored text and colored backgrounds. FTXUI Most terminal consoles can display colored text and colored backgrounds. FTXUI
supports every color palette: supports every color palette:
@@ -250,7 +248,7 @@ Decorator bgcolor(Color);
Color [gallery](https://arthursonzogni.github.io/FTXUI/examples_2dom_2color_gallery_8cpp-example.html): Color [gallery](https://arthursonzogni.github.io/FTXUI/examples_2dom_2color_gallery_8cpp-example.html):
![image](https://user-images.githubusercontent.com/4759106/147248595-04c7245a-5b85-4544-809d-a5984fc6f9e7.png) ![image](https://user-images.githubusercontent.com/4759106/147248595-04c7245a-5b85-4544-809d-a5984fc6f9e7.png)
## Palette16 #{#dom-colors-palette-16} ### Palette16 #{#dom-colors-palette-16}
On most terminals the following colors are supported: On most terminals the following colors are supported:
- Default - Default
@@ -286,7 +284,7 @@ text("Blue background") | bgcolor(Color::Blue);
text("Black on white") | color(Color::Black) | bgcolor(Color::White); text("Black on white") | color(Color::Black) | bgcolor(Color::White);
``` ```
## Palette256 #{#dom-colors-palette-256} ### Palette256 #{#dom-colors-palette-256}
On terminal supporting 256 colors. On terminal supporting 256 colors.
@htmlonly @htmlonly
@@ -297,7 +295,7 @@ On terminal supporting 256 colors.
text("HotPink") | color(Color::HotPink); text("HotPink") | color(Color::HotPink);
``` ```
## TrueColor #{#dom-colors-true-color} ### TrueColor #{#dom-colors-true-color}
On terminal supporting trueColor, you can directly use the 24bit RGB color On terminal supporting trueColor, you can directly use the 24bit RGB color
space: space:
@@ -316,7 +314,7 @@ 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} ## LinearGradient #{#dom-linear-gradient}
FTXUI supports linear gradient. Either on the foreground or the background. FTXUI supports linear gradient. Either on the foreground or the background.
@@ -346,7 +344,7 @@ LinearGradient(45, Color::Red, Color::Blue);
See [demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/linear_gradient_gallery). 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`, `italic`, `dim`, `underlined`, `inverted`, `blink`. effects such as: `bold`, `italic`, `dim`, `underlined`, `inverted`, `blink`.
@@ -379,7 +377,7 @@ Alternatively, use the pipe operator to chain it on your element:
text("This text is bold") | bold | underlined text("This text is bold") | bold | underlined
``` ```
# Layout {#dom-layout} ## Layout {#dom-layout}
Enables elements to be arranged in the following ways: Enables elements to be arranged in the following ways:
- **Horizontally** with `ftxui::hbox` - **Horizontally** with `ftxui::hbox`
@@ -407,7 +405,7 @@ Checkout this
and the associated and the associated
[demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/flexbox). [demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/flexbox).
Element can also become flexible using the `ftxui::flex` decorator. Element can also become flexible using the the `ftxui::flex` decorator.
Code: Code:
```cpp ```cpp
@@ -440,7 +438,7 @@ Terminal output:
└────┘└───────────────────────────────┘└───────────────────────────────┘ └────┘└───────────────────────────────┘└───────────────────────────────┘
``` ```
# Table {#dom-table} ## Table {#dom-table}
Enables easy formatting of data into a neat table like visual form. Enables easy formatting of data into a neat table like visual form.
@@ -448,7 +446,7 @@ Enables easy formatting of data into a neat table like visual form.
![image](https://user-images.githubusercontent.com/4759106/147250766-77d8ec9e-cf2b-486d-9866-1fd9f1bd2e6b.png) ![image](https://user-images.githubusercontent.com/4759106/147250766-77d8ec9e-cf2b-486d-9866-1fd9f1bd2e6b.png)
# Canvas {#dom-canvas} ## Canvas {#dom-canvas}
See the API [<ftxui/dom/canvas.hpp>](./canvas_8hpp_source.html) See the API [<ftxui/dom/canvas.hpp>](./canvas_8hpp_source.html)

View File

@@ -1,8 +1,6 @@
@page module-screen ftxui / screen @page module-screen Module screen
@tableofcontents @tableofcontents
![title-img](https://nsm09.casimages.com/img/2025/05/31//2505310207423242518595348.png)
The `ftxui::screen` module is the low-level foundation. It can be used The `ftxui::screen` module is the low-level foundation. It can be used
standalone, but it is primarily designed to be used together by standalone, but it is primarily designed to be used together by
[ftxui::dom](module-dom.html) and [ftxui::component](module-component.html) [ftxui::dom](module-dom.html) and [ftxui::component](module-component.html)

View File

@@ -1,16 +1,16 @@
# ftxui {#ftxui} # Modules {#modules}
![title-img](https://nsm09.casimages.com/img/2025/05/30//2505300816063242518595251.jpg) ![title-img](https://nsm09.casimages.com/img/2025/05/30//2505300816063242518595251.jpg)
FTXUI is organized into three modules, each building upon the previous: FTXUI is organized into three modules, each building upon the previous:
1. [ftxui/screen](#module-screen) - Low-level rendering 1. @subpage module-screen — low-level rendering
2. [ftxui/dom](#module-dom) - Layout and composition 2. @subpage module-dom — layout and composition
3. [ftxui/component](#module-component) - User interaction 3. @subpage module-component — user interaction
--- ---
# ftxui/screen [ @subpage module-screen ]
Defines: Defines:
@@ -20,18 +20,9 @@ Defines:
Use for direct terminal drawing and styling. Use for direct terminal drawing and styling.
<div class="section_buttons">
| Next |
|--------------------------------------:|
| [Documentation](module-screen.html) |
</div>
--- ---
# ftxui/dom [ @subpage module-dom ]
Provides: Provides:
@@ -41,17 +32,9 @@ Provides:
Ideal for structured, styled UIs. Ideal for structured, styled UIs.
<div class="section_buttons">
| Next |
|--------------------------------------:|
| [Documentation](module-dom.html) |
</div>
--- ---
# ftxui/component
[ @subpage module-component ]
Adds: Adds:
@@ -61,14 +44,6 @@ Adds:
Use for interactive apps. Use for interactive apps.
<div class="section_buttons">
| Next |
|--------------------------------------:|
| [Documentation](module-component.html) |
</div>
--- ---
Modules can be used independently, or together: `screen → dom → component`. Modules can be used independently, or together: `screen → dom → component`.

View File

@@ -1,58 +0,0 @@
# POSIX Piped Input in FTXUI
> [!WARNING]
> This feature works only on Linux and macOS. It is not supported on
> Windows and WebAssembly.
## What is a POSIX Pipe?
A POSIX pipe is a way for two separate programs to communicate. One program sends its output directly as input to another program. Think of it like a one-way tube for data.
**Example:**
Imagine you want to list files and then filter them interactively.
- `ls`: Lists files.
- `interactive_grep`: An FTXUI application that filters text and lets you type.
You can connect them with a pipe (`|`):
```bash
ls -l | interactive_grep
```
Here's what happens:
1. `ls -l` lists files with details.
2. The `|` sends this list directly to `interactive_grep`.
3. `interactive_grep` receives the list and displays it. Because it's an FTXUI app, you can then type to filter the list, even though it received initial data from `ls`.
## How FTXUI Handles Piped Input
Now that you understand what a POSIX pipe is, let's look at how FTXUI uses them.
FTXUI lets your application read data from other programs (like from a pipe) while still allowing you to use your keyboard for interaction. This is useful for interactive command-line tools that process data.
Normally, FTXUI applications receive all input from `stdin`. However, when FTXUI detects that `stdin` is connected to the output of a pipe (meaning data is being piped into your application), it automatically switches to reading interactive keyboard input from `/dev/tty`. This ensures that your application can still receive user input even while processing piped data.
This feature is **turned on by default**.
If your FTXUI application needs to read piped data and also respond to keyboard input, you typically don't need to do anything special:
```cpp
auto screen = ScreenInteractive::Fullscreen();
// screen.HandlePipedInput(true); // This is enabled by default
screen.Loop(component);
```
## Turning Off Piped Input
If you don't need this feature, or if it conflicts with your custom input handling, you can turn it off.
To disable it, call `HandlePipedInput(false)` before starting your application's main loop:
```cpp
auto screen = ScreenInteractive::Fullscreen();
screen.HandlePipedInput(false); // Turn off piped input handling
screen.Loop(component);
```

View File

@@ -22,7 +22,7 @@ html {
--warning-color-darker: #f7768e; --warning-color-darker: #f7768e;
--bug-color: #f7768e; --bug-color: #f7768e;
--fragment-background: #222222; --fragment-background: #2c2e34;
--fragment-foreground: #e2e2e3; --fragment-foreground: #e2e2e3;
--fragment-keyword: #f7768e; /* pink */ --fragment-keyword: #f7768e; /* pink */
--fragment-keywordtype: #7fbbb3; /* teal */ --fragment-keywordtype: #7fbbb3; /* teal */
@@ -34,7 +34,6 @@ html {
--fragment-linenumber-color: #414868; --fragment-linenumber-color: #414868;
--fragment-linenumber-background: #2c2e34; --fragment-linenumber-background: #2c2e34;
--fragment-linenumber-border: #1a1b26; --fragment-linenumber-border: #1a1b26;
--fragment-lineheight: 1.125em;
} }
/* Base style for all sections */ /* Base style for all sections */

View File

@@ -15,14 +15,16 @@ add_subdirectory(component)
add_subdirectory(dom) add_subdirectory(dom)
if (EMSCRIPTEN) if (EMSCRIPTEN)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1")
target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1")
get_property(EXAMPLES GLOBAL PROPERTY FTXUI::EXAMPLES) get_property(EXAMPLES GLOBAL PROPERTY FTXUI::EXAMPLES)
foreach(file foreach(file
"index.css"
"index.html" "index.html"
"index.mjs" "index.mjs"
"run_webassembly.py" "index.css"
"sw.js" "sw.js"
) "run_webassembly.py")
configure_file(${file} ${file}) configure_file(${file} ${file})
endforeach(file) endforeach(file)
endif() endif()

View File

@@ -39,7 +39,6 @@ example(radiobox)
example(radiobox_in_frame) example(radiobox_in_frame)
example(renderer) example(renderer)
example(resizable_split) example(resizable_split)
example(resizable_split_clamp)
example(scrollbar) example(scrollbar)
example(selection) example(selection)
example(slider) example(slider)

View File

@@ -4,11 +4,17 @@
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer #include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, gauge, text, Element, operator|, vbox, border #include "ftxui/dom/elements.hpp" // for separator, gauge, text, Element, operator|, vbox, border
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
@@ -18,7 +24,7 @@ using namespace ftxui;
// We are using `center` to center the text inside the button, then `border` to // We are using `center` to center the text inside the button, then `border` to
// add a border around the button, and finally `flex` to make the button fill // add a border around the button, and finally `flex` to make the button fill
// the available space. // the available space.
ButtonOption Style() { ButtonOption ButtonStyle() {
auto option = ButtonOption::Animated(); auto option = ButtonOption::Animated();
option.transform = [](const EntryState& s) { option.transform = [](const EntryState& s) {
auto element = text(s.label); auto element = text(s.label);
@@ -33,19 +39,20 @@ ButtonOption Style() {
int main() { int main() {
int value = 50; int value = 50;
// clang-format off
auto btn_dec_01 = Button("-1", [&] { value -= 1; }, Style());
auto btn_inc_01 = Button("+1", [&] { value += 1; }, Style());
auto btn_dec_10 = Button("-10", [&] { value -= 10; }, Style());
auto btn_inc_10 = Button("+10", [&] { value += 10; }, Style());
// clang-format on
// The tree of components. This defines how to navigate using the keyboard. // The tree of components. This defines how to navigate using the keyboard.
// The selected `row` is shared to get a grid layout.
int row = 0;
auto buttons = Container::Vertical({ auto buttons = Container::Vertical({
Container::Horizontal({btn_dec_01, btn_inc_01}, &row) | flex, Container::Horizontal({
Container::Horizontal({btn_dec_10, btn_inc_10}, &row) | flex, Button(
"-1", [&] { value--; }, ButtonStyle()),
Button(
"+1", [&] { value++; }, ButtonStyle()),
}) | flex,
Container::Horizontal({
Button(
"-10", [&] { value -= 10; }, ButtonStyle()),
Button(
"+10", [&] { value += 10; }, ButtonStyle()),
}) | flex,
}); });
// Modify the way to render them on screen: // Modify the way to render them on screen:
@@ -58,7 +65,7 @@ int main() {
flex | border; flex | border;
}); });
auto screen = ScreenInteractive::FitComponent(); auto screen = ScreenInteractive::Fullscreen();
screen.Loop(component); screen.Loop(component);
return 0; return 0;
} }

View File

@@ -4,6 +4,7 @@
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer #include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -11,6 +12,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for gauge, separator, text, vbox, operator|, Element, border #include "ftxui/dom/elements.hpp" // for gauge, separator, text, vbox, operator|, Element, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Green, Color::Red #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Green, Color::Red
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -4,6 +4,7 @@
#include <memory> // for allocator, __shared_ptr_access, shared_ptr #include <memory> // for allocator, __shared_ptr_access, shared_ptr
#include <string> // for to_string, operator+ #include <string> // for to_string, operator+
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Renderer, Vertical #include "ftxui/component/component.hpp" // for Button, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -11,6 +12,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, text, Element, hbox, separator, size, vbox, border, frame, vscroll_indicator, HEIGHT, LESS_THAN #include "ftxui/dom/elements.hpp" // for operator|, text, Element, hbox, separator, size, vbox, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
#include "ftxui/screen/color.hpp" // for Color, Color::Default, Color::GrayDark, Color::White #include "ftxui/screen/color.hpp" // for Color, Color::Default, Color::GrayDark, Color::White
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -3,6 +3,7 @@
// the LICENSE file. // the LICENSE file.
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Vertical, Renderer, Horizontal, operator| #include "ftxui/component/component.hpp" // for Button, Vertical, Renderer, Horizontal, operator|
#include "ftxui/component/component_base.hpp" // for Component #include "ftxui/component/component_base.hpp" // for Component
@@ -10,6 +11,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, separator, text, border #include "ftxui/dom/elements.hpp" // for Element, separator, text, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Green, Color::Red #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Green, Color::Red
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -2,13 +2,18 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSED file. // the LICENSED file.
#include <cmath> // for sin, cos #include <cmath> // for sin, cos
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border #include <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border
#include <ftxui/screen/screen.hpp> // for Pixel #include <ftxui/screen/screen.hpp> // for Pixel
#endif
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type #include <vector> // for vector, __alloc_traits<>::value_type
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Renderer, CatchEvent, Horizontal, Menu, Tab #include "ftxui/component/component.hpp" // for Renderer, CatchEvent, Horizontal, Menu, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event #include "ftxui/component/event.hpp" // for Event
@@ -16,6 +21,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#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
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;
@@ -133,9 +143,8 @@ int main() {
float dy = 50.f; float dy = 50.f;
ys[x] = int(dy + 20 * cos(dx * 0.14) + 10 * sin(dx * 0.42)); ys[x] = int(dy + 20 * cos(dx * 0.14) + 10 * sin(dx * 0.42));
} }
for (int x = 1; x < 99; x++) { for (int x = 1; x < 99; x++)
c.DrawPointLine(x, ys[x], x + 1, ys[x + 1]); c.DrawPointLine(x, ys[x], x + 1, ys[x + 1]);
}
return canvas(std::move(c)); return canvas(std::move(c));
}); });

View File

@@ -6,11 +6,16 @@
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical #include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for 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
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical #include "ftxui/component/component.hpp" // for Checkbox, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for 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
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Collapsible, Renderer, Vertical #include "ftxui/component/component.hpp" // for Collapsible, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#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, hbox, Element #include "ftxui/dom/elements.hpp" // for text, hbox, Element
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -4,11 +4,16 @@
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer #include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, separator, Element, operator|, vbox, border #include "ftxui/dom/elements.hpp" // for text, separator, Element, operator|, vbox, border
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -3,16 +3,25 @@
// the LICENSE file. // the LICENSE file.
#include <stdlib.h> // for EXIT_SUCCESS #include <stdlib.h> // for EXIT_SUCCESS
#include <chrono> // for milliseconds #include <chrono> // for milliseconds
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/event.hpp> // for Event #include <ftxui/component/event.hpp> // for Event
#include <ftxui/component/mouse.hpp> // for ftxui #include <ftxui/component/mouse.hpp> // for ftxui
#include <ftxui/dom/elements.hpp> // for text, separator, Element, operator|, vbox, border #include <ftxui/dom/elements.hpp> // for text, separator, Element, operator|, vbox, border
#endif
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#include <thread> // for sleep_for #include <thread> // for sleep_for
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for CatchEvent, Renderer, operator|= #include "ftxui/component/component.hpp" // for CatchEvent, Renderer, operator|=
#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
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -4,9 +4,13 @@
#include <string> // for basic_string, string, allocator #include <string> // for basic_string, string, allocator
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#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
#else
import ftxui.component;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -4,9 +4,13 @@
#include <string> // for basic_string, string, allocator #include <string> // for basic_string, string, allocator
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#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
#else
import ftxui.component;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -6,6 +6,7 @@
#include <string> // for string, basic_string, to_string, operator+, char_traits #include <string> // for string, basic_string, to_string, operator+, char_traits
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Vertical, Checkbox, Horizontal, Renderer, ResizableSplitBottom, ResizableSplitRight #include "ftxui/component/component.hpp" // for Radiobox, Vertical, Checkbox, Horizontal, Renderer, ResizableSplitBottom, ResizableSplitRight
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -13,6 +14,11 @@
#include "ftxui/dom/elements.hpp" // for text, window, operator|, vbox, hbox, Element, flexbox, bgcolor, filler, flex, size, border, hcenter, color, EQUAL, bold, dim, notflex, xflex_grow, yflex_grow, HEIGHT, WIDTH #include "ftxui/dom/elements.hpp" // for text, window, operator|, vbox, hbox, Element, flexbox, bgcolor, filler, flex, size, border, hcenter, color, EQUAL, bold, dim, notflex, xflex_grow, yflex_grow, HEIGHT, WIDTH
#include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignItems, FlexboxConfig::Direction, FlexboxConfig::JustifyContent::Center, FlexboxConfig::Wrap #include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignItems, FlexboxConfig::Direction, FlexboxConfig::JustifyContent::Center, FlexboxConfig::Wrap
#include "ftxui/screen/color.hpp" // for Color, Color::Black #include "ftxui/screen/color.hpp" // for Color, Color::Black
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
@@ -82,12 +88,10 @@ int main() {
size(WIDTH, EQUAL, dimx) | size(HEIGHT, EQUAL, dimy) | size(WIDTH, EQUAL, dimx) | size(HEIGHT, EQUAL, dimy) |
bgcolor(Color::HSV(index * 25, 255, 255)) | bgcolor(Color::HSV(index * 25, 255, 255)) |
color(Color::Black); color(Color::Black);
if (element_xflex_grow) { if (element_xflex_grow)
element = element | xflex_grow; element = element | xflex_grow;
} if (element_yflex_grow)
if (element_yflex_grow) {
element = element | yflex_grow; element = element | yflex_grow;
}
return element; return element;
}; };
@@ -121,12 +125,10 @@ int main() {
group = group | notflex; group = group | notflex;
if (!group_xflex_grow) { if (!group_xflex_grow)
group = hbox(group, filler()); group = hbox(group, filler());
} if (!group_yflex_grow)
if (!group_yflex_grow) {
group = vbox(group, filler()); group = vbox(group, filler());
}
group = group | flex; group = group | flex;
return group; return group;

View File

@@ -5,12 +5,18 @@
#include <string> // for operator+, char_traits, to_string, string #include <string> // for operator+, char_traits, to_string, string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical #include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Elements, Element, operator|, separator, text, focusPositionRelative, size, border, flex, frame, bgcolor, gridbox, vbox, EQUAL, center, HEIGHT, WIDTH #include "ftxui/dom/elements.hpp" // for Elements, Element, operator|, separator, text, focusPositionRelative, size, border, flex, frame, bgcolor, gridbox, vbox, EQUAL, center, HEIGHT, WIDTH
#include "ftxui/screen/color.hpp" // for Color #include "ftxui/screen/color.hpp" // for Color
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -1,12 +1,20 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/captured_mouse.hpp> // for ftxui #include <ftxui/component/captured_mouse.hpp> // for ftxui
#endif
#include <string> // for allocator, operator+, char_traits, string #include <string> // for allocator, operator+, char_traits, string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Renderer, Vertical #include "ftxui/component/component.hpp" // for Renderer, Vertical
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
#include "ftxui/dom/elements.hpp" // for text, Decorator, focus, focusCursorBar, focusCursorBarBlinking, focusCursorBlock, focusCursorBlockBlinking, focusCursorUnderline, focusCursorUnderlineBlinking, hbox, Element #include "ftxui/dom/elements.hpp" // for text, Decorator, focus, focusCursorBar, focusCursorBarBlinking, focusCursorBlock, focusCursorBlockBlinking, focusCursorUnderline, focusCursorUnderlineBlinking, hbox, Element
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -6,11 +6,16 @@
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Slider, Checkbox, Vertical, Renderer, Button, Input, Menu, Radiobox, Toggle #include "ftxui/component/component.hpp" // for Slider, Checkbox, Vertical, Renderer, Button, Input, Menu, Radiobox, Toggle
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, operator|, Element, size, xflex, text, WIDTH, hbox, vbox, EQUAL, border, GREATER_THAN #include "ftxui/dom/elements.hpp" // for separator, operator|, Element, size, xflex, text, WIDTH, hbox, vbox, EQUAL, border, GREATER_THAN
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -1,12 +1,11 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <stddef.h> // for size_t #include <stddef.h> // for size_t
#include <array> // for array #include <array> // for array
#include <atomic> // for atomic #include <atomic> // for atomic
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#include <cmath> // for sin #include <cmath> // for sin
#include <ftxui/component/loop.hpp>
#include <functional> // for ref, reference_wrapper, function #include <functional> // for ref, reference_wrapper, function
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for string, basic_string, char_traits, operator+, to_string #include <string> // for string, basic_string, char_traits, operator+, to_string
@@ -15,6 +14,8 @@
#include <vector> // for vector #include <vector> // for vector
#include "../dom/color_info_sorted_2d.ipp" // for ColorInfoSorted2D #include "../dom/color_info_sorted_2d.ipp" // for ColorInfoSorted2D
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Checkbox, Renderer, Horizontal, Vertical, Input, Menu, Radiobox, ResizableSplitLeft, Tab #include "ftxui/component/component.hpp" // for Checkbox, Renderer, Horizontal, Vertical, Input, Menu, Radiobox, ResizableSplitLeft, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_options.hpp" // for MenuOption, InputOption #include "ftxui/component/component_options.hpp" // for MenuOption, InputOption
@@ -25,6 +26,11 @@
#include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::Black, Color::Blue, Color::Cyan, Color::CyanLight, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::White, Color::Yellow, Color::YellowLight, Color::Default, Color::Palette256, ftxui #include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::Black, Color::Blue, Color::Cyan, Color::CyanLight, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::White, Color::Yellow, Color::YellowLight, Color::Default, Color::Palette256, ftxui
#include "ftxui/screen/color_info.hpp" // for ColorInfo #include "ftxui/screen/color_info.hpp" // for ColorInfo
#include "ftxui/screen/terminal.hpp" // for Size, Dimensions #include "ftxui/screen/terminal.hpp" // for Size, Dimensions
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
@@ -270,7 +276,7 @@ int main() {
auto spinner_tab_renderer = Renderer([&] { auto spinner_tab_renderer = Renderer([&] {
Elements entries; Elements entries;
for (int i = 0; i < 22; ++i) { for (int i = 0; i < 22; ++i) {
entries.push_back(spinner(i, shift / 5) | bold | entries.push_back(spinner(i, shift / 2) | bold |
size(WIDTH, GREATER_THAN, 2) | border); size(WIDTH, GREATER_THAN, 2) | border);
} }
return hflow(std::move(entries)); return hflow(std::move(entries));
@@ -513,20 +519,24 @@ int main() {
}); });
}); });
Loop loop(&screen, main_renderer); std::atomic<bool> refresh_ui_continue = true;
while (!loop.HasQuitted()) { std::thread refresh_ui([&] {
// Update the state of the application. while (refresh_ui_continue) {
shift++; using namespace std::chrono_literals;
std::this_thread::sleep_for(0.05s);
// The |shift| variable belong to the main thread. `screen.Post(task)`
// will execute the update on the thread where |screen| lives (e.g. the
// main thread). Using `screen.Post(task)` is threadsafe.
screen.Post([&] { shift++; });
// After updating the state, request a new frame to be drawn. This is done
// by simulating a new "custom" event to be handled.
screen.Post(Event::Custom);
}
});
// Request a new frame to be drawn. screen.Loop(main_renderer);
screen.RequestAnimationFrame(); refresh_ui_continue = false;
refresh_ui.join();
// Execute events, and draw the next frame.
loop.RunOnce();
// Sleep for a short duration to control the frame rate (60 FPS).
std::this_thread::sleep_for(std::chrono::milliseconds(1000 / 60));
}
return 0; return 0;
} }

View File

@@ -4,6 +4,7 @@
#include <memory> // for allocator, __shared_ptr_access #include <memory> // for allocator, __shared_ptr_access
#include <string> // for char_traits, operator+, string, basic_string #include <string> // for char_traits, operator+, string, basic_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Input, Renderer, Vertical #include "ftxui/component/component.hpp" // for Input, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -11,6 +12,11 @@
#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, 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
#else
import ftxui.component;
import ftxui.dom;
import ftxui.util;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Input, Renderer, Vertical #include "ftxui/component/component.hpp" // for Input, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#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
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -1,17 +1,26 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient #include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
#include <ftxui/screen/color.hpp> // for Color, Color::White, Color::Red, Color::Blue, Color::Black, Color::GrayDark, ftxui #include <ftxui/screen/color.hpp> // for Color, Color::White, Color::Red, Color::Blue, Color::Black, Color::GrayDark, ftxui
#endif
#include <functional> // for function #include <functional> // for function
#include <string> // for allocator, string #include <string> // for allocator, string
#include <utility> // for move #include <utility> // for move
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Input, Horizontal, Vertical, operator| #include "ftxui/component/component.hpp" // for Input, Horizontal, Vertical, operator|
#include "ftxui/component/component_base.hpp" // for Component #include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/component/component_options.hpp" // for InputState, InputOption #include "ftxui/component/component_options.hpp" // for InputState, InputOption
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|=, Element, bgcolor, operator|, separatorEmpty, color, borderEmpty, separator, text, center, dim, hbox, vbox, border, borderDouble, borderRounded #include "ftxui/dom/elements.hpp" // for operator|=, Element, bgcolor, operator|, separatorEmpty, color, borderEmpty, separator, text, center, dim, hbox, vbox, border, borderDouble, borderRounded
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -1,16 +1,25 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved. // Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/component_base.hpp> // for ComponentBase, Component #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/elements.hpp> // for operator|, Element, flex, bgcolor, text, vbox, center
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient #include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
#include <ftxui/screen/color.hpp> // for Color, Color::Blue, Color::Red #include <ftxui/screen/color.hpp> // for Color, Color::Blue, Color::Red
#endif
#include <memory> // for __shared_ptr_access, shared_ptr #include <memory> // for __shared_ptr_access, shared_ptr
#include <string> // for allocator, operator+, char_traits, string, to_string #include <string> // for allocator, operator+, char_traits, string, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical #include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -4,12 +4,18 @@
#include <string> // for string, allocator, basic_string #include <string> // for string, allocator, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for operator|, Maybe, Checkbox, Radiobox, Renderer, Vertical #include "ftxui/component/component.hpp" // for operator|, Maybe, Checkbox, Radiobox, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for Component #include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, border, color, operator|, text #include "ftxui/dom/elements.hpp" // for Element, border, color, operator|, text
#include "ftxui/screen/color.hpp" // for Color, Color::Red #include "ftxui/screen/color.hpp" // for Color, Color::Red
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -6,10 +6,14 @@
#include <string> // for string, basic_string, allocator #include <string> // for string, basic_string, allocator
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Menu #include "ftxui/component/component.hpp" // for Menu
#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
#else
import ftxui.component;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -6,12 +6,17 @@
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Menu, Horizontal, Renderer #include "ftxui/component/component.hpp" // for Menu, Horizontal, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuOption #include "ftxui/component/component_options.hpp" // for MenuOption
#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
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -6,6 +6,7 @@
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for char_traits, to_string, operator+, string, basic_string #include <string> // for char_traits, to_string, operator+, string, basic_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for MenuEntry, Renderer, Vertical #include "ftxui/component/component.hpp" // for MenuEntry, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -13,6 +14,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, Element, separator, text, hbox, size, frame, color, vbox, HEIGHT, LESS_THAN, bold, border, inverted #include "ftxui/dom/elements.hpp" // for operator|, Element, separator, text, hbox, size, frame, color, vbox, HEIGHT, LESS_THAN, bold, border, inverted
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
@@ -22,12 +28,10 @@ MenuEntryOption Colored(ftxui::Color c) {
option.transform = [c](EntryState state) { option.transform = [c](EntryState state) {
state.label = (state.active ? "> " : " ") + state.label; state.label = (state.active ? "> " : " ") + state.label;
Element e = text(state.label) | color(c); Element e = text(state.label) | color(c);
if (state.focused) { if (state.focused)
e = e | inverted; e = e | inverted;
} if (state.active)
if (state.active) {
e = e | bold; e = e | bold;
}
return e; return e;
}; };
return option; return option;

View File

@@ -5,6 +5,7 @@
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#include <string> // for to_string, allocator #include <string> // for to_string, allocator
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for MenuEntryAnimated, Renderer, Vertical #include "ftxui/component/component.hpp" // for MenuEntryAnimated, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -12,6 +13,11 @@
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, separator, Element, Decorator, color, text, hbox, size, bold, frame, inverted, vbox, HEIGHT, LESS_THAN, border #include "ftxui/dom/elements.hpp" // for operator|, separator, Element, Decorator, color, text, hbox, size, bold, frame, inverted, vbox, HEIGHT, LESS_THAN, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Renderer #include "ftxui/component/component.hpp" // for Radiobox, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN #include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;
@@ -17,9 +22,8 @@ int main() {
std::vector<std::string> entries; std::vector<std::string> entries;
int selected = 0; int selected = 0;
for (int i = 0; i < 30; ++i) { for (int i = 0; i < 30; ++i)
entries.push_back("Entry " + std::to_string(i)); entries.push_back("Entry " + std::to_string(i));
}
auto radiobox = Menu(&entries, &selected); auto radiobox = Menu(&entries, &selected);
auto renderer = Renderer(radiobox, [&] { auto renderer = Renderer(radiobox, [&] {
return radiobox->Render() | vscroll_indicator | frame | return radiobox->Render() | vscroll_indicator | frame |

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Renderer #include "ftxui/component/component.hpp" // for Radiobox, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN #include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;
@@ -17,9 +22,8 @@ int main() {
std::vector<std::string> entries; std::vector<std::string> entries;
int selected = 0; int selected = 0;
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i)
entries.push_back(std::to_string(i)); entries.push_back(std::to_string(i));
}
auto radiobox = Menu(&entries, &selected, MenuOption::Horizontal()); auto radiobox = Menu(&entries, &selected, MenuOption::Horizontal());
auto renderer = Renderer( auto renderer = Renderer(
radiobox, [&] { return radiobox->Render() | hscroll_indicator | frame; }); radiobox, [&] { return radiobox->Render() | hscroll_indicator | frame; });

View File

@@ -6,11 +6,16 @@
#include <string> // for string, operator+, basic_string, to_string, char_traits #include <string> // for string, operator+, basic_string, to_string, char_traits
#include <vector> // for vector, __alloc_traits<>::value_type #include <vector> // for vector, __alloc_traits<>::value_type
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Menu, Renderer, Horizontal, Vertical #include "ftxui/component/component.hpp" // for Menu, Renderer, Horizontal, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#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, Element, operator|, window, flex, vbox #include "ftxui/dom/elements.hpp" // for text, Element, operator|, window, flex, vbox
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -8,6 +8,7 @@
#include <string> // for string, char_traits, operator+, basic_string #include <string> // for string, char_traits, operator+, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/animation.hpp" // for ElasticOut, Linear #include "ftxui/component/animation.hpp" // for ElasticOut, Linear
#include "ftxui/component/component.hpp" // for Menu, Horizontal, Renderer, Vertical #include "ftxui/component/component.hpp" // for Menu, Horizontal, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -16,6 +17,11 @@
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, operator|, Element, text, bgcolor, hbox, bold, color, filler, border, vbox, borderDouble, dim, flex, hcenter #include "ftxui/dom/elements.hpp" // for separator, operator|, Element, text, bgcolor, hbox, bold, color, filler, border, vbox, borderDouble, dim, flex, hcenter
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Black, Color::Yellow, Color::Blue, Color::Default, Color::White #include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Black, Color::Yellow, Color::Blue, Color::Default, Color::White
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
@@ -116,12 +122,10 @@ Component VMenu1(std::vector<std::string>* entries, int* selected) {
option.entries_option.transform = [](EntryState state) { option.entries_option.transform = [](EntryState state) {
state.label = (state.active ? "> " : " ") + state.label; state.label = (state.active ? "> " : " ") + state.label;
Element e = text(state.label); Element e = text(state.label);
if (state.focused) { if (state.focused)
e = e | bgcolor(Color::Blue); e = e | bgcolor(Color::Blue);
} if (state.active)
if (state.active) {
e = e | bold; e = e | bold;
}
return e; return e;
}; };
return Menu(entries, selected, option); return Menu(entries, selected, option);
@@ -132,12 +136,10 @@ Component VMenu2(std::vector<std::string>* entries, int* selected) {
option.entries_option.transform = [](EntryState state) { option.entries_option.transform = [](EntryState state) {
state.label += (state.active ? " <" : " "); state.label += (state.active ? " <" : " ");
Element e = hbox(filler(), text(state.label)); Element e = hbox(filler(), text(state.label));
if (state.focused) { if (state.focused)
e = e | bgcolor(Color::Red); e = e | bgcolor(Color::Red);
} if (state.active)
if (state.active) {
e = e | bold; e = e | bold;
}
return e; return e;
}; };
return Menu(entries, selected, option); return Menu(entries, selected, option);
@@ -148,16 +150,13 @@ Component VMenu3(std::vector<std::string>* entries, int* selected) {
option.entries_option.transform = [](EntryState state) { option.entries_option.transform = [](EntryState state) {
Element e = state.active ? text("[" + state.label + "]") Element e = state.active ? text("[" + state.label + "]")
: text(" " + state.label + " "); : text(" " + state.label + " ");
if (state.focused) { if (state.focused)
e = e | bold; e = e | bold;
}
if (state.focused) { if (state.focused)
e = e | color(Color::Blue); e = e | color(Color::Blue);
} if (state.active)
if (state.active) {
e = e | bold; e = e | bold;
}
return e; return e;
}; };
return Menu(entries, selected, option); return Menu(entries, selected, option);
@@ -252,12 +251,10 @@ Component HMenu5(std::vector<std::string>* entries, int* selected) {
animation::easing::ElasticOut); animation::easing::ElasticOut);
option.entries_option.transform = [](EntryState state) { option.entries_option.transform = [](EntryState state) {
Element e = text(state.label) | hcenter | flex; Element e = text(state.label) | hcenter | flex;
if (state.active && state.focused) { if (state.active && state.focused)
e = e | bold; e = e | bold;
} if (!state.focused && !state.active)
if (!state.focused && !state.active) {
e = e | dim; e = e | dim;
}
return e; return e;
}; };
option.underline.color_inactive = Color::Default; option.underline.color_inactive = Color::Default;

View File

@@ -6,6 +6,7 @@
#include <string> // for string, operator+, to_string, basic_string #include <string> // for string, operator+, to_string, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/animation.hpp" // for BackOut, Duration #include "ftxui/component/animation.hpp" // for BackOut, Duration
#include "ftxui/component/component.hpp" // for Menu, Renderer, Vertical #include "ftxui/component/component.hpp" // for Menu, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
@@ -14,15 +15,19 @@
#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, Element, operator|, borderEmpty, inverted #include "ftxui/dom/elements.hpp" // for text, Element, operator|, borderEmpty, inverted
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Red #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Red
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
Component DummyComponent(int id) { Component DummyComponent(int id) {
return Renderer([id](bool focused) { return Renderer([id](bool focused) {
auto t = text("component " + std::to_string(id)); auto t = text("component " + std::to_string(id));
if (focused) { if (focused)
t = t | inverted; t = t | inverted;
}
return t; return t;
}); });
} }

View File

@@ -1,14 +1,22 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved. // Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/component_options.hpp> // for ButtonOption #include <ftxui/component/component_options.hpp> // for ButtonOption
#include <ftxui/component/mouse.hpp> // for ftxui #include <ftxui/component/mouse.hpp> // for ftxui
#endif
#include <functional> // for function #include <functional> // for function
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Button, operator|=, Renderer, Vertical, Modal #include "ftxui/component/component.hpp" // for Button, operator|=, Renderer, Vertical, Modal
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
#include "ftxui/dom/elements.hpp" // for operator|, separator, text, size, Element, vbox, border, GREATER_THAN, WIDTH, center, HEIGHT #include "ftxui/dom/elements.hpp" // for operator|, separator, text, size, Element, vbox, border, GREATER_THAN, WIDTH, center, HEIGHT
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string, char_traits, operator+ #include <string> // for string, basic_string, char_traits, operator+
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Renderer, Horizontal, Tab #include "ftxui/component/component.hpp" // for Button, Renderer, Horizontal, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#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
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -4,11 +4,16 @@
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for operator+, string, char_traits, basic_string #include <string> // for operator+, string, char_traits, basic_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Vertical, Renderer #include "ftxui/component/component.hpp" // for Button, Vertical, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, text, Element, operator|, vbox, border #include "ftxui/dom/elements.hpp" // for separator, text, Element, operator|, vbox, border
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -9,12 +9,17 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for CatchEvent, Renderer #include "ftxui/component/component.hpp" // for CatchEvent, Renderer
#include "ftxui/component/event.hpp" // for Event #include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Middle, Mouse::None, Mouse::Pressed, Mouse::Released, Mouse::Right, Mouse::WheelDown, Mouse::WheelUp #include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Middle, Mouse::None, Mouse::Pressed, Mouse::Released, Mouse::Right, Mouse::WheelDown, Mouse::WheelUp
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, vbox, window, Element, Elements #include "ftxui/dom/elements.hpp" // for text, vbox, window, Element, Elements
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -4,9 +4,13 @@
#include <string> // for string, allocator, basic_string #include <string> // for string, allocator, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox #include "ftxui/component/component.hpp" // for Radiobox
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#else
import ftxui.component;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Renderer #include "ftxui/component/component.hpp" // for Radiobox, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN #include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, HEIGHT, LESS_THAN
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;
@@ -17,9 +22,8 @@ int main() {
std::vector<std::string> entries; std::vector<std::string> entries;
int selected = 0; int selected = 0;
for (int i = 0; i < 30; ++i) { for (int i = 0; i < 30; ++i)
entries.push_back("RadioBox " + std::to_string(i)); entries.push_back("RadioBox " + std::to_string(i));
}
auto radiobox = Radiobox(&entries, &selected); auto radiobox = Radiobox(&entries, &selected);
auto renderer = Renderer(radiobox, [&] { auto renderer = Renderer(radiobox, [&] {
return radiobox->Render() | vscroll_indicator | frame | return radiobox->Render() | vscroll_indicator | frame |

View File

@@ -3,12 +3,18 @@
// the LICENSE file. // the LICENSE file.
#include <memory> // for shared_ptr, allocator, __shared_ptr_access #include <memory> // for shared_ptr, allocator, __shared_ptr_access
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Renderer, Button, Vertical #include "ftxui/component/component.hpp" // for Renderer, Button, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#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
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;
@@ -19,11 +25,10 @@ int main() {
// 1. Example of focusable renderer: // 1. Example of focusable renderer:
auto renderer_focusable = Renderer([](bool focused) { auto renderer_focusable = Renderer([](bool focused) {
if (focused) { if (focused)
return text("FOCUSABLE RENDERER()") | center | bold | border; return text("FOCUSABLE RENDERER()") | center | bold | border;
} else { else
return text(" Focusable renderer() ") | center | border; return text(" Focusable renderer() ") | center | border;
}
}); });
// 2. Examples of a non focusable renderer. // 2. Examples of a non focusable renderer.
@@ -34,11 +39,10 @@ int main() {
// 3. Renderer can wrap other components to redefine their Render() function. // 3. Renderer can wrap other components to redefine their Render() function.
auto button = Button("Wrapped quit button", screen.ExitLoopClosure()); auto button = Button("Wrapped quit button", screen.ExitLoopClosure());
auto renderer_wrap = Renderer(button, [&] { auto renderer_wrap = Renderer(button, [&] {
if (button->Focused()) { if (button->Focused())
return button->Render() | bold | color(Color::Red); return button->Render() | bold | color(Color::Red);
} else { else
return button->Render(); return button->Render();
}
}); });
// Let's renderer everyone: // Let's renderer everyone:

View File

@@ -3,34 +3,34 @@
// the LICENSE file. // the LICENSE file.
#include <memory> // for shared_ptr, allocator, __shared_ptr_access #include <memory> // for shared_ptr, allocator, __shared_ptr_access
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop #include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border #include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;
int main() { int main() {
auto screen = ScreenInteractive::Fullscreen(); auto screen = ScreenInteractive::Fullscreen();
// State: auto middle = Renderer([] { return text("middle") | center; });
auto left = Renderer([] { return text("Left") | center; });
auto right = Renderer([] { return text("right") | center; });
auto top = Renderer([] { return text("top") | center; });
auto bottom = Renderer([] { return text("bottom") | center; });
int left_size = 20; int left_size = 20;
int right_size = 20; int right_size = 20;
int top_size = 10; int top_size = 10;
int bottom_size = 10; int bottom_size = 10;
// Renderers:
auto RendererInfo = [](const std::string& name, int* size) {
return Renderer([name, size] {
return text(name + ": " + std::to_string(*size)) | center;
});
};
auto middle = Renderer([] { return text("Middle") | center; });
auto left = RendererInfo("Left", &left_size);
auto right = RendererInfo("Right", &right_size);
auto top = RendererInfo("Top", &top_size);
auto bottom = RendererInfo("Bottom", &bottom_size);
auto container = middle; auto container = middle;
container = ResizableSplitLeft(left, container, &left_size); container = ResizableSplitLeft(left, container, &left_size);
container = ResizableSplitRight(right, container, &right_size); container = ResizableSplitRight(right, container, &right_size);

View File

@@ -1,43 +0,0 @@
// Copyright 2025 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for shared_ptr, allocator, __shared_ptr_access
#include "ftxui/component/component.hpp" // for Renderer, ResizableSplitBottom, ResizableSplitLeft, ResizableSplitRight, ResizableSplitTop
#include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, operator|, text, center, border
using namespace ftxui;
int main() {
auto screen = ScreenInteractive::Fullscreen();
// State:
int size = 40;
int size_min = 10;
int size_max = 80;
// Renderers:
auto split = ResizableSplit({
.main = Renderer([] { return text("Left") | center; }),
.back = Renderer([] { return text("Right") | center; }),
.direction = Direction::Left,
.main_size = &size,
.min = &size_min,
.max = &size_max,
});
auto renderer = Renderer(split, [&] {
return window(text("Drag the separator with the mouse"),
vbox({
text("Min: " + std::to_string(size_min)),
text("Max: " + std::to_string(size_max)),
text("Size: " + std::to_string(size)),
separator(),
split->Render() | flex,
}));
});
screen.Loop(renderer);
}

View File

@@ -1,9 +1,17 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved. // Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cstdlib>
#include <functional>
#include <string>
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/component.hpp> #include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp> #include <ftxui/component/screen_interactive.hpp>
#include <string> #else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -3,12 +3,18 @@
// the LICENSE file. // the LICENSE file.
#include <string> // for char_traits, operator+, string, basic_string #include <string> // for char_traits, operator+, string, basic_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/component.hpp" // for Input, Renderer, Vertical #include "ftxui/component/component.hpp" // for Input, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for InputOption #include "ftxui/component/component_options.hpp" // for InputOption
#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, 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
#else
import ftxui.component;
import ftxui.dom;
import ftxui.util;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -1,6 +1,10 @@
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Slider #include "ftxui/component/component.hpp" // for Slider
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#else
import ftxui.component;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -3,16 +3,24 @@
// the LICENSE file. // the LICENSE file.
#include <array> // for array #include <array> // for array
#include <cmath> // for sin #include <cmath> // for sin
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/component_base.hpp> // for ComponentBase #include <ftxui/component/component_base.hpp> // for ComponentBase
#include <ftxui/component/component_options.hpp> // for SliderOption #include <ftxui/component/component_options.hpp> // for SliderOption
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Up #include <ftxui/dom/direction.hpp> // for Direction, Direction::Up
#include <ftxui/dom/elements.hpp> // for size, GREATER_THAN, HEIGHT #include <ftxui/dom/elements.hpp> // for size, GREATER_THAN, HEIGHT
#include <ftxui/util/ref.hpp> // for ConstRef, Ref #include <ftxui/util/ref.hpp> // for ConstRef, Ref
#endif
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Horizontal, Slider, operator|= #include "ftxui/component/component.hpp" // for Horizontal, Slider, operator|=
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#else
import ftxui.component;
import ftxui.dom;
import ftxui.util;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -4,12 +4,18 @@
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for char_traits, operator+, to_string #include <string> // for char_traits, operator+, to_string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical #include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for separator, operator|, Element, size, text, vbox, xflex, bgcolor, hbox, GREATER_THAN, WIDTH, border, HEIGHT, LESS_THAN #include "ftxui/dom/elements.hpp" // for separator, operator|, Element, size, text, vbox, xflex, bgcolor, hbox, GREATER_THAN, WIDTH, border, HEIGHT, LESS_THAN
#include "ftxui/screen/color.hpp" // for Color #include "ftxui/screen/color.hpp" // for Color
#else
import ftxui.component;
import ftxui.dom;
import ftxui.screen;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Renderer, Tab, Toggle, Vertical #include "ftxui/component/component.hpp" // for Radiobox, Renderer, Tab, Toggle, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, separator, operator|, vbox, border #include "ftxui/dom/elements.hpp" // for Element, separator, operator|, vbox, border
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Horizontal, Menu, Renderer, Tab #include "ftxui/component/component.hpp" // for Radiobox, Horizontal, Menu, Renderer, Tab
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for Element, separator, hbox, operator|, border #include "ftxui/dom/elements.hpp" // for Element, separator, hbox, operator|, border
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -4,11 +4,16 @@
#include <memory> // for allocator, __shared_ptr_access, shared_ptr #include <memory> // for allocator, __shared_ptr_access, shared_ptr
#include <string> // for string #include <string> // for string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Input, Renderer, ResizableSplitLeft #include "ftxui/component/component.hpp" // for Input, Renderer, ResizableSplitLeft
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, separator, text, Element, flex, vbox, border #include "ftxui/dom/elements.hpp" // for operator|, separator, text, Element, flex, vbox, border
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -5,11 +5,16 @@
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Toggle, Renderer, Vertical #include "ftxui/component/component.hpp" // for Toggle, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#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, hbox, vbox, Element #include "ftxui/dom/elements.hpp" // for text, hbox, vbox, Element
#else
import ftxui.component;
import ftxui.dom;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -1,9 +1,16 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved. // Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <cstdlib>
#include <functional>
#include <string>
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/component/component.hpp> #include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp> #include <ftxui/component/screen_interactive.hpp>
#include <string> #else
import ftxui.component;
#endif
using namespace ftxui; using namespace ftxui;

View File

@@ -6,11 +6,16 @@
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <memory> // for shared_ptr, __shared_ptr_access, allocator
#include <string> // for getline, string #include <string> // for getline, string
#ifndef FTXUI_BUILD_MODULES
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer #include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, filler, Element, borderEmpty, hbox, size, paragraph, vbox, LESS_THAN, border, center, HEIGHT, WIDTH #include "ftxui/dom/elements.hpp" // for operator|, filler, Element, borderEmpty, hbox, size, paragraph, vbox, LESS_THAN, border, center, HEIGHT, WIDTH
#else
import ftxui.component;
import ftxui.dom;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

View File

@@ -2,12 +2,19 @@
// Use of this source code is governed by the MIT license that can be found in // Use of this source code is governed by the MIT license that can be found in
// the LICENSE file. // the LICENSE file.
#include <stdlib.h> // for EXIT_SUCCESS #include <stdlib.h> // for EXIT_SUCCESS
#ifndef FTXUI_BUILD_MODULES
#include <ftxui/dom/elements.hpp> // for text, operator|, vbox, border, Element, Fit, hbox #include <ftxui/dom/elements.hpp> // for text, operator|, vbox, border, Element, Fit, hbox
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#endif
#include <memory> // for allocator #include <memory> // for allocator
#ifndef FTXUI_BUILD_MODULES
#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
#else
import ftxui.dom;
import ftxui.screen;
#endif
int main() { int main() {
using namespace ftxui; using namespace ftxui;

Some files were not shown because too many files have changed in this diff Show More