35 Commits

Author SHA1 Message Date
ArthurSonzogni
0200632555 Update CHANGELOG for v4.2 2023-07-26 00:04:11 +02:00
ArthurSonzogni
ce252ff92e Add missing includes for gcc
Bug:https://github.com/ArthurSonzogni/FTXUI/issues/695
2023-07-25 23:55:41 +02:00
cblack-dev
afb03620da Resolve unused varaible warning in _WIN32 builds of screen_interactive.cpp (#693)
Marks constexpr int timeout_microseconds on line 73 as [[maybe_unused]] to resolve unused variable warning on _WIN32 builds.
2023-07-25 23:54:51 +02:00
Stefan Ravn van Overeem
de6749fed7 Improve unicode codepoint Bisearch performance (#691)
Improve the performance of the functions for searching for codepoints
in a table by passing the table array in as a reference instead of copying
it.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-07-25 23:54:45 +02:00
Stefan Ravn van Overeem
2bcdb9ac54 Support Fn keys for every terminal standards (#689)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-07-25 23:54:39 +02:00
Arthur Sonzogni
2ed61a9d31 Support F1-F5 from OS terminal (#687)
Bug:https://github.com/ArthurSonzogni/FTXUI/issues/685
2023-07-25 23:53:20 +02:00
Arthur Sonzogni
46042ce74a Feature: hyperlink support. (#665)
See the [OSC 8 page](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
FTXUI support proposed by @aaleino in [#662](https://github.com/ArthurSonzogni/FTXUI/issues/662).

API:
```cpp
auto link = text("Click here") | hyperlink("https://github.com/FTXUI")
```

Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/662
2023-07-25 23:35:55 +02:00
Prokop Randáček
1651ae56ca fix some warnings (#660)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-07-25 23:26:41 +02:00
Henrik S. Gaßmann
f64e1e128e build: Properly escape paths which may contain spaces 2023-05-30 09:03:49 +02:00
Henrik S. Gaßmann
3483022703 build: Remove redundant cmake version check
The main `CMakelists.txt` already asserts a minimum version of `3.12`
which renders the condition `cmake <= 3.11.4` to be always false.
2023-05-30 09:03:44 +02:00
Henrik S. Gaßmann
7f5aed1e66 build(install): Remove redundant install settings 2023-05-30 09:03:38 +02:00
Henrik S. Gaßmann
438a7dc842 build(install): Fix pkgconfig install directory
`pkg-config` finds configs within `$prefix/lib/pkgconfig`, but not in
`$prefix/lib`.

See-Also: https://linux.die.net/man/1/pkg-config
2023-05-30 09:03:33 +02:00
ArthurSonzogni
513ec6c5e1 Increase version to 4.1.1 2023-05-29 14:07:29 +02:00
ArthurSonzogni
234b3c8a5d Resolve compile issues in component_fuzzer 2023-05-27 20:54:12 +02:00
SpaceIm
6ce88c25e5 CMake: use compile_features to set min C++ standard (#647) 2023-05-27 20:50:35 +02:00
ArthurSonzogni
f74c5322bd Revert "Update float style in animation.cpp (#607)"
This reverts commit 7b08dae6d0.
2023-05-25 19:52:51 +02:00
ArthurSonzogni
1e86587b68 Revert "Feature resizable spilt with custom separator (#583)"
This reverts commit eb313e0f2d.
2023-05-25 19:47:33 +02:00
SpaceIm
41c3d4dd52 add FTXUI_DEV_WARNINGS option in CMakeLists (#648)
This option allows to enable warnings as errors, and add more compiler warnings
2023-05-25 19:38:45 +02:00
Robin Lindén
2fb0b77f02 Fix MSVC possible loss of data warning (#645) 2023-05-25 19:37:58 +02:00
Henrik Gaßmann
e2aff66b98 build: Check package version in find_package (#643)
Modify the `ftxui-config.cmake.in` file so that it includes
`ftxui-targets.cmake`. This causes cmake to check the version is
compatible with what the user requested.

This patch also includes additional minor changes.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-05-25 19:37:55 +02:00
ArthurSonzogni
22ebc823c9 Set CHANGELOG to v4.1.0 2023-05-19 11:18:01 +02:00
ArthurSonzogni
49f0277103 Fix errors due to missing commit in the support branch. 2023-05-19 11:18:01 +02:00
Henner Zeller
ac10603fdb Fix types used in Hash() function used in tests. (#640)
Using `auto` seems to create a different output on different platforms.
Notably it was observed that aarch64 compiles return a different
value.

Fix the type of the characters iterated through the string.

Fixes #639

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2023-05-18 11:23:22 +02:00
Henner Zeller
a3f51ecf22 Add pkg-config file. (#642)
This file describes the include and lib location and makes
it possible to use the library in build systems other than
CMake, e.g. in basic Makefiles.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2023-05-18 11:23:22 +02:00
Arthur Sonzogni
78897ef1f4 Support arrow keys in application mode. (#627)
Depending on the Cursor Key Mode (DECCKM), the terminal sends different
escape sequences:

Key     Normal    Application
-----   --------  -----------
Up      ESC [ A   ESC O A
Down    ESC [ B   ESC O B
Right   ESC [ C   ESC O C
Left    ESC [ D   ESC O D
Home    ESC [ H   ESC O H
End     ESC [ F   ESC O F

I decided not to update the current mode to fit what FTXUI parse, but
instead support parsing both. We convert the sequences from the
"application mode" into the "normal mode".

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/626
Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/626
2023-05-18 11:23:22 +02:00
Arthur Sonzogni
debcbc668c Check graph area is positive. (#625)
Bug:https://github.com/ArthurSonzogni/FTXUI/issues/624
2023-05-18 11:23:22 +02:00
Jason Turner
1a7a550bfe Use globally set CMAKE_CXX_STANDARD if it is set (#620) 2023-05-18 11:23:22 +02:00
Arthur Sonzogni
4ce8f6d250 Fix useless new line when using the alternative screen. (#610)
Fix:https://github.com/ArthurSonzogni/FTXUI/issues/609
2023-05-18 11:23:22 +02:00
Arthur Sonzogni
7b08dae6d0 Update float style in animation.cpp (#607)
Partially taken out of:
https://github.com/ArthurSonzogni/FTXUI/pull/600

Co-authored-by: LostInCompilation <12819635+LostInCompilation@users.noreply.github.com>
2023-05-18 11:23:22 +02:00
dev-null-undefined
521d1125d9 Feature: Added nix build support (#603)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-05-18 11:23:22 +02:00
Vinicius Moura Longaray
0903ad1608 Feature: LinearGradient color decorator. (#592)
Based on the existing color decorators, create new ones to apply a gradient effect on the DOM.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-05-18 11:23:22 +02:00
Arthur Sonzogni
399549d180 Add colored border. (#595)
This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/564
2023-05-18 11:23:21 +02:00
Arthur Sonzogni
7bdca3ee68 Feature: Add the dashed style. (#594) 2023-05-18 11:23:21 +02:00
Arthur Sonzogni
eb313e0f2d Feature resizable spilt with custom separator (#583)
* Feature: ResizableSplit with custom separator

This resolves:
    https://github.com/ArthurSonzogni/FTXUI/issues/580

Co-authored-by: Pin Loon Lee <pinloon_0428@hotmail.com>
2023-05-18 11:23:21 +02:00
Evgeny Gorodetskiy
d3ee655a90 Fix Apple Clang 14 build errors (issue #588) (#589) 2023-05-18 11:23:21 +02:00
245 changed files with 3437 additions and 5087 deletions

View File

@@ -1,32 +1,23 @@
--- ---
Checks: "*, Checks: "*,
-*-macro-usage,
-*-magic-numbers,
-*-narrowing-conversions
-*-unnecessary-value-param,
-*-uppercase-literal-suffix,
-abseil-*, -abseil-*,
-altera-*, -altera-*,
-android-*, -android-*,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-non-private-member-variables-in-classes,
-fuchsia-*, -fuchsia-*,
-google-*, -google-*,
-hicpp-signed-bitwise,
-llvm*, -llvm*,
-modernize-use-trailing-return-type,
-zircon-*,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-no-recursion, -misc-no-recursion,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
-modernize-use-nodiscard, -modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-avoid-const-params-in-decls, -readability-avoid-const-params-in-decls,
-readability-else-after-return, -readability-else-after-return,
-readability-identifier-length, -readability-identifier-length,
-readability-implicit-bool-conversion, -readability-implicit-bool-conversion,
-readability-non-const-parameter,
-readability-simplify-boolean-expr,
-readability-static-accessed-through-instance, -readability-static-accessed-through-instance,
-readability-use-anyofallof,
-zircon-*,
" "
WarningsAsErrors: '' WarningsAsErrors: ''
HeaderFilterRegex: '' HeaderFilterRegex: ''

View File

@@ -6,10 +6,10 @@ on:
-v* -v*
push: push:
branches: branches:
- main - master
pull_request: pull_request:
branches: branches:
- main - master
jobs: jobs:
test: test:
@@ -39,10 +39,6 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: "Checkout repository" - name: "Checkout repository"
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -53,7 +49,7 @@ jobs:
vcvarsall: ${{ contains(matrix.os, 'windows' )}} vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true cmake: true
ninja: true ninja: true
clangtidy: false clangtidy: true
cppcheck: false cppcheck: false
gcovr: "5.0" gcovr: "5.0"
opencppcoverage: true opencppcoverage: true
@@ -65,7 +61,6 @@ jobs:
cmake -S . cmake -S .
-B ./build -B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
-DFTXUI_ENABLE_COVERAGE:BOOL=ON -DFTXUI_ENABLE_COVERAGE:BOOL=ON
-DFTXUI_BUILD_DOCS:BOOL=OFF -DFTXUI_BUILD_DOCS:BOOL=OFF
-DFTXUI_BUILD_EXAMPLES:BOOL=ON -DFTXUI_BUILD_EXAMPLES:BOOL=ON
@@ -150,10 +145,6 @@ jobs:
asset_path: build/ftxui*Win64* asset_path: build/ftxui*Win64*
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: "Checkout repository" - name: "Checkout repository"
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -166,7 +157,6 @@ jobs:
cd build; cd build;
cmake .. cmake ..
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
-DFTXUI_BUILD_DOCS=OFF -DFTXUI_BUILD_DOCS=OFF
-DFTXUI_BUILD_EXAMPLES=OFF -DFTXUI_BUILD_EXAMPLES=OFF
-DFTXUI_BUILD_TESTS=OFF -DFTXUI_BUILD_TESTS=OFF
@@ -174,7 +164,6 @@ jobs:
-DFTXUI_ENABLE_INSTALL=ON -DFTXUI_ENABLE_INSTALL=ON
-DFTXUI_DEV_WARNINGS=ON ; -DFTXUI_DEV_WARNINGS=ON ;
cmake --build . --target package; cmake --build . --target package;
- uses: shogo82148/actions-upload-release-asset@v1 - uses: shogo82148/actions-upload-release-asset@v1
with: with:
upload_url: ${{ needs.release.outputs.upload_url }} upload_url: ${{ needs.release.outputs.upload_url }}
@@ -182,7 +171,7 @@ jobs:
overwrite: true overwrite: true
documentation: documentation:
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: "Checkout repository" - name: "Checkout repository"

View File

@@ -1,76 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '45 22 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

56
.gitignore vendored
View File

@@ -1,56 +0,0 @@
# Ignore all the files, except the ones we expect.
# See https://jasonstitt.com/gitignore-whitelisting-patterns
*
!*/
# Allowed top-level files:
!.clang-format
!.clang-tidy
!.gitignore
!CHANGELOG.md
!CMakeLists.txt
!LICENSE
!README.md
!codecov.yml
!flake.lock
!flake.nix
!ftxui.pc.in
!iwyu.imp
# .github directory:
!.github/**/*.yaml
!.github/**/*.yml
# cmake directory:
!cmake/**/*.in
!cmake/**/*.cmake
# doc directory:
!doc/**/Doxyfile.in
!doc/**/*.txt
!doc/**/*.css
!doc/**/*.html
!doc/**/*.xml
!doc/**/*.md
# examples directory:
!examples/**/*.txt
!examples/**/*.cpp
!examples/**/*.hpp
!examples/**/*.ipp
!examples/**/*.html
!examples/**/*.py
!examples/**/*.js
!examples/**/*.html.disabled
# include directory:
!include/ftxui/**/*.hpp
!include/ftxui/**/*.cpp
# src directory:
!src/ftxui/**/*.hpp
!src/ftxui/**/*.cpp
# tools directory:
!tools/**/*.sh
!tools/**/*.cpp

View File

@@ -1,35 +1,11 @@
Changelog Changelog
========= =========
current (development) 4.2
--------------------- ---
5.0.0
-----
### Component ### Component
- Breaking: MenuDirection enum is renamed Direction - Bugfix: Support Fn keys for every terminal specifications.
- Breaking: GaugeDirection enum is renamed Direction
- Breaking: Direction enum is renamed WidthOrHeight
- Breaking: Remove `ComponentBase` copy constructor/assignment.
- Breaking: MenuOption::entries is renamed MenuOption::entries_option.
- Breaking: `Ref<{Component}Option>` becomes `{Component}Option` in component constructors.
- Feature: `ResizeableSplit` now support arbitrary element as a separator.
- Feature: `input` is now supporting multiple lines.
- Feature: `input` style is now customizeable.
- Bugfix: Support F1-F5 from OS terminal.
- Feature: Add struct based constructor:
```cpp
Component Button(ButtonOption options);
Component Checkbox(CheckboxOption options);
Component Input(InputOption options);
Component Menu(MenuOption options);
Component MenuEntry(MenuEntryOption options);
Component Radiobox(RadioboxOption options);
Component Slider(SliderOption<T> options);
Component ResizableSplit(ResizableSplitOption options);
```
- Feature: Add `ScreenInteractive::TrackMouse(false)` disable mouse support.
### Dom ### Dom
- Feature: Add `hyperlink` decorator. For instance: - Feature: Add `hyperlink` decorator. For instance:
@@ -40,42 +16,39 @@ current (development)
FTXUI support proposed by @aaleino in [#662](https://github.com/ArthurSonzogni/FTXUI/issues/662). FTXUI support proposed by @aaleino in [#662](https://github.com/ArthurSonzogni/FTXUI/issues/662).
### Screen ### Screen
- Breaking: `WordBreakProperty` becomes a uint8_t enum. This yields a 0.8% - Fix huge performance bug affecting some compilers about unicode bisection.
performance improvement.
- Breaking: Remove user defined Pixel constructor and equality operator.
- Performance: 19% faster on benchmarks.
### Build ### Build
- Check version compatibility when using cmake find_package() - Check version compatibility when using cmake find_package()
- Add `FTXUI_DEV_WARNING` options to turn on warnings when building FTXUI - Fix missing includes for some gcc versions.
- Turn OFF by default `FTXUI_BUILD_DOCS`
- Turn OFF by default `FTXUI_BUILD_EXAMPLE`
4.1.1 4.1.1
----- -----
### Component ### Component
- Revert Feature: Support `ResizableSplit` with customizable separator.
### Build
- Check version compatibility when using cmake find_package()
4.1.0 (abandonned)
-----
### Component
- Feature: Support `ResizableSplit` with customizable separator.
- Fix: Support arrow keys in application mode - Fix: Support arrow keys in application mode
- Fix: Remove useless new line when using an alternative screen. - Fix: Remove useless new line when using an alternative screen.
### Dom ### Dom
- Feature: Add the dashed style for border and separator: - Feature: Add the dashed style for border and separator.
- See `DASHED` enum, and `separatorDashed()`, `borderDashed()` functions.
- Feature: Add colored borders. - Feature: Add colored borders.
- See functions: `borderStyled(BorderStyle, Color)` and `borderStyled(Color)`. - Feature: Add `LinearGradient`!
- Feature: Add `LinearGradient`. It can be used in `color` and `bgColor`.
- Improvement: Color::Interpolate() uses gamma correction. - Improvement: Color::Interpolate() uses gamma correction.
- Fix: Check the `graph` area is positive. - Fix: Check the `graph` area is positive.
### Build/Install ### Build/Install
- Use globally set CMAKE_CXX_STANDARD if it is set. - Use globally set CMAKE_CXX_STANDARD if it is set.
- Expose the pkg-config file - Expose the pkg-config file.
- Check version compatibility when using cmake find_package()
4.1.0 (Abandonned)
-----
This version is abandonned and must not be used. It introduced a breaking change in the API.
4.0.0 4.0.0
----- -----

View File

@@ -1,14 +1,13 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.11)
project(ftxui project(ftxui
LANGUAGES CXX LANGUAGES CXX
VERSION 5.0.0 VERSION 4.1.1
DESCRIPTION "C++ Functional Terminal User Interface." DESCRIPTION "C++ Functional Terminal User Interface."
) )
option(FTXUI_QUIET "Set to ON for FTXUI to be quiet" OFF) option(FTXUI_BUILD_DOCS "Set to ON to build docs" ON)
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" OFF) option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" ON)
option(FTXUI_BUILD_DOCS "Set to ON to build docs" OFF)
option(FTXUI_BUILD_TESTS "Set to ON to build tests" OFF) option(FTXUI_BUILD_TESTS "Set to ON to build tests" OFF)
option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF) option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON) option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
@@ -27,7 +26,6 @@ else()
${FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT} OFF) ${FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT} OFF)
endif() endif()
include(cmake/ftxui_message.cmake)
add_library(screen add_library(screen
include/ftxui/screen/box.hpp include/ftxui/screen/box.hpp
@@ -46,7 +44,6 @@ add_library(screen
add_library(dom add_library(dom
include/ftxui/dom/canvas.hpp include/ftxui/dom/canvas.hpp
include/ftxui/dom/direction.hpp
include/ftxui/dom/elements.hpp include/ftxui/dom/elements.hpp
include/ftxui/dom/flexbox_config.hpp include/ftxui/dom/flexbox_config.hpp
include/ftxui/dom/node.hpp include/ftxui/dom/node.hpp
@@ -132,7 +129,6 @@ add_library(component
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
) )
target_link_libraries(dom target_link_libraries(dom

View File

@@ -1,15 +1,13 @@
<p align="center"> <p align="center">
<img src="https://github.com/ArthurSonzogni/FTXUI/assets/4759106/6925b6da-0a7e-49d9-883c-c890e1f36007" alt="Demo image"></img> <img src="./examples/component/homescreen.gif" alt="Demo image"></img>
<br/> <br/>
<a href="#"><img src="https://img.shields.io/badge/c++-%2300599C.svg?style=flat&logo=c%2B%2B&logoColor=white"></img></a> <a href="#"><img src="https://img.shields.io/badge/c++-%2300599C.svg?style=flat&logo=c%2B%2B&logoColor=white"></img></a>
<a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/arthursonzogni/FTXUI?color=black"></img></a> <a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/arthursonzogni/FTXUI?color=black"></img></a>
<a href="#"><img src="https://img.shields.io/github/stars/ArthurSonzogni/FTXUI"></img></a> <a href="#"><img src="https://img.shields.io/github/stars/ArthurSonzogni/FTXUI"></img></a>
<a href="#"><img src="https://img.shields.io/github/forks/ArthurSonzogni/FTXUI"></img></a> <a href="#"><img src="https://img.shields.io/github/forks/ArthurSonzogni/FTXUI"></img></a>
<a href="#"><img src="https://img.shields.io/github/repo-size/ArthurSonzogni/FTXUI"></img></a> <a href="#"><img src="https://img.shields.io/github/repo-size/ArthurSonzogni/FTXUI"></img></a>
<a href="https://github.com/ArthurSonzogni/FTXUI/graphs/contributors"><img src="https://img.shields.io/github/contributors/arthursonzogni/FTXUI?color=blue"></img></a>
<br/>
<a href="https://github.com/ArthurSonzogni/FTXUI/issues"><img src="https://img.shields.io/github/issues/ArthurSonzogni/FTXUI"></img></a> <a href="https://github.com/ArthurSonzogni/FTXUI/issues"><img src="https://img.shields.io/github/issues/ArthurSonzogni/FTXUI"></img></a>
<a href="https://repology.org/project/ftxui/versions"><img src="https://repology.org/badge/latest-versions/ftxui.svg" alt="latest packaged version(s)"></a> <a href="https://github.com/ArthurSonzogni/FTXUI/graphs/contributors"><img src="https://img.shields.io/github/contributors/arthursonzogni/FTXUI?color=blue"></img></a>
<a href="https://codecov.io/gh/ArthurSonzogni/FTXUI"> <a href="https://codecov.io/gh/ArthurSonzogni/FTXUI">
<img src="https://codecov.io/gh/ArthurSonzogni/FTXUI/branch/master/graph/badge.svg?token=C41FdRpNVA"/> <img src="https://codecov.io/gh/ArthurSonzogni/FTXUI/branch/master/graph/badge.svg?token=C41FdRpNVA"/>
</a> </a>
@@ -24,11 +22,11 @@
</p> </p>
# FTXUI ## FTXUI
<i>Functional Terminal (X) User interface</i> <i>Functional Terminal (X) User interface</i>
A simple cross-platform C++ library for terminal based user interfaces! A simple C++ library for terminal based user interfaces!
## Feature ## Feature
* Functional style. Inspired by * Functional style. Inspired by
@@ -40,9 +38,9 @@ A simple cross-platform C++ library for terminal based user interfaces!
* 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
* **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: CMake [FetchContent]([https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/](https://cmake.org/cmake/help/latest/module/FetchContent.html)) (preferred), vcpkg, pkgbuild, conan. * Multiple packages: CMake [FetchContent](https://bewagner.net/programming/2020/05/02/cmake-fetchcontent/) (preferred), vcpkg, pkgbuild, conan.
* Good practises: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc... * Good practises: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
## Documentation ## Documentation
@@ -52,22 +50,34 @@ A simple cross-platform C++ library for terminal based user interfaces!
- [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/) - [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/)
- [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake) - [Build using CMake](https://arthursonzogni.github.io/FTXUI/#build-cmake)
## Operating systems
This is expected to be cross platform. This supports / tests:
- WebAssembly
- Linux
- MacOS
- Windows
## Example ## Example
~~~cpp ~~~cpp
vbox({ vbox({
hbox({ hbox({
text("one") | border, text("left") | border,
text("two") | border | flex, text("middle") | border | flex,
text("three") | border | flex, text("right") | border,
}), }),
gauge(0.5) | border,
gauge(0.25) | color(Color::Red), });
gauge(0.50) | color(Color::White),
gauge(0.75) | color(Color::Blue),
});
~~~ ~~~
![image](https://github.com/ArthurSonzogni/FTXUI/assets/4759106/569bf043-4e85-4245-aad5-2324572135c4) ~~~bash
┌────┐┌───────────────────────────────────────────────────────────────┐┌─────┐
│left││middle ││right│
└────┘└───────────────────────────────────────────────────────────────┘└─────┘
┌────────────────────────────────────────────────────────────────────────────┐
│██████████████████████████████████████ │
└────────────────────────────────────────────────────────────────────────────┘
~~~
## Short gallery ## Short gallery
@@ -93,7 +103,7 @@ Element can become flexible using the the `flex` decorator.
![image](https://user-images.githubusercontent.com/4759106/147242524-7103b5d9-1a92-4e2d-ac70-b3d6740061e3.png) ![image](https://user-images.githubusercontent.com/4759106/147242524-7103b5d9-1a92-4e2d-ac70-b3d6740061e3.png)
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2gridbox_8cpp-example.html) using gridbox: [Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2gridbox_8cpp-example.htmlp) using gridbox:
![image](https://user-images.githubusercontent.com/4759106/147242972-0db1f2e9-0790-496f-86e6-ed2c604f7a73.png) ![image](https://user-images.githubusercontent.com/4759106/147242972-0db1f2e9-0790-496f-86e6-ed2c604f7a73.png)
@@ -292,8 +302,8 @@ Prebuilt components are declared in [<ftxui/component/component.hpp>](https://ar
</details> </details>
## Libraries for FTXUI
- *Want to share a useful component using FTXUI? Feel free adding yours here*
## Project using FTXUI ## Project using FTXUI
@@ -321,10 +331,8 @@ Feel free to add your projects here:
- [turing_cmd](https://github.com/DanArmor/turing_cmd) - [turing_cmd](https://github.com/DanArmor/turing_cmd)
- [StartUp](https://github.com/StubbornVegeta/StartUp) - [StartUp](https://github.com/StubbornVegeta/StartUp)
- [eCAL monitor](https://github.com/eclipse-ecal/ecal) - [eCAL monitor](https://github.com/eclipse-ecal/ecal)
- [Path Finder](https://github.com/Ruebled/Path_Finder)
- [rw-tui](https://github.com/LeeKyuHyuk/rw-tui)
### [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam) ## [cpp-best-practices/game_jam](https://github.com/cpp-best-practices/game_jam)
Several games using the FTXUI have been made during the Game Jam: Several games using the FTXUI have been made during the Game Jam:
- [TermBreaker](https://github.com/ArthurSonzogni/termBreaker) [**[Play web version]**](https://arthursonzogni.com/TermBreaker/) - [TermBreaker](https://github.com/ArthurSonzogni/termBreaker) [**[Play web version]**](https://arthursonzogni.com/TermBreaker/)
@@ -362,9 +370,6 @@ If you don't, the following packages have been created:
- [vcpkg](https://vcpkgx.com/details.html?package=ftxui) - [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
- [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/). - [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
- [conan.io](https://conan.io/center/ftxui) - [conan.io](https://conan.io/center/ftxui)
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
[![Packaging status](https://repology.org/badge/vertical-allrepos/ftxui.svg)](https://repology.org/project/ftxui/versions)
## Contributors ## Contributors

View File

@@ -13,7 +13,7 @@ include(FetchContent)
FetchContent_Declare(googlebenchmark FetchContent_Declare(googlebenchmark
GIT_REPOSITORY "https://github.com/google/benchmark" GIT_REPOSITORY "https://github.com/google/benchmark"
GIT_TAG "015d1a091af6937488242b70121858bce8fd40e9" # v1.8.2 GIT_TAG 62937f91b5c763a8e119d0c20c67b87bde8eff1c
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
) )

View File

@@ -4,11 +4,11 @@ endif()
set(CMAKE_C_COMPILER clang) set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++) set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_STANDARD 17)
function(fuzz source) function(fuzz name)
set(name "ftxui-${source}")
add_executable(${name} add_executable(${name}
src/ftxui/component/${source}.cpp src/ftxui/component/${name}.cpp
) )
target_include_directories(${name} PRIVATE src) target_include_directories(${name} PRIVATE src)
target_link_libraries(${name} PRIVATE component) target_link_libraries(${name} PRIVATE component)

View File

@@ -1,17 +0,0 @@
function(ftxui_message msg)
if (NOT FTXUI_QUIET)
message(STATUS "${msg}")
endif()
endfunction()
ftxui_message("┌─ FTXUI options ─────────────────────")
ftxui_message("│ FTXUI_ENABLE_INSTALL : ${FTXUI_ENABLE_INSTALL}")
ftxui_message("│ FTXUI_BUILD_EXAMPLES : ${FTXUI_BUILD_EXAMPLES}")
ftxui_message("│ FTXUI_QUIET : ${FTXUI_QUIET}")
ftxui_message("│ FTXUI_BUILD_DOCS : ${FTXUI_BUILD_DOCS}")
ftxui_message("│ FTXUI_BUILD_TESTS : ${FTXUI_BUILD_TESTS}")
ftxui_message("│ FTXUI_BUILD_TESTS_FUZZER : ${FTXUI_BUILD_TESTS_FUZZER}")
ftxui_message("│ FTXUI_ENABLE_COVERAGE : ${FTXUI_ENABLE_COVERAGE}")
ftxui_message("│ FTXUI_DEV_WARNINGS : ${FTXUI_DEV_WARNINGS}")
ftxui_message("│ FTXUI_CLANG_TIDY : ${FTXUI_CLANG_TIDY}")
ftxui_message("└─────────────────────────────────────")

View File

@@ -1,16 +1,18 @@
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" ) find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" )
if(NOT CLANG_TIDY_EXE)
message(STATUS "clang-tidy not found.")
else()
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
endif()
function(ftxui_set_options library) function(ftxui_set_options library)
message(STATUS "ftxui_set_options " ${library})
set_target_properties(${library} PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(${library} PROPERTIES VERSION ${PROJECT_VERSION})
if (NOT ${library} MATCHES "ftxui-*") if (NOT ${library} MATCHES "ftxui-*")
set_target_properties(${library} PROPERTIES OUTPUT_NAME "ftxui-${library}") set_target_properties(${library} PROPERTIES OUTPUT_NAME "ftxui-${library}")
endif() endif()
if (FTXUI_CLANG_TIDY) if(CLANG_TIDY_EXE AND FTXUI_CLANG_TIDY)
if (NOT CLANG_TIDY_EXE)
message(FATAL_ERROR "clang-tidy requested but executable not found")
endif()
set_target_properties(${library} set_target_properties(${library}
PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*" PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*"
) )
@@ -77,20 +79,9 @@ function(ftxui_set_options library)
target_compile_options(${library} PRIVATE "-Wpedantic") target_compile_options(${library} PRIVATE "-Wpedantic")
target_compile_options(${library} PRIVATE "-Wshadow") target_compile_options(${library} PRIVATE "-Wshadow")
target_compile_options(${library} PRIVATE "-Wunused") target_compile_options(${library} PRIVATE "-Wunused")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${library} PRIVATE "-Wuseless-cast")
endif()
endif() endif()
endif() endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(FTXUI_DEV_WARNINGS)
target_compile_options(${library} PRIVATE "-Wdocumentation")
endif()
endif()
if (FTXUI_MICROSOFT_TERMINAL_FALLBACK) if (FTXUI_MICROSOFT_TERMINAL_FALLBACK)
target_compile_definitions(${library} target_compile_definitions(${library}
PRIVATE "FTXUI_MICROSOFT_TERMINAL_FALLBACK") PRIVATE "FTXUI_MICROSOFT_TERMINAL_FALLBACK")

View File

@@ -68,7 +68,3 @@ include(GoogleTest)
gtest_discover_tests(ftxui-tests gtest_discover_tests(ftxui-tests
DISCOVERY_TIMEOUT 600 DISCOVERY_TIMEOUT 600
) )
#set(CMAKE_CTEST_ARGUMENTS "--rerun-failed --output-on-failure")
#set_tests_properties(gen_init_queries PROPERTIES FIXTURES_SETUP f_init_queries)
#set_tests_properties(test PROPERTIES FIXTURES_REQUIRED f_init_queries)

View File

@@ -113,9 +113,11 @@ The project is comprised of 3 modules:
3. **ftxui/component** The module is required if your program needs to respond 3. **ftxui/component** The module is required if your program needs to respond
to user input. It defines a set of `ftxui::Component`. These components can to user input. It defines a set of `ftxui::Component`. These components can
be utilized to navigate using the arrow keys *and/or* cursor. There are be utilized to navigate the program by using the arrow keys and interacting
several builtin widgets like checkbox/inputbox/etc to interact with. You can with widgets such as the checkbox. You can also make you own components.
combine them, or even define your own custom components. The use can navigates
using the arrow keys and interact with widgets like checkbox/inputbox/... You
can make you own components.
# screen {#module-screen} # screen {#module-screen}

View File

@@ -8,15 +8,18 @@ function(example name)
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB}) target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name}) set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
target_compile_features(ftxui_example_${name} PRIVATE cxx_std_20) target_compile_features(ftxui_example_${name} PRIVATE cxx_std_17)
endfunction(example) endfunction(example)
add_subdirectory(component) add_subdirectory(component)
add_subdirectory(dom) add_subdirectory(dom)
if (EMSCRIPTEN) if (EMSCRIPTEN)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1") # 32MB should be enough to run all the examples, in debug mode.
target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1") target_link_options(component PUBLIC "SHELL: -s TOTAL_MEMORY=33554432")
target_link_options(component PUBLIC "SHELL: -s ASSERTIONS=1")
#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

View File

@@ -17,7 +17,6 @@ example(focus_cursor)
example(gallery) example(gallery)
example(homescreen) example(homescreen)
example(input) example(input)
example(input_style)
example(linear_gradient_gallery) example(linear_gradient_gallery)
example(maybe) example(maybe)
example(menu) example(menu)
@@ -41,7 +40,5 @@ example(slider_direction)
example(slider_rgb) example(slider_rgb)
example(tab_horizontal) example(tab_horizontal)
example(tab_vertical) example(tab_vertical)
example(textarea)
example(toggle) example(toggle)
example(window)
example(with_restored_io) example(with_restored_io)

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -37,3 +34,7 @@ int main() {
screen.Loop(component); screen.Loop(component);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -43,3 +40,7 @@ int main() {
screen.Loop(component); screen.Loop(component);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for 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+
@@ -18,12 +15,13 @@ int main() {
int counter = 0; int counter = 0;
auto on_click = [&] { counter++; }; auto on_click = [&] { counter++; };
auto style = ButtonOption::Animated(Color::Default, Color::GrayDark, auto button_style = ButtonOption::Animated(Color::Default, Color::GrayDark,
Color::Default, Color::White); Color::Default, Color::White);
auto container = Container::Vertical({}); auto container = Container::Vertical({});
for (int i = 0; i < 30; ++i) { for (int i = 0; i < 30; ++i) {
auto button = Button("Button " + std::to_string(i), on_click, style); auto button =
Button("Button " + std::to_string(i), on_click, &button_style);
container->Add(button); container->Add(button);
} }
@@ -45,3 +43,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <string> // for operator+, to_string #include <string> // for operator+, to_string
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
@@ -58,3 +55,7 @@ int main() {
screen.Loop(buttons); screen.Loop(buttons);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSED file.
#include <cmath> // for sin, cos #include <cmath> // for sin, cos
#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
@@ -260,3 +257,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSED file.

View File

@@ -1,6 +1,3 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, __shared_ptr_access #include <memory> // for allocator, __shared_ptr_access
#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
@@ -28,3 +25,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <array> // for array #include <array> // for array
#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
@@ -32,3 +29,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, make_shared, __shared_ptr_access #include <memory> // for allocator, make_shared, __shared_ptr_access
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
@@ -55,3 +52,7 @@ int main() {
ScreenInteractive::FitComponent().Loop(component); ScreenInteractive::FitComponent().Loop(component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for 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
@@ -61,3 +58,7 @@ int main() {
} }
// Thanks to Chris Morgan for this example! // Thanks to Chris Morgan for this example!
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdlib.h> // for EXIT_SUCCESS #include <stdlib.h> // for EXIT_SUCCESS
#include <chrono> // for milliseconds #include <chrono> // for milliseconds
#include <ftxui/component/event.hpp> // for Event #include <ftxui/component/event.hpp> // for Event
@@ -52,3 +49,7 @@ int main() {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <string> // for basic_string, string, allocator #include <string> // for basic_string, string, allocator
#include <vector> // for vector #include <vector> // for vector
@@ -42,3 +39,7 @@ int main() {
auto screen = ScreenInteractive::FitComponent(); auto screen = ScreenInteractive::FitComponent();
screen.Loop(layout); screen.Loop(layout);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stddef.h> // for size_t #include <stddef.h> // for size_t
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <memory> // for shared_ptr, __shared_ptr_access, allocator
#include <string> // for string, basic_string, to_string, operator+, char_traits #include <string> // for string, basic_string, to_string, operator+, char_traits
@@ -189,3 +186,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#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
@@ -67,3 +64,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/component/captured_mouse.hpp> // for ftxui #include <ftxui/component/captured_mouse.hpp> // for ftxui
#include <string> // for allocator, operator+, char_traits, string #include <string> // for allocator, operator+, char_traits, string
@@ -35,3 +32,7 @@ int main() {
})); }));
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for shared_ptr, allocator, __shared_ptr_access #include <memory> // for shared_ptr, allocator, __shared_ptr_access
#include <string> // for string, basic_string #include <string> // for string, basic_string
@@ -131,3 +128,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -524,3 +521,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 KiB

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -46,3 +43,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,97 +0,0 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#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 <functional> // for function
#include <string> // for allocator, string
#include <utility> // for move
#include "ftxui/component/component.hpp" // for Input, Horizontal, Vertical, operator|
#include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/component/component_options.hpp" // for InputState, InputOption
#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
int main() {
using namespace ftxui;
InputOption style_1 = InputOption::Default();
InputOption style_2 = InputOption::Spacious();
InputOption style_3 = InputOption::Spacious();
style_3.transform = [](InputState state) {
state.element |= borderEmpty;
if (state.is_placeholder) {
state.element |= dim;
}
if (state.focused) {
state.element |= borderDouble;
state.element |= bgcolor(Color::White);
state.element |= color(Color::Black);
} else if (state.hovered) {
state.element |= borderRounded;
state.element |= bgcolor(LinearGradient(90, Color::Blue, Color::Red));
state.element |= color(Color::White);
} else {
state.element |= border;
state.element |= bgcolor(LinearGradient(0, Color::Blue, Color::Red));
state.element |= color(Color::White);
}
return state.element;
};
InputOption style_4 = InputOption::Spacious();
style_4.transform = [](InputState state) {
state.element = hbox({
text("Theorem") | center | borderEmpty | bgcolor(Color::Red),
separatorEmpty(),
separator() | color(Color::White),
separatorEmpty(),
std::move(state.element),
});
state.element |= borderEmpty;
if (state.is_placeholder) {
state.element |= dim;
}
if (state.focused) {
state.element |= bgcolor(Color::Black);
} else {
state.element |= bgcolor(Color::Blue);
}
if (state.hovered) {
state.element |= bgcolor(Color::GrayDark);
}
return vbox({state.element, separatorEmpty()});
};
auto generateUiFromStyle = [&](InputOption style) {
auto first_name = new std::string(); // Leaked
auto middle_name = new std::string(); // Leaked
auto last_name = new std::string(); // Leaked
return Container::Vertical({
Input(first_name, "first name", style),
Input(middle_name, "middle name", style),
Input(last_name, "last name", style),
}) |
borderEmpty;
};
auto ui = Container::Horizontal({
generateUiFromStyle(style_1),
generateUiFromStyle(style_2),
generateUiFromStyle(style_3),
generateUiFromStyle(style_4),
});
auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(ui);
}

View File

@@ -1,6 +1,3 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#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
@@ -25,8 +22,8 @@ int main() {
std::string slider_end_text; std::string slider_end_text;
auto slider_angle = Slider(&slider_angle_text, &angle, 0, 360); auto slider_angle = Slider(&slider_angle_text, &angle, 0, 360);
auto slider_start = Slider(&slider_start_text, &start, 0.f, 1.f, 0.05f); auto slider_start = Slider(&slider_start_text, &start, 0.f, 1.f);
auto slider_end = Slider(&slider_end_text, &end, 0.f, 1.f, 0.05f); auto slider_end = Slider(&slider_end_text, &end, 0.f, 1.f);
auto layout = Container::Vertical({ auto layout = Container::Vertical({
slider_angle, slider_angle,
@@ -53,3 +50,7 @@ int main() {
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <string> // for string, allocator, basic_string #include <string> // for string, allocator, basic_string
#include <vector> // for vector #include <vector> // for vector
@@ -39,3 +36,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(layout); screen.Loop(layout);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream #include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
#include <string> // for string, basic_string, allocator #include <string> // for string, basic_string, allocator
@@ -24,9 +21,13 @@ int main() {
MenuOption option; MenuOption option;
option.on_enter = screen.ExitLoopClosure(); option.on_enter = screen.ExitLoopClosure();
auto menu = Menu(&entries, &selected, option); auto menu = Menu(&entries, &selected, &option);
screen.Loop(menu); screen.Loop(menu);
std::cout << "Selected element = " << selected << std::endl; std::cout << "Selected element = " << selected << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <memory> // for allocator, __shared_ptr_access #include <memory> // for allocator, __shared_ptr_access
#include <string> // for string, basic_string, operator+, to_string #include <string> // for string, basic_string, operator+, to_string
@@ -30,9 +27,9 @@ int main() {
int left_menu_selected = 0; int left_menu_selected = 0;
int right_menu_selected = 0; int right_menu_selected = 0;
Component left_menu_ = Component left_menu_ =
Menu(&left_menu_entries, &left_menu_selected, menu_option); Menu(&left_menu_entries, &left_menu_selected, &menu_option);
Component right_menu_ = Component right_menu_ =
Menu(&right_menu_entries, &right_menu_selected, menu_option); Menu(&right_menu_entries, &right_menu_selected, &menu_option);
Component container = Container::Horizontal({ Component container = Container::Horizontal({
left_menu_, left_menu_,
@@ -77,3 +74,7 @@ int main() {
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <functional> // for function #include <functional> // for function
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream #include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
@@ -79,3 +76,7 @@ int main() {
std::cout << "Selected element = " << selected << std::endl; std::cout << "Selected element = " << selected << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream #include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
#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
@@ -63,3 +60,7 @@ int main() {
std::cout << "Selected element = " << selected << std::endl; std::cout << "Selected element = " << selected << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#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
@@ -30,3 +27,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdlib.h> // for EXIT_SUCCESS #include <stdlib.h> // for EXIT_SUCCESS
#include <memory> // for allocator, __shared_ptr_access #include <memory> // for allocator, __shared_ptr_access
#include <string> // for string, operator+, basic_string, to_string, char_traits #include <string> // for string, operator+, basic_string, to_string, char_traits
@@ -75,3 +72,7 @@ int main() {
screen.Loop(global); screen.Loop(global);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <array> // for array #include <array> // for array
#include <chrono> // for milliseconds #include <chrono> // for milliseconds
#include <functional> // for function #include <functional> // for function
@@ -113,7 +110,7 @@ int main() {
Component VMenu1(std::vector<std::string>* entries, int* selected) { Component VMenu1(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.transform = [](EntryState state) { option.entries.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)
@@ -127,7 +124,7 @@ Component VMenu1(std::vector<std::string>* entries, int* selected) {
Component VMenu2(std::vector<std::string>* entries, int* selected) { Component VMenu2(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.transform = [](EntryState state) { option.entries.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)
@@ -141,7 +138,7 @@ Component VMenu2(std::vector<std::string>* entries, int* selected) {
Component VMenu3(std::vector<std::string>* entries, int* selected) { Component VMenu3(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.transform = [](EntryState state) { option.entries.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)
@@ -158,7 +155,7 @@ Component VMenu3(std::vector<std::string>* entries, int* selected) {
Component VMenu4(std::vector<std::string>* entries, int* selected) { Component VMenu4(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.transform = [](EntryState state) { option.entries.transform = [](EntryState state) {
if (state.active && state.focused) { if (state.active && state.focused) {
return text(state.label) | color(Color::Yellow) | bgcolor(Color::Black) | return text(state.label) | color(Color::Yellow) | bgcolor(Color::Black) |
bold; bold;
@@ -178,7 +175,7 @@ Component VMenu4(std::vector<std::string>* entries, int* selected) {
Component VMenu5(std::vector<std::string>* entries, int* selected) { Component VMenu5(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.transform = [](EntryState state) { option.entries.transform = [](EntryState state) {
auto element = text(state.label); auto element = text(state.label);
if (state.active && state.focused) { if (state.active && state.focused) {
return element | borderDouble; return element | borderDouble;
@@ -204,19 +201,19 @@ Component VMenu6(std::vector<std::string>* entries, int* selected) {
Component VMenu7(std::vector<std::string>* entries, int* selected) { Component VMenu7(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.animated_colors.foreground.enabled = true; option.entries.animated_colors.foreground.enabled = true;
option.entries_option.animated_colors.background.enabled = true; option.entries.animated_colors.background.enabled = true;
option.entries_option.animated_colors.background.active = Color::Red; option.entries.animated_colors.background.active = Color::Red;
option.entries_option.animated_colors.background.inactive = Color::Black; option.entries.animated_colors.background.inactive = Color::Black;
option.entries_option.animated_colors.foreground.active = Color::White; option.entries.animated_colors.foreground.active = Color::White;
option.entries_option.animated_colors.foreground.inactive = Color::Red; option.entries.animated_colors.foreground.inactive = Color::Red;
return Menu(entries, selected, option); return Menu(entries, selected, option);
} }
Component VMenu8(std::vector<std::string>* entries, int* selected) { Component VMenu8(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::Vertical(); auto option = MenuOption::Vertical();
option.entries_option.animated_colors.foreground.Set( option.entries.animated_colors.foreground.Set(Color::Red, Color::White,
Color::Red, Color::White, std::chrono::milliseconds(500)); std::chrono::milliseconds(500));
return Menu(entries, selected, option); return Menu(entries, selected, option);
} }
@@ -243,7 +240,7 @@ Component HMenu5(std::vector<std::string>* entries, int* selected) {
auto option = MenuOption::HorizontalAnimated(); auto option = MenuOption::HorizontalAnimated();
option.underline.SetAnimation(std::chrono::milliseconds(1500), option.underline.SetAnimation(std::chrono::milliseconds(1500),
animation::easing::ElasticOut); animation::easing::ElasticOut);
option.entries_option.transform = [](EntryState state) { option.entries.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;
@@ -255,3 +252,7 @@ Component HMenu5(std::vector<std::string>* entries, int* selected) {
option.underline.color_active = Color::Red; option.underline.color_active = Color::Red;
return Menu(entries, selected, option); return Menu(entries, selected, option);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""ms, literals #include <chrono> // for operator""ms, literals
#include <memory> // for allocator, shared_ptr, __shared_ptr_access #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <string> // for string, operator+, to_string, basic_string #include <string> // for string, operator+, to_string, basic_string
@@ -91,3 +88,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(container); screen.Loop(container);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/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
#include <functional> // for function #include <functional> // for function
@@ -80,3 +77,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(main_component); screen.Loop(main_component);
return 0; return 0;
} }
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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+ #include <string> // for string, basic_string, char_traits, operator+
#include <vector> // for vector #include <vector> // for vector
@@ -91,3 +88,7 @@ int main() {
screen.Loop(main_renderer); screen.Loop(main_renderer);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -48,3 +45,7 @@ int main() {
})); }));
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <string> // for string, allocator, basic_string #include <string> // for string, allocator, basic_string
#include <vector> // for vector #include <vector> // for vector
@@ -23,3 +20,7 @@ int main() {
screen.Loop(Radiobox(&radiobox_list, &selected)); screen.Loop(Radiobox(&radiobox_list, &selected));
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for shared_ptr, __shared_ptr_access #include <memory> // for shared_ptr, __shared_ptr_access
#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
@@ -30,3 +27,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for shared_ptr, allocator, __shared_ptr_access #include <memory> // for shared_ptr, allocator, __shared_ptr_access
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
@@ -46,3 +43,7 @@ int main() {
renderer_wrap, renderer_wrap,
})); }));
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for shared_ptr, allocator, __shared_ptr_access #include <memory> // for shared_ptr, allocator, __shared_ptr_access
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
@@ -36,3 +33,7 @@ int main() {
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,14 +1,10 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <array> // for array #include <array> // for array
#include <cmath> // for sin #include <cmath> // for sin
#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/elements.hpp> // for size, GREATER_THAN, GaugeDirection, GaugeDirection::Up, 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 #include <memory> // for shared_ptr, __shared_ptr_access
#include <memory> // for shared_ptr, __shared_ptr_access
#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|=
@@ -30,7 +26,7 @@ int main() {
option.value = &value; option.value = &value;
option.max = 100; option.max = 100;
option.increment = 5; option.increment = 5;
option.direction = Direction::Up; option.direction = GaugeDirection::Up;
layout_horizontal->Add(Slider<int>(option)); layout_horizontal->Add(Slider<int>(option));
/* In C++20: /* In C++20:
@@ -38,7 +34,7 @@ int main() {
.value = &values[i], .value = &values[i],
.max = 100, .max = 100,
.increment = 5, .increment = 5,
.direction = Direction::Up, .direction = GaugeDirection::Up,
})); }));
*/ */
} }
@@ -47,3 +43,7 @@ int main() {
screen.Loop(layout_horizontal); screen.Loop(layout_horizontal);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <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
@@ -59,3 +56,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, __shared_ptr_access, shared_ptr #include <memory> // for allocator, __shared_ptr_access, shared_ptr
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
@@ -68,3 +65,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, __shared_ptr_access, shared_ptr #include <memory> // for allocator, __shared_ptr_access, shared_ptr
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
@@ -68,3 +65,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,34 +0,0 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, __shared_ptr_access, shared_ptr
#include <string> // for string
#include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Input, Renderer, ResizableSplitLeft
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for operator|, separator, text, Element, flex, vbox, border
int main() {
using namespace ftxui;
std::string content_1;
std::string content_2;
auto textarea_1 = Input(&content_1);
auto textarea_2 = Input(&content_2);
int size = 50;
auto layout = ResizableSplitLeft(textarea_1, textarea_2, &size);
auto component = Renderer(layout, [&] {
return vbox({
text("Input:"),
separator(),
layout->Render() | flex,
}) |
border;
});
auto screen = ScreenInteractive::Fullscreen();
screen.Loop(component);
}

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for allocator, __shared_ptr_access #include <memory> // for allocator, __shared_ptr_access
#include <string> // for string, basic_string #include <string> // for string, basic_string
#include <vector> // for vector #include <vector> // for vector
@@ -62,3 +59,7 @@ int main() {
auto screen = ScreenInteractive::TerminalOutput(); auto screen = ScreenInteractive::TerminalOutput();
screen.Loop(renderer); screen.Loop(renderer);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,88 +0,0 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/component/component.hpp>
#include <ftxui/component/screen_interactive.hpp>
using namespace ftxui;
Component DummyWindowContent() {
class Impl : public ComponentBase {
private:
bool checked[3] = {false, false, false};
float slider = 50;
public:
Impl() {
Add(Container::Vertical({
Checkbox("Check me", &checked[0]),
Checkbox("Check me", &checked[1]),
Checkbox("Check me", &checked[2]),
Slider("Slider", &slider, 0.f, 100.f),
}));
}
};
return Make<Impl>();
}
int main() {
int window_1_left = 20;
int window_1_top = 10;
int window_1_width = 40;
int window_1_height = 20;
auto window_1 = Window({
.inner = DummyWindowContent(),
.title = "First window",
.left = &window_1_left,
.top = &window_1_top,
.width = &window_1_width,
.height = &window_1_height,
});
auto window_2 = Window({
.inner = DummyWindowContent(),
.title = "My window",
.left = 40,
.top = 20,
});
auto window_3 = Window({
.inner = DummyWindowContent(),
.title = "My window",
.left = 60,
.top = 30,
});
auto window_4 = Window({
.inner = DummyWindowContent(),
});
auto window_5 = Window({});
auto window_container = Container::Stacked({
window_1,
window_2,
window_3,
window_4,
window_5,
});
auto display_win_1 = Renderer([&] {
return text("window_1: " + //
std::to_string(window_1_width) + "x" +
std::to_string(window_1_height) + " + " +
std::to_string(window_1_left) + "," +
std::to_string(window_1_top));
});
auto layout = Container::Vertical({
display_win_1,
window_container,
});
auto screen = ScreenInteractive::Fullscreen();
screen.Loop(layout);
return EXIT_SUCCESS;
}

View File

@@ -1,6 +1,3 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <cstdlib> // for system, EXIT_SUCCESS #include <cstdlib> // for system, EXIT_SUCCESS
#include <iostream> // for operator<<, basic_ostream, basic_ostream::operator<<, cout, endl, flush, ostream, basic_ostream<>::__ostream_type, cin #include <iostream> // for operator<<, basic_ostream, basic_ostream::operator<<, cout, endl, flush, ostream, basic_ostream<>::__ostream_type, cin
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <memory> // for shared_ptr, __shared_ptr_access, allocator
@@ -58,3 +55,7 @@ int main() {
screen.Loop(renderer); screen.Loop(renderer);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -35,3 +35,4 @@ example(style_underlined_double)
example(table) example(table)
example(vbox_hbox) example(vbox_hbox)
example(vflow) example(vflow)
example(window)

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdlib.h> // for EXIT_SUCCESS #include <stdlib.h> // for EXIT_SUCCESS
#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
@@ -36,3 +33,7 @@ int main() {
screen.Print(); screen.Print();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
#include <iostream> // for endl, cout, ostream #include <iostream> // for endl, cout, ostream
@@ -37,3 +34,7 @@ int main() {
screen.Print(); screen.Print();
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
#include <iostream> // for endl, cout, ostream #include <iostream> // for endl, cout, ostream
@@ -26,3 +23,7 @@ int main() {
screen.Print(); screen.Print();
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#include <cmath> // for cos #include <cmath> // for cos
#include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element #include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
@@ -46,3 +43,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/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
@@ -139,3 +136,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
@@ -37,3 +34,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
#include <memory> // for allocator #include <memory> // for allocator
@@ -33,3 +30,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
#include <memory> // for allocator #include <memory> // for allocator
@@ -52,3 +49,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // 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
#include <memory> // for allocator #include <memory> // for allocator
@@ -27,3 +24,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#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
@@ -34,3 +31,7 @@ int main() {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#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
@@ -76,3 +73,7 @@ int main() {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#include <cmath> // for sin #include <cmath> // for sin
#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
@@ -83,3 +80,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#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
@@ -46,3 +43,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#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
@@ -50,3 +47,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <iostream> // for cout, ostream #include <iostream> // for cout, ostream
@@ -57,3 +54,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#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
@@ -23,3 +20,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#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
@@ -146,3 +143,7 @@ int main() {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <iostream> // for cout, ostream #include <iostream> // for cout, ostream
@@ -51,3 +48,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, center, separator, operator|, flex, Element, vbox, Fit, hbox, border #include <ftxui/dom/elements.hpp> // for text, center, separator, operator|, flex, Element, vbox, Fit, hbox, border
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -28,3 +25,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <iostream> // for endl, cout, ostream #include <iostream> // for endl, cout, ostream
#include <memory> // for allocator #include <memory> // for allocator
@@ -44,3 +41,7 @@ int main() {
screen.Print(); screen.Print();
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for operator|, text, Element, hcenter, Fit, hbox, size, window, Elements, bold, dim, EQUAL, WIDTH #include <ftxui/dom/elements.hpp> // for operator|, text, Element, hcenter, Fit, hbox, size, window, Elements, bold, dim, EQUAL, WIDTH
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
@@ -29,3 +26,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> // for operator""s, chrono_literals #include <chrono> // for operator""s, chrono_literals
#include <ftxui/dom/elements.hpp> // for Element, operator|, separator, filler, hbox, size, spinner, text, vbox, bold, border, Fit, EQUAL, WIDTH #include <ftxui/dom/elements.hpp> // for Element, operator|, separator, filler, hbox, size, spinner, text, vbox, bold, border, Fit, EQUAL, WIDTH
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
@@ -44,3 +41,7 @@ int main() {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, blink, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, blink, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, bold, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, bold, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient #include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -65,3 +62,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, dim, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, dim, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, Element, bgcolor, color, blink, bold, dim, inverted, underlined, Fit, hbox #include <ftxui/dom/elements.hpp> // for text, operator|, Element, bgcolor, color, blink, bold, dim, inverted, underlined, Fit, hbox
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -32,3 +29,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, bold, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, bold, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, inverted, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, inverted, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -21,3 +18,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, strikethrough, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, strikethrough, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, underlined, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, underlined, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for text, operator|, underlinedDouble, Fit, hbox, Element #include <ftxui/dom/elements.hpp> // for text, operator|, underlinedDouble, Fit, hbox, Element
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
@@ -22,3 +19,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> // for color, Fit, LIGHT, align_right, bold, DOUBLE #include <ftxui/dom/elements.hpp> // for color, Fit, LIGHT, align_right, bold, DOUBLE
#include <ftxui/dom/table.hpp> // for Table, TableSelection #include <ftxui/dom/table.hpp> // for Table, TableSelection
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
@@ -62,3 +59,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for filler, text, hbox, vbox #include <ftxui/dom/elements.hpp> // for filler, text, hbox, vbox
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
@@ -38,3 +35,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for operator|, Element, size, text, hcenter, Fit, vflow, window, EQUAL, bold, border, dim, HEIGHT, WIDTH #include <ftxui/dom/elements.hpp> // for operator|, Element, size, text, hcenter, Fit, vflow, window, EQUAL, bold, border, dim, HEIGHT, WIDTH
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
@@ -47,3 +44,7 @@ int main() {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

34
examples/dom/window.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include <stdlib.h> // for EXIT_SUCCESS
#include <ftxui/dom/elements.hpp> // for operator|=, Element, bgcolor, color, graph, border
#include <ftxui/screen/screen.hpp> // for Fixed, Screen
#include <vector> // for vector
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Red, ftxui
int main() {
using namespace ftxui;
Element document = graph([](int x, int y) {
std::vector<int> result(x, 0);
for (int i{0}; i < x; ++i) {
result[i] = ((3 * i) / 2) % y;
}
return result;
});
document |= color(Color::Red);
document |= bgcolor(Color::DarkBlue);
document |= border;
const int width = 80;
const int height = 10;
auto screen =
Screen::Create(Dimension::Fixed(width), Dimension::Fixed(height));
Render(screen, document);
screen.Print();
return EXIT_SUCCESS;
}
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_ANIMATION_HPP #ifndef FTXUI_ANIMATION_HPP
#define FTXUI_ANIMATION_HPP #define FTXUI_ANIMATION_HPP
@@ -21,7 +18,7 @@ void RequestAnimationFrame();
using Clock = std::chrono::steady_clock; using Clock = std::chrono::steady_clock;
using TimePoint = std::chrono::time_point<Clock>; using TimePoint = std::chrono::time_point<Clock>;
using Duration = std::chrono::duration<float>; using Duration = std::chrono::duration<double>;
// Parameter of Component::OnAnimation(param). // Parameter of Component::OnAnimation(param).
class Params { class Params {
@@ -116,3 +113,7 @@ class Animator {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_ANIMATION_HPP */ #endif /* end of include guard: FTXUI_ANIMATION_HPP */
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_CAPTURED_MOUSE_HPP #ifndef FTXUI_CAPTURED_MOUSE_HPP
#define FTXUI_CAPTURED_MOUSE_HPP #define FTXUI_CAPTURED_MOUSE_HPP
@@ -15,3 +12,7 @@ using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_CAPTURED_MOUSE_HPP */ #endif /* end of include guard: FTXUI_CAPTURED_MOUSE_HPP */
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_COMPONENT_HPP #ifndef FTXUI_COMPONENT_HPP
#define FTXUI_COMPONENT_HPP #define FTXUI_COMPONENT_HPP
@@ -43,43 +40,36 @@ Component Vertical(Components children, int* selector);
Component Horizontal(Components children); Component Horizontal(Components children);
Component Horizontal(Components children, int* selector); Component Horizontal(Components children, int* selector);
Component Tab(Components children, int* selector); Component Tab(Components children, int* selector);
Component Stacked(Components children);
} // namespace Container } // namespace Container
Component Button(ButtonOption options);
Component Button(ConstStringRef label, Component Button(ConstStringRef label,
std::function<void()> on_click, std::function<void()> on_click,
ButtonOption options = ButtonOption::Simple()); Ref<ButtonOption> = ButtonOption::Simple());
Component Checkbox(CheckboxOption options);
Component Checkbox(ConstStringRef label, Component Checkbox(ConstStringRef label,
bool* checked, bool* checked,
CheckboxOption options = CheckboxOption::Simple()); Ref<CheckboxOption> option = CheckboxOption::Simple());
Component Input(InputOption options = {});
Component Input(StringRef content, InputOption options = {});
Component Input(StringRef content, Component Input(StringRef content,
StringRef placeholder, ConstStringRef placeholder,
InputOption options = {}); Ref<InputOption> option = {});
Component Menu(MenuOption options);
Component Menu(ConstStringListRef entries, Component Menu(ConstStringListRef entries,
int* selected_, int* selected_,
MenuOption options = MenuOption::Vertical()); Ref<MenuOption> = MenuOption::Vertical());
Component MenuEntry(MenuEntryOption options); Component MenuEntry(ConstStringRef label, Ref<MenuEntryOption> = {});
Component MenuEntry(ConstStringRef label, MenuEntryOption options = {});
Component Radiobox(RadioboxOption options);
Component Radiobox(ConstStringListRef entries,
int* selected_,
RadioboxOption options = {});
Component Dropdown(ConstStringListRef entries, int* selected); Component Dropdown(ConstStringListRef entries, int* selected);
Component Radiobox(ConstStringListRef entries,
int* selected_,
Ref<RadioboxOption> option = {});
Component Toggle(ConstStringListRef entries, int* selected); Component Toggle(ConstStringListRef entries, int* selected);
// General slider constructor: // General slider constructor:
template <typename T> template <typename T>
Component Slider(SliderOption<T> options); Component Slider(SliderOption<T> options = {});
// Shorthand without the `SliderOption` constructor: // Shorthand without the `SliderOption` constructor:
Component Slider(ConstStringRef label, Component Slider(ConstStringRef label,
@@ -98,7 +88,6 @@ Component Slider(ConstStringRef label,
ConstRef<long> max = 100l, ConstRef<long> max = 100l,
ConstRef<long> increment = 5l); ConstRef<long> increment = 5l);
Component ResizableSplit(ResizableSplitOption options);
Component ResizableSplitLeft(Component main, Component back, int* main_size); Component ResizableSplitLeft(Component main, Component back, int* main_size);
Component ResizableSplitRight(Component main, Component back, int* main_size); Component ResizableSplitRight(Component main, Component back, int* main_size);
Component ResizableSplitTop(Component main, Component back, int* main_size); Component ResizableSplitTop(Component main, Component back, int* main_size);
@@ -135,8 +124,10 @@ ComponentDecorator Hoverable(std::function<void()> on_enter,
std::function<void()> on_leave); std::function<void()> on_leave);
ComponentDecorator Hoverable(std::function<void(bool)> on_change); ComponentDecorator Hoverable(std::function<void(bool)> on_change);
Component Window(WindowOptions option);
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_HPP */
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -1,6 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_COMPONENT_BASE_HPP #ifndef FTXUI_COMPONENT_BASE_HPP
#define FTXUI_COMPONENT_BASE_HPP #define FTXUI_COMPONENT_BASE_HPP
@@ -32,12 +29,6 @@ class ComponentBase {
// virtual Destructor. // virtual Destructor.
virtual ~ComponentBase(); virtual ~ComponentBase();
ComponentBase() = default;
// A component is not copiable.
ComponentBase(const ComponentBase&) = delete;
void operator=(const ComponentBase&) = delete;
// Component hierarchy: // Component hierarchy:
ComponentBase* Parent() const; ComponentBase* Parent() const;
Component& ChildAt(size_t i); Component& ChildAt(size_t i);
@@ -96,3 +87,7 @@ class ComponentBase {
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_BASE_HPP */ #endif /* end of include guard: FTXUI_COMPONENT_BASE_HPP */
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

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