mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Compare commits
20 Commits
118949b295
...
HarryPehko
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dad2eaaa28 | ||
|
|
5c3e3151a5 | ||
|
|
143b24c6a5 | ||
|
|
40e1fac3d4 | ||
|
|
8ef18ab647 | ||
|
|
994915dbb9 | ||
|
|
3b359e8cd7 | ||
|
|
1073ba414d | ||
|
|
b78b97056b | ||
|
|
68fc9b1212 | ||
|
|
6440a88dc6 | ||
|
|
14da21b0ee | ||
|
|
a86d8f32d7 | ||
|
|
3367c3a005 | ||
|
|
44dcd41b5e | ||
|
|
96d817217c | ||
|
|
bbe6d1e0a3 | ||
|
|
b65bbce9bb | ||
|
|
fe86d06595 | ||
|
|
ba81d364cf |
2
.bazelrc
2
.bazelrc
@@ -1,3 +1,5 @@
|
|||||||
|
common --enable_bzlmod
|
||||||
|
|
||||||
build --features=layering_check
|
build --features=layering_check
|
||||||
build --enable_bzlmod
|
build --enable_bzlmod
|
||||||
|
|
||||||
|
|||||||
@@ -2,3 +2,6 @@
|
|||||||
# 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
|
||||||
|
|||||||
141
.github/workflows/build.yaml
vendored
141
.github/workflows/build.yaml
vendored
@@ -209,144 +209,3 @@ 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
|
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -44,6 +44,7 @@ out/
|
|||||||
!doc/**/*.html
|
!doc/**/*.html
|
||||||
!doc/**/*.xml
|
!doc/**/*.xml
|
||||||
!doc/**/*.md
|
!doc/**/*.md
|
||||||
|
!doc/*.md
|
||||||
|
|
||||||
# examples directory:
|
# examples directory:
|
||||||
!examples/**/*.cpp
|
!examples/**/*.cpp
|
||||||
|
|||||||
10
BUILD.bazel
10
BUILD.bazel
@@ -13,7 +13,6 @@ 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 is just an alias for
|
# Note that component depends on dom and screen, so ftxui is just an alias for
|
||||||
@@ -159,11 +158,18 @@ 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",
|
||||||
"src/ftxui/component/window.cpp",
|
"src/ftxui/component/window.cpp",
|
||||||
|
|
||||||
|
|
||||||
# Private header from ftxui:dom.
|
# Private header from ftxui:dom.
|
||||||
"src/ftxui/dom/node_decorator.hpp",
|
"src/ftxui/dom/node_decorator.hpp",
|
||||||
|
|
||||||
@@ -184,7 +190,6 @@ 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",
|
||||||
@@ -207,7 +212,6 @@ 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",
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ Next
|
|||||||
import ftxui.util;
|
import ftxui.util;
|
||||||
```
|
```
|
||||||
Thanks @mikomikotaishi for PR #1015.
|
Thanks @mikomikotaishi for PR #1015.
|
||||||
|
- Remove dependency on 'pthread'.
|
||||||
|
|
||||||
|
### Component
|
||||||
|
- Fix ScreenInteractive::FixedSize screen stomps on the preceding terminal
|
||||||
|
output. Thanks @zozowell in #1064.
|
||||||
|
|
||||||
|
|
||||||
6.1.9 (2025-05-07)
|
6.1.9 (2025-05-07)
|
||||||
|
|||||||
@@ -144,26 +144,20 @@ 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
|
target_link_libraries(dom PUBLIC screen)
|
||||||
PUBLIC screen
|
target_link_libraries(component PUBLIC dom)
|
||||||
)
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -18,7 +18,7 @@
|
|||||||
<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.html">Examples</a> .
|
<a href="https://arthursonzogni.github.io/FTXUI/examples/">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>
|
||||||
|
|
||||||
@@ -39,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.
|
||||||
* Module support
|
* [C++20 Module support](https://arthursonzogni.github.io/FTXUI/cpp20-modules.html)
|
||||||
* **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:
|
||||||
@@ -50,7 +50,9 @@ 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
|
||||||
@@ -96,7 +98,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 the `flex` decorator.
|
Element can become flexible using 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`.
|
||||||
|
|
||||||
@@ -376,6 +378,8 @@ 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.
|
||||||
@@ -429,6 +433,7 @@ 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),
|
||||||
[](https://repology.org/project/libftxui/versions)
|
[](https://repology.org/project/libftxui/versions)
|
||||||
|
|
||||||
|
|
||||||
@@ -437,7 +442,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, ensure that you are using a generator like Ninja or Visual Studio that supports modules, and pass the flag `FTXUI_BUILD_MODULES`.
|
To build FTXUI with modules, check [documentation](https://arthursonzogni.github.io/FTXUI/cpp20-modules.html)
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
|||||||
@@ -43,16 +43,6 @@ 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 = [],
|
||||||
|
|||||||
@@ -6,76 +6,78 @@ 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/CapturedMouse.cppm
|
src/ftxui/component/captured_mouse.cppm
|
||||||
src/ftxui/component/Component.cppm
|
src/ftxui/component/component.cppm
|
||||||
src/ftxui/component/ComponentBase.cppm
|
src/ftxui/component/component_base.cppm
|
||||||
src/ftxui/component/ComponentOptions.cppm
|
src/ftxui/component/component_options.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/ScreenInteractive.cppm
|
src/ftxui/component/screen_interactive.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/FlexboxConfig.cppm
|
src/ftxui/dom/flexbox_config.cppm
|
||||||
src/ftxui/dom/LinearGradient.cppm
|
src/ftxui/dom/linear_gradient.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/ColorInfo.cppm
|
src/ftxui/screen/color_info.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(${name} PUBLIC -fmodules-ts)
|
target_compile_options(ftxui-modules 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()
|
||||||
|
|||||||
@@ -101,6 +101,5 @@ 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()
|
||||||
|
|||||||
@@ -19,11 +19,10 @@ 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
|
||||||
@@ -51,6 +50,7 @@ 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
|
||||||
|
|||||||
@@ -1001,48 +1001,12 @@ 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 \
|
||||||
*.mm \
|
*.cppm \
|
||||||
*.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.
|
||||||
|
|||||||
107
doc/cpp20-modules.md
Normal file
107
doc/cpp20-modules.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
@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++20 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 header has a
|
||||||
|
corresponding module.
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto screen = ftxui::ScreenInteractive::TerminalOutput();
|
||||||
|
auto button = ftxui::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.component.Animation`
|
||||||
|
- `ftxui.component.CapturedMouse`
|
||||||
|
- `ftxui.component.Component`
|
||||||
|
- `ftxui.component.ComponentBase`
|
||||||
|
- `ftxui.component.ComponentOptions`
|
||||||
|
- `ftxui.component.Event`
|
||||||
|
- `ftxui.component.Loop`
|
||||||
|
- `ftxui.component.Mouse`
|
||||||
|
- `ftxui.component.Receiver`
|
||||||
|
- `ftxui.component.ScreenInteractive`
|
||||||
|
- `ftxui.component.Task`
|
||||||
|
- `ftxui.dom`
|
||||||
|
- `ftxui.dom.Canvas`
|
||||||
|
- `ftxui.dom.Deprecated`
|
||||||
|
- `ftxui.dom.Direction`
|
||||||
|
- `ftxui.dom.Elements`
|
||||||
|
- `ftxui.dom.FlexboxConfig`
|
||||||
|
- `ftxui.dom.LinearGradient`
|
||||||
|
- `ftxui.dom.Node`
|
||||||
|
- `ftxui.dom.Requirement`
|
||||||
|
- `ftxui.dom.Selection`
|
||||||
|
- `ftxui.dom.Table`
|
||||||
|
- `ftxui.screen`
|
||||||
|
- `ftxui.screen.Box`
|
||||||
|
- `ftxui.screen.Color`
|
||||||
|
- `ftxui.screen.ColorInfo`
|
||||||
|
- `ftxui.screen.Deprecated`
|
||||||
|
- `ftxui.screen.Image`
|
||||||
|
- `ftxui.screen.Pixel`
|
||||||
|
- `ftxui.screen.Screen`
|
||||||
|
- `ftxui.screen.String`
|
||||||
|
- `ftxui.screen.Terminal`
|
||||||
|
- `ftxui.util`
|
||||||
|
- `ftxui.util.AutoReset`
|
||||||
|
- `ftxui.util.Ref`
|
||||||
@@ -91,6 +91,39 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<script type="module">
|
||||||
|
// 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
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ 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
|
||||||
|
|
||||||
|
|||||||
34
doc/installation_arch.md
Normal file
34
doc/installation_arch.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
@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>
|
||||||
@@ -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.
|
||||||
|
|
||||||
```fortran
|
```cmake
|
||||||
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:
|
||||||
|
|
||||||
```fortran
|
```cmake
|
||||||
fortranind_package(ftxui REQUIRED)
|
find_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:
|
||||||
|
|
||||||
```fortran
|
```cmake
|
||||||
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`:
|
||||||
|
|
||||||
```fortran
|
```cmake
|
||||||
add_subdirectory(external/ftxui)
|
add_subdirectory(external/ftxui)
|
||||||
|
|
||||||
add_executable(main main.cpp)
|
add_executable(main main.cpp)
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
@page installation_conan Conan
|
@page installation_conan Conan
|
||||||
@tableofcontents
|
|
||||||
|
|
||||||
## Conan Package
|
Unofficial recipe for FTXUI exists on Conan Center:
|
||||||
|
<https://conan.io/center/recipes/ftxui>
|
||||||
|
|
||||||
Unofficial support for FTXUI exists on Conan Center:
|
> [!note]
|
||||||
|
> This is an unofficial recipe. 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!
|
||||||
|
|
||||||
- https://conan.io/center/recipes/ftxui
|
|
||||||
|
|
||||||
## TODO
|
@todo Add instructions on how to use the conan recipe.
|
||||||
|
|
||||||
This page is incomplete. If you use FTXUI with Conan and can provide a minimal working setup, feel free to contribute.
|
@todo Please consider adding an "official" recipe to Conan Center if know how.
|
||||||
|
It could be a github action that will automatically update the conan center
|
||||||
|
when a new release is made.
|
||||||
|
|
||||||
<div class="section_buttons">
|
<div class="section_buttons">
|
||||||
|
|
||||||
|
|||||||
42
doc/installation_debian.md
Normal file
42
doc/installation_debian.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
@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>
|
||||||
35
doc/installation_manual.md
Normal file
35
doc/installation_manual.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
@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 -DFTXUI_ENABLE_INSTALL=ON -D
|
||||||
|
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>
|
||||||
38
doc/installation_nix.md
Normal file
38
doc/installation_nix.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
@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>
|
||||||
32
doc/installation_opensuse.md
Normal file
32
doc/installation_opensuse.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
@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>
|
||||||
@@ -1,15 +1,74 @@
|
|||||||
@page installation_vcpkg Vcpkg
|
@page installation_vcpkg Vcpkg
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
## Vcpkg Package
|
# Vcpkg Package
|
||||||
|
|
||||||
FTXUI is available in the Vcpkg registry:
|
FTXUI is available in the [Vcpkg registry](https://vcpkg.link/ports/ftxui)
|
||||||
|
|
||||||
|
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">
|
||||||
|
|
||||||
|
|||||||
40
doc/installation_xmake.md
Normal file
40
doc/installation_xmake.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
@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>
|
||||||
@@ -14,7 +14,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 component is used to define how to
|
between two components. The tree of components 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.
|
||||||
@@ -45,7 +45,7 @@ Produced by: `ftxui::Input()` from "ftxui/component/component.hpp"
|
|||||||
|
|
||||||
## Filtered input
|
## Filtered input
|
||||||
|
|
||||||
On can filter out the characters received by the input component, using
|
One can filter out the characters received by the input component, using
|
||||||
`ftxui::CatchEvent`.
|
`ftxui::CatchEvent`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@@ -123,8 +123,8 @@ Produced by: `ftxui::Radiobox()` from "ftxui/component/component.hpp"
|
|||||||
|
|
||||||
# Dropdown {#component-dropdown}
|
# Dropdown {#component-dropdown}
|
||||||
|
|
||||||
A drop down menu is a component that when checked display a list of element for
|
A drop-down menu is a component that, when opened, displays a list of elements
|
||||||
the user to select one.
|
for the user to select from.
|
||||||
|
|
||||||
[Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2dropdown_8cpp-example.html):
|
[Example](https://arthursonzogni.github.io/FTXUI/examples_2component_2dropdown_8cpp-example.html):
|
||||||
|
|
||||||
@@ -204,12 +204,12 @@ component = component
|
|||||||
|
|
||||||
# Collapsible {#component-collapsible}
|
# Collapsible {#component-collapsible}
|
||||||
|
|
||||||
Useful for visual elements whose visibility can be toggle on/off by the user.
|
Useful for visual elements whose visibility can be toggled on or off by the
|
||||||
Essentially, this the combination of the `ftxui::Checkbox()` and
|
user. Essentially, this is the combination of the `ftxui::Checkbox()` and
|
||||||
`ftxui::Maybe()` components.
|
`ftxui::Maybe()` components.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
auto collabsible = Collapsible("Show more", inner_element);
|
auto collapsible = Collapsible("Show more", inner_element);
|
||||||
```
|
```
|
||||||
|
|
||||||
# Maybe {#component-maybe}
|
# Maybe {#component-maybe}
|
||||||
@@ -245,7 +245,7 @@ component = component
|
|||||||
|
|
||||||
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 handle keyboard/mouse navigation.
|
and handles keyboard/mouse navigation.
|
||||||
|
|
||||||
## Vertical {#component-vertical}
|
## Vertical {#component-vertical}
|
||||||
|
|
||||||
@@ -256,8 +256,8 @@ 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 take a list of component and display only
|
"ftxui/component/component.hpp". It takes a list of components and displays
|
||||||
one of them. This is useful for implementing a tab bar.
|
only 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):
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ Code:
|
|||||||
border(gauge(0.5))
|
border(gauge(0.5))
|
||||||
```
|
```
|
||||||
|
|
||||||
Teminal output:
|
Terminal output:
|
||||||
```bash
|
```bash
|
||||||
┌────────────────────────────────────────────────────────────────────────────┐
|
┌────────────────────────────────────────────────────────────────────────────┐
|
||||||
│██████████████████████████████████████ │
|
│██████████████████████████████████████ │
|
||||||
@@ -407,7 +407,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 the `ftxui::flex` decorator.
|
Element can also become flexible using the `ftxui::flex` decorator.
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
```cpp
|
```cpp
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Modules {#modules}
|
# ftxui {#ftxui}
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
58
doc/posix_pipe.md
Normal file
58
doc/posix_pipe.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# 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);
|
||||||
|
```
|
||||||
@@ -34,6 +34,7 @@ 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 */
|
||||||
|
|||||||
@@ -15,15 +15,11 @@ 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.html"
|
"index.html"
|
||||||
"index.mjs"
|
"index.mjs"
|
||||||
"index.css"
|
"index.css"
|
||||||
"sw.js"
|
|
||||||
"run_webassembly.py")
|
"run_webassembly.py")
|
||||||
configure_file(${file} ${file})
|
configure_file(${file} ${file})
|
||||||
endforeach(file)
|
endforeach(file)
|
||||||
|
|||||||
@@ -4,17 +4,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -24,7 +18,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 ButtonStyle() {
|
ButtonOption Style() {
|
||||||
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);
|
||||||
@@ -39,20 +33,19 @@ ButtonOption ButtonStyle() {
|
|||||||
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({
|
Container::Horizontal({btn_dec_01, btn_inc_01}, &row) | flex,
|
||||||
Button(
|
Container::Horizontal({btn_dec_10, btn_inc_10}, &row) | flex,
|
||||||
"-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:
|
||||||
@@ -65,7 +58,7 @@ int main() {
|
|||||||
flex | border;
|
flex | border;
|
||||||
});
|
});
|
||||||
|
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
screen.Loop(component);
|
screen.Loop(component);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#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
|
||||||
@@ -12,11 +11,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#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
|
||||||
@@ -12,11 +11,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// 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
|
||||||
@@ -11,11 +10,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,13 @@
|
|||||||
// 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
|
||||||
@@ -21,11 +16,6 @@
|
|||||||
#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;
|
||||||
@@ -143,8 +133,9 @@ 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));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -3,25 +3,16 @@
|
|||||||
// 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;
|
||||||
|
|||||||
@@ -4,13 +4,9 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -4,13 +4,9 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#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
|
||||||
@@ -14,11 +13,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -88,10 +82,12 @@ 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,10 +121,12 @@ 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;
|
||||||
|
|||||||
@@ -5,18 +5,12 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
// 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;
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
// 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
|
||||||
@@ -14,8 +15,6 @@
|
|||||||
#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
|
||||||
@@ -26,11 +25,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -276,7 +270,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 / 2) | bold |
|
entries.push_back(spinner(i, shift / 5) | bold |
|
||||||
size(WIDTH, GREATER_THAN, 2) | border);
|
size(WIDTH, GREATER_THAN, 2) | border);
|
||||||
}
|
}
|
||||||
return hflow(std::move(entries));
|
return hflow(std::move(entries));
|
||||||
@@ -519,24 +513,20 @@ int main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
std::atomic<bool> refresh_ui_continue = true;
|
Loop loop(&screen, main_renderer);
|
||||||
std::thread refresh_ui([&] {
|
while (!loop.HasQuitted()) {
|
||||||
while (refresh_ui_continue) {
|
// Update the state of the application.
|
||||||
using namespace std::chrono_literals;
|
shift++;
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
screen.Loop(main_renderer);
|
// Request a new frame to be drawn.
|
||||||
refresh_ui_continue = false;
|
screen.RequestAnimationFrame();
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#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
|
||||||
@@ -12,11 +11,6 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -1,26 +1,17 @@
|
|||||||
// 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;
|
||||||
|
|||||||
@@ -1,25 +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.
|
||||||
#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;
|
||||||
|
|||||||
@@ -4,18 +4,12 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,10 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -6,17 +6,12 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#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
|
||||||
@@ -14,11 +13,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -28,10 +22,12 @@ 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;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#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
|
||||||
@@ -13,11 +12,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -22,8 +17,9 @@ 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 |
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -22,8 +17,9 @@ 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; });
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#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
|
||||||
@@ -17,11 +16,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -122,10 +116,12 @@ 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);
|
||||||
@@ -136,10 +132,12 @@ 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);
|
||||||
@@ -150,13 +148,16 @@ 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);
|
||||||
@@ -251,10 +252,12 @@ 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;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#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
|
||||||
@@ -15,19 +14,15 @@
|
|||||||
#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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
// 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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -4,16 +4,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,9 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
@@ -22,8 +17,9 @@ 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 |
|
||||||
|
|||||||
@@ -3,18 +3,12 @@
|
|||||||
// 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;
|
||||||
@@ -25,10 +19,11 @@ 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.
|
||||||
@@ -39,10 +34,11 @@ 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:
|
||||||
|
|||||||
@@ -3,17 +3,11 @@
|
|||||||
// 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, 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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
// 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>
|
||||||
#else
|
#include <string>
|
||||||
import ftxui.component;
|
|
||||||
import ftxui.dom;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
|
|||||||
@@ -3,18 +3,12 @@
|
|||||||
// 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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -3,24 +3,16 @@
|
|||||||
// 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;
|
||||||
|
|
||||||
|
|||||||
@@ -4,18 +4,12 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,11 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -5,16 +5,11 @@
|
|||||||
#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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
// 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>
|
||||||
#else
|
#include <string>
|
||||||
import ftxui.component;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -2,19 +2,12 @@
|
|||||||
// 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;
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
// 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/elements.hpp> // for operator|, text, Element, Fit, borderDouble, borderHeavy, borderLight, borderRounded, vbox
|
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, Fit, borderDouble, borderHeavy, borderLight, borderRounded, vbox
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for endl, cout, ostream
|
#include <iostream> // for endl, cout, ostream
|
||||||
#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;
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
// 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/elements.hpp> // for operator|, text, Element, Fit, borderDouble, borderHeavy, borderLight, borderRounded, vbox
|
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, Fit, borderDouble, borderHeavy, borderLight, borderRounded, vbox
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for endl, cout, ostream
|
#include <iostream> // for endl, cout, ostream
|
||||||
#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;
|
||||||
|
|||||||
@@ -3,22 +3,13 @@
|
|||||||
// the LICENSE file.
|
// the LICENSE file.
|
||||||
#include <stdio.h> // for getchar
|
#include <stdio.h> // for getchar
|
||||||
#include <cmath> // for cos
|
#include <cmath> // for cos
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
|
#include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
|
||||||
#include <ftxui/screen/screen.hpp> // for Pixel, Screen
|
#include <ftxui/screen/screen.hpp> // for Pixel, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vector> // for vector, allocator
|
#include <vector> // for vector, allocator
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/canvas.hpp" // for Canvas
|
#include "ftxui/dom/canvas.hpp" // for Canvas
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
@@ -41,10 +32,12 @@ int main() {
|
|||||||
|
|
||||||
// Plot a function:
|
// Plot a function:
|
||||||
std::vector<int> ys(100);
|
std::vector<int> ys(100);
|
||||||
for (int x = 0; x < 100; x++)
|
for (int x = 0; x < 100; x++) {
|
||||||
ys[x] = int(80 + 20 * cos(x * 0.2));
|
ys[x] = int(80 + 20 * cos(x * 0.2));
|
||||||
for (int x = 0; x < 99; x++)
|
}
|
||||||
|
for (int x = 0; x < 99; x++) {
|
||||||
c.DrawPointLine(x, ys[x], x + 1, ys[x + 1], Color::Red);
|
c.DrawPointLine(x, ys[x], x + 1, ys[x + 1], Color::Red);
|
||||||
|
}
|
||||||
|
|
||||||
auto document = canvas(&c) | border;
|
auto document = canvas(&c) | border;
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
// 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/screen/color_info.hpp> // for ColorInfo
|
#include <ftxui/screen/color_info.hpp> // for ColorInfo
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#include <ftxui/screen/terminal.hpp> // for ColorSupport, Color, Palette16, Palette256, TrueColor
|
#include <ftxui/screen/terminal.hpp> // for ColorSupport, Color, Palette16, Palette256, TrueColor
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory> // for allocator, shared_ptr
|
#include <memory> // for allocator, shared_ptr
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, hbox, separator, operator|, Elements, Element, Fit, border
|
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, hbox, separator, operator|, Elements, Element, Fit, border
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::White, Color::Yellow, Color::YellowLight, Color::Palette256, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::White, Color::Yellow, Color::YellowLight, Color::Palette256, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
// 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/elements.hpp> // for text, bgcolor, hbox, operator|, Elements, Fit, vbox, Element
|
#include <ftxui/dom/elements.hpp> // for text, bgcolor, hbox, operator|, Elements, Fit, vbox, Element
|
||||||
#include <ftxui/screen/color_info.hpp> // for ColorInfo
|
#include <ftxui/screen/color_info.hpp> // for ColorInfo
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
#include <vector> // for vector, allocator
|
#include <vector> // for vector, 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 Color, Color::Palette256, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Palette256, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <ftxui/screen/color_info.hpp> // for ftxui::ColorInfo
|
#include <ftxui/screen/color_info.hpp> // for ftxui::ColorInfo
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
// 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/elements.hpp> // for operator|, Elements, Fit, bgcolor, color, hbox, text, vbox, Element
|
#include <ftxui/dom/elements.hpp> // for operator|, Elements, Fit, bgcolor, color, hbox, text, vbox, Element
|
||||||
#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
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
// 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/elements.hpp> // for hbox, text, bgcolor, operator|, vbox, Elements, window, Element, Fit
|
#include <ftxui/dom/elements.hpp> // for hbox, text, bgcolor, operator|, vbox, Elements, window, Element, Fit
|
||||||
#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
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
// 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/elements.hpp> // for text, operator|, border, Element, vbox, center, Fit, dbox
|
#include <ftxui/dom/elements.hpp> // for text, operator|, border, Element, vbox, center, Fit, dbox
|
||||||
#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;
|
||||||
|
|||||||
@@ -2,23 +2,14 @@
|
|||||||
// 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 <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for text, gauge, operator|, flex, hbox, Element
|
#include <ftxui/dom/elements.hpp> // for text, gauge, operator|, flex, hbox, Element
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for cout, endl, ostream
|
#include <iostream> // for cout, endl, ostream
|
||||||
#include <string> // for allocator, char_traits, operator+, operator<<, string, to_string, basic_string
|
#include <string> // for allocator, char_traits, operator+, operator<<, string, to_string, basic_string
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
|
|
||||||
#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;
|
||||||
|
|||||||
@@ -2,23 +2,14 @@
|
|||||||
// 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 <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for filler, operator|, separator, text, border, Element, vbox, vtext, hbox, center, gaugeDown, gaugeLeft, gaugeRight, gaugeUp
|
#include <ftxui/dom/elements.hpp> // for filler, operator|, separator, text, border, Element, vbox, vtext, hbox, center, gaugeDown, gaugeLeft, gaugeRight, gaugeUp
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for cout, endl, ostream
|
#include <iostream> // for cout, endl, ostream
|
||||||
#include <string> // for allocator, operator+, operator<<, string, to_string
|
#include <string> // for allocator, operator+, operator<<, string, to_string
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
|
|
||||||
#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;
|
||||||
|
|||||||
@@ -3,12 +3,8 @@
|
|||||||
// the LICENSE file.
|
// the LICENSE file.
|
||||||
#include <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
#include <cmath> // for sin
|
#include <cmath> // for sin
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for graph, operator|, separator, color, Element, vbox, flex, inverted, operator|=, Fit, hbox, size, border, GREATER_THAN, HEIGHT
|
#include <ftxui/dom/elements.hpp> // for graph, operator|, separator, color, Element, vbox, flex, inverted, operator|=, Fit, hbox, size, border, GREATER_THAN, HEIGHT
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <functional> // for ref, reference_wrapper
|
#include <functional> // for ref, reference_wrapper
|
||||||
#include <iostream> // for cout, ostream
|
#include <iostream> // for cout, ostream
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
@@ -17,13 +13,8 @@
|
|||||||
#include <utility> // for ignore
|
#include <utility> // for ignore
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Graph {
|
class Graph {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,21 +2,12 @@
|
|||||||
// 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 <stdio.h> // for getchar
|
#include <stdio.h> // for getchar
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for Elements, gridbox, Fit, operator|, text, border, Element
|
#include <ftxui/dom/elements.hpp> // for Elements, gridbox, Fit, operator|, text, border, Element
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory> // for allocator, shared_ptr
|
#include <memory> // for allocator, shared_ptr
|
||||||
|
|
||||||
#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;
|
||||||
|
|||||||
@@ -2,21 +2,12 @@
|
|||||||
// 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 <stdio.h> // for getchar
|
#include <stdio.h> // for getchar
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for operator|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN
|
#include <ftxui/dom/elements.hpp> // for operator|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string> // for allocator, char_traits, operator+, to_string, string
|
#include <string> // for allocator, char_traits, operator+, to_string, string
|
||||||
|
|
||||||
#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;
|
||||||
|
|||||||
@@ -2,24 +2,15 @@
|
|||||||
// 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 <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/screen/screen.hpp> // for Screen
|
#include <ftxui/screen/screen.hpp> // for Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for cout, ostream
|
#include <iostream> // for cout, ostream
|
||||||
#include <string> // for allocator, operator<<, string
|
#include <string> // for allocator, operator<<, string
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/elements.hpp" // for paragraph, text, operator|, Element, border, Fit, color, hflow, spinner, vbox, bold, dim, underlined
|
#include "ftxui/dom/elements.hpp" // for paragraph, text, operator|, Element, border, Fit, color, hflow, spinner, vbox, bold, dim, underlined
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/box.hpp" // for ftxui
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
// 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/dom/elements.hpp> // for bgcolor, operator|, operator|=, text, center, Element
|
#include <ftxui/dom/elements.hpp> // for bgcolor, operator|, operator|=, text, center, Element
|
||||||
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient
|
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory> // for allocator, shared_ptr
|
#include <memory> // for allocator, shared_ptr
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::DeepPink1, Color::DeepSkyBlue1, Color::Yellow, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::DeepPink1, Color::DeepSkyBlue1, Color::Yellow, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|||||||
@@ -2,12 +2,8 @@
|
|||||||
// 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 <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, hbox, bold, color, filler, separator, vbox, window, gauge, Fit, size, dim, EQUAL, WIDTH
|
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, hbox, bold, color, filler, separator, vbox, window, gauge, Fit, size, dim, EQUAL, WIDTH
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for cout, endl, ostream
|
#include <iostream> // for cout, endl, ostream
|
||||||
#include <list> // for list, operator==, _List_iterator, _List_iterator<>::_Self
|
#include <list> // for list, operator==, _List_iterator, _List_iterator<>::_Self
|
||||||
#include <memory> // for allocator, shared_ptr, allocator_traits<>::value_type
|
#include <memory> // for allocator, shared_ptr, allocator_traits<>::value_type
|
||||||
@@ -16,13 +12,8 @@
|
|||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
|
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
@@ -95,8 +86,9 @@ int main() {
|
|||||||
|
|
||||||
auto render = [&]() {
|
auto render = [&]() {
|
||||||
std::vector<Element> entries;
|
std::vector<Element> entries;
|
||||||
for (auto& task : displayed_task)
|
for (auto& task : displayed_task) {
|
||||||
entries.push_back(renderTask(task));
|
entries.push_back(renderTask(task));
|
||||||
|
}
|
||||||
|
|
||||||
return vbox({
|
return vbox({
|
||||||
// List of tasks.
|
// List of tasks.
|
||||||
@@ -147,8 +139,9 @@ int main() {
|
|||||||
std::this_thread::sleep_for(0.01s);
|
std::this_thread::sleep_for(0.01s);
|
||||||
|
|
||||||
// Exit
|
// Exit
|
||||||
if (nb_active + nb_queued == 0)
|
if (nb_active + nb_queued == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the model for the next frame.
|
// Update the model for the next frame.
|
||||||
updateModel();
|
updateModel();
|
||||||
|
|||||||
@@ -2,24 +2,15 @@
|
|||||||
// 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 <chrono> // for operator""s, chrono_literals
|
#include <chrono> // for operator""s, chrono_literals
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream> // for cout, ostream
|
#include <iostream> // for cout, ostream
|
||||||
#include <memory> // for allocator, shared_ptr
|
#include <memory> // for allocator, shared_ptr
|
||||||
#include <string> // for string, operator<<
|
#include <string> // for string, operator<<
|
||||||
#include <thread> // for sleep_for
|
#include <thread> // for sleep_for
|
||||||
|
|
||||||
#ifndef FTXUI_BUILD_MODULES
|
|
||||||
#include "ftxui/dom/elements.hpp" // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element
|
#include "ftxui/dom/elements.hpp" // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element
|
||||||
#include "ftxui/dom/node.hpp" // for Render
|
#include "ftxui/dom/node.hpp" // for Render
|
||||||
#include "ftxui/screen/box.hpp" // for ftxui
|
#include "ftxui/screen/box.hpp" // for ftxui
|
||||||
#else
|
|
||||||
import ftxui.dom;
|
|
||||||
import ftxui.screen;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
int main() {
|
int main() {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user