mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-06 16:14:35 +08:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
22ebc823c9 | ||
![]() |
49f0277103 | ||
![]() |
ac10603fdb | ||
![]() |
a3f51ecf22 | ||
![]() |
78897ef1f4 | ||
![]() |
debcbc668c | ||
![]() |
1a7a550bfe | ||
![]() |
4ce8f6d250 | ||
![]() |
7b08dae6d0 | ||
![]() |
521d1125d9 | ||
![]() |
0903ad1608 | ||
![]() |
399549d180 | ||
![]() |
7bdca3ee68 | ||
![]() |
eb313e0f2d | ||
![]() |
d3ee655a90 |
17
.clang-tidy
17
.clang-tidy
@@ -1,32 +1,23 @@
|
||||
---
|
||||
Checks: "*,
|
||||
-*-macro-usage,
|
||||
-*-magic-numbers,
|
||||
-*-narrowing-conversions
|
||||
-*-unnecessary-value-param,
|
||||
-*-uppercase-literal-suffix,
|
||||
-abseil-*,
|
||||
-altera-*,
|
||||
-android-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-fuchsia-*,
|
||||
-google-*,
|
||||
-hicpp-signed-bitwise,
|
||||
-llvm*,
|
||||
-modernize-use-trailing-return-type,
|
||||
-zircon-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-misc-no-recursion,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
-modernize-use-nodiscard,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-avoid-const-params-in-decls,
|
||||
-readability-else-after-return,
|
||||
-readability-identifier-length,
|
||||
-readability-implicit-bool-conversion,
|
||||
-readability-non-const-parameter,
|
||||
-readability-simplify-boolean-expr,
|
||||
-readability-static-accessed-through-instance,
|
||||
-readability-use-anyofallof,
|
||||
-zircon-*,
|
||||
"
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
|
28
.github/workflows/build.yaml
vendored
28
.github/workflows/build.yaml
vendored
@@ -6,10 +6,10 @@ on:
|
||||
-v*
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -39,10 +39,6 @@ jobs:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Get number of CPU cores
|
||||
uses: SimenB/github-actions-cpu-cores@v1
|
||||
id: cpu-cores
|
||||
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v2
|
||||
|
||||
@@ -53,7 +49,7 @@ jobs:
|
||||
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
|
||||
cmake: true
|
||||
ninja: true
|
||||
clangtidy: false
|
||||
clangtidy: true
|
||||
cppcheck: false
|
||||
gcovr: "5.0"
|
||||
opencppcoverage: true
|
||||
@@ -65,14 +61,12 @@ jobs:
|
||||
cmake -S .
|
||||
-B ./build
|
||||
-DCMAKE_BUILD_TYPE:STRING=Debug
|
||||
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
||||
-DFTXUI_ENABLE_COVERAGE:BOOL=ON
|
||||
-DFTXUI_BUILD_DOCS:BOOL=OFF
|
||||
-DFTXUI_BUILD_EXAMPLES:BOOL=ON
|
||||
-DFTXUI_BUILD_TESTS:BOOL=ON
|
||||
-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF
|
||||
-DFTXUI_ENABLE_INSTALL:BOOL=ON
|
||||
-DFTXUI_DEV_WARNINGS:BOOL=ON ;
|
||||
-DFTXUI_ENABLE_INSTALL:BOOL=ON ;
|
||||
|
||||
- name: "Build"
|
||||
run: >
|
||||
@@ -150,10 +144,6 @@ jobs:
|
||||
asset_path: build/ftxui*Win64*
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Get number of CPU cores
|
||||
uses: SimenB/github-actions-cpu-cores@v1
|
||||
id: cpu-cores
|
||||
|
||||
- name: "Checkout repository"
|
||||
uses: actions/checkout@v2
|
||||
|
||||
@@ -166,15 +156,12 @@ jobs:
|
||||
cd build;
|
||||
cmake ..
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
||||
-DFTXUI_BUILD_DOCS=OFF
|
||||
-DFTXUI_BUILD_EXAMPLES=OFF
|
||||
-DFTXUI_BUILD_TESTS=OFF
|
||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||
-DFTXUI_ENABLE_INSTALL=ON
|
||||
-DFTXUI_DEV_WARNINGS=ON ;
|
||||
-DFTXUI_ENABLE_INSTALL=ON;
|
||||
cmake --build . --target package;
|
||||
|
||||
- uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||
@@ -182,7 +169,7 @@ jobs:
|
||||
overwrite: true
|
||||
|
||||
documentation:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
if: github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout repository"
|
||||
@@ -209,8 +196,7 @@ jobs:
|
||||
-DFTXUI_BUILD_EXAMPLES=ON
|
||||
-DFTXUI_BUILD_TESTS=OFF
|
||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||
-DFTXUI_ENABLE_INSTALL=OFF
|
||||
-DFTXUI_DEV_WARNINGS=ON ;
|
||||
-DFTXUI_ENABLE_INSTALL=OFF;
|
||||
cmake --build . --target doc;
|
||||
cmake --build . ;
|
||||
rsync -amv
|
||||
|
76
.github/workflows/codeql.yml
vendored
76
.github/workflows/codeql.yml
vendored
@@ -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
56
.gitignore
vendored
@@ -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
|
67
CHANGELOG.md
67
CHANGELOG.md
@@ -1,81 +1,24 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
current (development)
|
||||
---------------------
|
||||
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
### Component
|
||||
- Breaking: MenuDirection enum is renamed Direction
|
||||
- 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
|
||||
- Feature: Add `hyperlink` decorator. For instance:
|
||||
```cpp
|
||||
auto link = text("Click here") | hyperlink("https://github.com/FTXUI")
|
||||
```
|
||||
See the [OSC 8 page](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
|
||||
FTXUI support proposed by @aaleino in [#662](https://github.com/ArthurSonzogni/FTXUI/issues/662).
|
||||
|
||||
### Screen
|
||||
- Breaking: `WordBreakProperty` becomes a uint8_t enum. This yields a 0.8%
|
||||
performance improvement.
|
||||
- Breaking: Remove user defined Pixel constructor and equality operator.
|
||||
- Performance: 19% faster on benchmarks.
|
||||
|
||||
|
||||
### Build
|
||||
- Check version compatibility when using cmake find_package()
|
||||
- Add `FTXUI_DEV_WARNING` options to turn on warnings when building FTXUI
|
||||
- Turn OFF by default `FTXUI_BUILD_DOCS`
|
||||
- Turn OFF by default `FTXUI_BUILD_EXAMPLE`
|
||||
|
||||
4.1.1
|
||||
4.1.0
|
||||
-----
|
||||
|
||||
### Component
|
||||
- Feature: Support `ResizableSplit` with customizable separator.
|
||||
- Fix: Support arrow keys in application mode
|
||||
- Fix: Remove useless new line when using an alternative screen.
|
||||
|
||||
### Dom
|
||||
- Feature: Add the dashed style for border and separator:
|
||||
- See `DASHED` enum, and `separatorDashed()`, `borderDashed()` functions.
|
||||
- Feature: Add the dashed style for border and separator.
|
||||
- Feature: Add colored borders.
|
||||
- See functions: `borderStyled(BorderStyle, Color)` and `borderStyled(Color)`.
|
||||
- Feature: Add `LinearGradient`. It can be used in `color` and `bgColor`.
|
||||
- Feature: Add `LinearGradient`!
|
||||
- Improvement: Color::Interpolate() uses gamma correction.
|
||||
- Fix: Check the `graph` area is positive.
|
||||
|
||||
### Build/Install
|
||||
- Use globally set CMAKE_CXX_STANDARD if it is set.
|
||||
- Expose the pkg-config file
|
||||
- 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.
|
||||
- Expose the pkg-config file.
|
||||
|
||||
4.0.0
|
||||
-----
|
||||
|
@@ -1,20 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
project(ftxui
|
||||
LANGUAGES CXX
|
||||
VERSION 5.0.0
|
||||
VERSION 4.1.0
|
||||
DESCRIPTION "C++ Functional Terminal User Interface."
|
||||
)
|
||||
|
||||
option(FTXUI_QUIET "Set to ON for FTXUI to be quiet" OFF)
|
||||
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" OFF)
|
||||
option(FTXUI_BUILD_DOCS "Set to ON to build docs" OFF)
|
||||
option(FTXUI_BUILD_DOCS "Set to ON to build docs" ON)
|
||||
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" ON)
|
||||
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_ENABLE_INSTALL "Generate the install target" ON)
|
||||
option(FTXUI_CLANG_TIDY "Execute clang-tidy" OFF)
|
||||
option(FTXUI_ENABLE_COVERAGE "Execute code coverage" OFF)
|
||||
option(FTXUI_DEV_WARNINGS "Enable more compiler warnings and warnings as errors" OFF)
|
||||
|
||||
set(FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT "On windows, assume the \
|
||||
terminal used will be one of Microsoft and use a set of reasonnable fallback \
|
||||
@@ -27,7 +25,6 @@ else()
|
||||
${FTXUI_MICROSOFT_TERMINAL_FALLBACK_HELP_TEXT} OFF)
|
||||
endif()
|
||||
|
||||
include(cmake/ftxui_message.cmake)
|
||||
|
||||
add_library(screen
|
||||
include/ftxui/screen/box.hpp
|
||||
@@ -55,7 +52,6 @@ add_library(dom
|
||||
src/ftxui/dom/automerge.cpp
|
||||
src/ftxui/dom/blink.cpp
|
||||
src/ftxui/dom/bold.cpp
|
||||
src/ftxui/dom/hyperlink.cpp
|
||||
src/ftxui/dom/border.cpp
|
||||
src/ftxui/dom/box_helper.cpp
|
||||
src/ftxui/dom/box_helper.hpp
|
||||
@@ -132,7 +128,6 @@ add_library(component
|
||||
src/ftxui/component/terminal_input_parser.cpp
|
||||
src/ftxui/component/terminal_input_parser.hpp
|
||||
src/ftxui/component/util.cpp
|
||||
src/ftxui/component/window.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(dom
|
||||
|
64
README.md
64
README.md
@@ -1,15 +1,13 @@
|
||||
<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/>
|
||||
<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="#"><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/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://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">
|
||||
<img src="https://codecov.io/gh/ArthurSonzogni/FTXUI/branch/master/graph/badge.svg?token=C41FdRpNVA"/>
|
||||
</a>
|
||||
@@ -24,11 +22,11 @@
|
||||
|
||||
</p>
|
||||
|
||||
# FTXUI
|
||||
## FTXUI
|
||||
|
||||
<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
|
||||
* 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 drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated)
|
||||
* 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)
|
||||
* 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...
|
||||
|
||||
## Documentation
|
||||
@@ -52,22 +50,34 @@ A simple cross-platform C++ library for terminal based user interfaces!
|
||||
- [Examples (WebAssembly)](https://arthursonzogni.github.io/FTXUI/examples/)
|
||||
- [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
|
||||
~~~cpp
|
||||
vbox({
|
||||
hbox({
|
||||
text("one") | border,
|
||||
text("two") | border | flex,
|
||||
text("three") | border | flex,
|
||||
}),
|
||||
|
||||
gauge(0.25) | color(Color::Red),
|
||||
gauge(0.50) | color(Color::White),
|
||||
gauge(0.75) | color(Color::Blue),
|
||||
});
|
||||
vbox({
|
||||
hbox({
|
||||
text("left") | border,
|
||||
text("middle") | border | flex,
|
||||
text("right") | border,
|
||||
}),
|
||||
gauge(0.5) | border,
|
||||
});
|
||||
~~~
|
||||
|
||||

|
||||
~~~bash
|
||||
┌────┐┌───────────────────────────────────────────────────────────────┐┌─────┐
|
||||
│left││middle ││right│
|
||||
└────┘└───────────────────────────────────────────────────────────────┘└─────┘
|
||||
┌────────────────────────────────────────────────────────────────────────────┐
|
||||
│██████████████████████████████████████ │
|
||||
└────────────────────────────────────────────────────────────────────────────┘
|
||||
~~~
|
||||
|
||||
## Short gallery
|
||||
|
||||
@@ -93,7 +103,7 @@ Element can become flexible using the the `flex` decorator.
|
||||

|
||||
|
||||
|
||||
[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:
|
||||
|
||||

|
||||
|
||||
@@ -117,7 +127,6 @@ An element can be decorated using the functions:
|
||||
- `strikethrough`
|
||||
- `color`
|
||||
- `bgcolor`
|
||||
- `hyperlink`
|
||||
|
||||
[Example](https://arthursonzogni.github.io/FTXUI/examples_2dom_2style_gallery_8cpp-example.html)
|
||||
|
||||
@@ -292,8 +301,8 @@ Prebuilt components are declared in [<ftxui/component/component.hpp>](https://ar
|
||||
|
||||
</details>
|
||||
|
||||
## Libraries for FTXUI
|
||||
- *Want to share a useful component using FTXUI? Feel free adding yours here*
|
||||
|
||||
|
||||
|
||||
|
||||
## Project using FTXUI
|
||||
@@ -321,10 +330,8 @@ Feel free to add your projects here:
|
||||
- [turing_cmd](https://github.com/DanArmor/turing_cmd)
|
||||
- [StartUp](https://github.com/StubbornVegeta/StartUp)
|
||||
- [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:
|
||||
- [TermBreaker](https://github.com/ArthurSonzogni/termBreaker) [**[Play web version]**](https://arthursonzogni.com/TermBreaker/)
|
||||
@@ -362,9 +369,6 @@ If you don't, the following packages have been created:
|
||||
- [vcpkg](https://vcpkgx.com/details.html?package=ftxui)
|
||||
- [Arch Linux PKGBUILD](https://aur.archlinux.org/packages/ftxui-git/).
|
||||
- [conan.io](https://conan.io/center/ftxui)
|
||||
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
|
||||
|
||||
[](https://repology.org/project/ftxui/versions)
|
||||
|
||||
## Contributors
|
||||
|
||||
|
@@ -4,5 +4,5 @@ add_library(ftxui::component ALIAS component)
|
||||
export(
|
||||
TARGETS screen dom component
|
||||
NAMESPACE ftxui::
|
||||
FILE "${PROJECT_BINARY_DIR}/ftxui-targets.cmake"
|
||||
FILE ${PROJECT_BINARY_DIR}/ftxui-targets.cmake
|
||||
)
|
||||
|
@@ -13,7 +13,7 @@ include(FetchContent)
|
||||
|
||||
FetchContent_Declare(googlebenchmark
|
||||
GIT_REPOSITORY "https://github.com/google/benchmark"
|
||||
GIT_TAG "015d1a091af6937488242b70121858bce8fd40e9" # v1.8.2
|
||||
GIT_TAG 62937f91b5c763a8e119d0c20c67b87bde8eff1c
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
|
||||
|
@@ -27,7 +27,7 @@ set(BUILD_GMOCK OFF CACHE INTERNAL "")
|
||||
set(INSTALL_GTEST OFF CACHE INTERNAL "")
|
||||
set(gtest_force_shared_crt ON CACHE INTERNAL "")
|
||||
add_subdirectory(
|
||||
"${googletest_SOURCE_DIR}"
|
||||
"${googletest_BINARY_DIR}"
|
||||
${googletest_SOURCE_DIR}
|
||||
${googletest_BINARY_DIR}
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
@@ -4,17 +4,24 @@ endif()
|
||||
|
||||
set(CMAKE_C_COMPILER clang)
|
||||
set(CMAKE_CXX_COMPILER clang++)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
function(fuzz source)
|
||||
set(name "ftxui-${source}")
|
||||
function(fuzz name)
|
||||
add_executable(${name}
|
||||
src/ftxui/component/${source}.cpp
|
||||
src/ftxui/component/${name}.cpp
|
||||
)
|
||||
target_include_directories(${name}
|
||||
PRIVATE src
|
||||
)
|
||||
target_link_libraries(${name}
|
||||
PRIVATE component
|
||||
)
|
||||
target_compile_options(${name}
|
||||
PRIVATE -fsanitize=fuzzer,address
|
||||
)
|
||||
target_link_libraries(${name}
|
||||
PRIVATE -fsanitize=fuzzer,address
|
||||
)
|
||||
target_include_directories(${name} PRIVATE src)
|
||||
target_link_libraries(${name} PRIVATE component)
|
||||
target_compile_options(${name} PRIVATE -fsanitize=fuzzer,address)
|
||||
target_link_libraries(${name} PRIVATE -fsanitize=fuzzer,address)
|
||||
target_compile_features(${name} PRIVATE cxx_std_17)
|
||||
endfunction(fuzz)
|
||||
|
||||
fuzz(terminal_input_parser_test_fuzzer)
|
||||
|
@@ -3,58 +3,41 @@ if(NOT FTXUI_ENABLE_INSTALL)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS screen dom component
|
||||
EXPORT ftxui-export
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
install(DIRECTORY include/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
# CMake package configuration for easy use of library in CMake
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Install the library and its public headers into the standard subdirectories
|
||||
# ------------------------------------------------------------------------------
|
||||
install(
|
||||
TARGETS screen dom component
|
||||
EXPORT ftxui-targets
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/ftxui
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Install the exported cmake targets for use in other CMake projects.
|
||||
# ------------------------------------------------------------------------------
|
||||
install(
|
||||
EXPORT ftxui-targets
|
||||
NAMESPACE ftxui::
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ftxui"
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Create and install the ftuxi-config.cmake and ftuxi-config-version.cmake files
|
||||
# needed to support users of find_package()
|
||||
# ------------------------------------------------------------------------------
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ftxui-config.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/ftxui/cmake"
|
||||
configure_package_config_file(ftxui-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||
)
|
||||
)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake"
|
||||
ftxui-config-version.cmake
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ftxui"
|
||||
)
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Create and install pkg-config file for easy use of library in build systems
|
||||
# other than CMake:
|
||||
# ------------------------------------------------------------------------------
|
||||
configure_file(ftxui.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc @ONLY)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||
)
|
||||
install(EXPORT ftxui-export
|
||||
FILE ftxui-config-version.cmake
|
||||
NAMESPACE ftxui::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||
)
|
||||
|
||||
# pkg-config file for easy use of library in build systems other than CMake
|
||||
configure_file(ftxui.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc
|
||||
@ONLY)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc
|
||||
DESTINATION lib/pkgconfig
|
||||
)
|
||||
|
@@ -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("└─────────────────────────────────────")
|
@@ -1,16 +1,18 @@
|
||||
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)
|
||||
message(STATUS "ftxui_set_options " ${library})
|
||||
set_target_properties(${library} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
if (NOT ${library} MATCHES "ftxui-*")
|
||||
set_target_properties(${library} PROPERTIES OUTPUT_NAME "ftxui-${library}")
|
||||
endif()
|
||||
|
||||
if (FTXUI_CLANG_TIDY)
|
||||
if (NOT CLANG_TIDY_EXE)
|
||||
message(FATAL_ERROR "clang-tidy requested but executable not found")
|
||||
endif()
|
||||
|
||||
if(CLANG_TIDY_EXE AND FTXUI_CLANG_TIDY)
|
||||
set_target_properties(${library}
|
||||
PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*"
|
||||
)
|
||||
@@ -41,7 +43,19 @@ function(ftxui_set_options library)
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
)
|
||||
|
||||
target_compile_features(${library} PUBLIC cxx_std_17)
|
||||
# Play nicely if we are being consumed by another project
|
||||
# and use their CMAKE_CXX_STANDARD. Otherwise, fall back to 17
|
||||
# C++17 is used. We require fold expression at least.
|
||||
if (DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
||||
else()
|
||||
set(CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
set_target_properties(${library} PROPERTIES
|
||||
CXX_STANDARD ${CXX_STANDARD}
|
||||
CXX_EXTENSIONS OFF
|
||||
)
|
||||
|
||||
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
||||
# to the library and the library users.
|
||||
@@ -52,10 +66,8 @@ function(ftxui_set_options library)
|
||||
# Add as many warning as possible:
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
if(FTXUI_DEV_WARNINGS)
|
||||
target_compile_options(${library} PRIVATE "/W3")
|
||||
target_compile_options(${library} PRIVATE "/WX")
|
||||
endif()
|
||||
target_compile_options(${library} PRIVATE "/W3")
|
||||
target_compile_options(${library} PRIVATE "/WX")
|
||||
target_compile_options(${library} PRIVATE "/wd4244")
|
||||
target_compile_options(${library} PRIVATE "/wd4267")
|
||||
target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS")
|
||||
@@ -63,34 +75,15 @@ function(ftxui_set_options library)
|
||||
# Force Win32 to UNICODE
|
||||
target_compile_definitions(${library} PRIVATE UNICODE _UNICODE)
|
||||
else()
|
||||
if(FTXUI_DEV_WARNINGS)
|
||||
target_compile_options(${library} PRIVATE "-Wall")
|
||||
target_compile_options(${library} PRIVATE "-Werror")
|
||||
target_compile_options(${library} PRIVATE "-Wextra")
|
||||
|
||||
target_compile_options(${library} PRIVATE "-Wcast-align")
|
||||
target_compile_options(${library} PRIVATE "-Wdeprecated")
|
||||
target_compile_options(${library} PRIVATE "-Wmissing-declarations")
|
||||
target_compile_options(${library} PRIVATE "-Wnon-virtual-dtor")
|
||||
target_compile_options(${library} PRIVATE "-Wnull-dereference")
|
||||
target_compile_options(${library} PRIVATE "-Woverloaded-virtual")
|
||||
target_compile_options(${library} PRIVATE "-Wpedantic")
|
||||
target_compile_options(${library} PRIVATE "-Wshadow")
|
||||
target_compile_options(${library} PRIVATE "-Wunused")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${library} PRIVATE "-Wuseless-cast")
|
||||
endif()
|
||||
endif()
|
||||
target_compile_options(${library} PRIVATE "-Wall")
|
||||
target_compile_options(${library} PRIVATE "-Wextra")
|
||||
target_compile_options(${library} PRIVATE "-pedantic")
|
||||
target_compile_options(${library} PRIVATE "-Werror")
|
||||
target_compile_options(${library} PRIVATE "-Wmissing-declarations")
|
||||
target_compile_options(${library} PRIVATE "-Wdeprecated")
|
||||
target_compile_options(${library} PRIVATE "-Wshadow")
|
||||
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)
|
||||
target_compile_definitions(${library}
|
||||
PRIVATE "FTXUI_MICROSOFT_TERMINAL_FALLBACK")
|
||||
|
@@ -1,4 +1,5 @@
|
||||
if (NOT FTXUI_BUILD_TESTS)
|
||||
if (NOT FTXUI_BUILD_TESTS OR
|
||||
NOT ${CMAKE_VERSION} VERSION_GREATER "3.11.4")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -36,7 +37,6 @@ add_executable(ftxui-tests
|
||||
src/ftxui/dom/gauge_test.cpp
|
||||
src/ftxui/dom/gridbox_test.cpp
|
||||
src/ftxui/dom/hbox_test.cpp
|
||||
src/ftxui/dom/hyperlink_test.cpp
|
||||
src/ftxui/dom/linear_gradient_test.cpp
|
||||
src/ftxui/dom/scroll_indicator_test.cpp
|
||||
src/ftxui/dom/separator_test.cpp
|
||||
@@ -57,18 +57,10 @@ target_link_libraries(ftxui-tests
|
||||
target_include_directories(ftxui-tests
|
||||
PRIVATE src
|
||||
)
|
||||
target_compile_features(ftxui-tests PRIVATE cxx_std_20)
|
||||
|
||||
if (FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||
target_compile_definitions(ftxui-tests
|
||||
PRIVATE "FTXUI_MICROSOFT_TERMINAL_FALLBACK")
|
||||
endif()
|
||||
ftxui_set_options(ftxui-tests)
|
||||
target_compile_features(ftxui-tests PUBLIC cxx_std_20)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(ftxui-tests
|
||||
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)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
find_program(iwyu_path NAMES include-what-you-use iwyu)
|
||||
if(iwyu_path)
|
||||
set_property(TARGET ${lib}
|
||||
PROPERTY "${iwyu_path}" -Xiwyu
|
||||
--mapping_file "${CMAKE_CURRENT_SOURCE_DIR}/iwyu.imp"
|
||||
PROPERTY ${iwyu_path} -Xiwyu
|
||||
--mapping_file ${CMAKE_CURRENT_SOURCE_DIR}/iwyu.imp
|
||||
)
|
||||
endif()
|
||||
|
@@ -113,9 +113,11 @@ The project is comprised of 3 modules:
|
||||
|
||||
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
|
||||
be utilized to navigate using the arrow keys *and/or* cursor. There are
|
||||
several builtin widgets like checkbox/inputbox/etc to interact with. You can
|
||||
combine them, or even define your own custom components.
|
||||
be utilized to navigate the program by using the arrow keys and interacting
|
||||
with widgets such as the checkbox. You can also make you own 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}
|
||||
|
||||
|
@@ -8,15 +8,20 @@ function(example name)
|
||||
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
|
||||
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
|
||||
target_compile_features(ftxui_example_${name} PRIVATE cxx_std_20)
|
||||
set_target_properties(ftxui_example_${name} PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
)
|
||||
endfunction(example)
|
||||
|
||||
add_subdirectory(component)
|
||||
add_subdirectory(dom)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1")
|
||||
target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1")
|
||||
# 32MB should be enough to run all the examples, in debug mode.
|
||||
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)
|
||||
foreach(file
|
||||
|
@@ -17,7 +17,6 @@ example(focus_cursor)
|
||||
example(gallery)
|
||||
example(homescreen)
|
||||
example(input)
|
||||
example(input_style)
|
||||
example(linear_gradient_gallery)
|
||||
example(maybe)
|
||||
example(menu)
|
||||
@@ -41,7 +40,5 @@ example(slider_direction)
|
||||
example(slider_rgb)
|
||||
example(tab_horizontal)
|
||||
example(tab_vertical)
|
||||
example(textarea)
|
||||
example(toggle)
|
||||
example(window)
|
||||
example(with_restored_io)
|
||||
|
@@ -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 <string> // for operator+, to_string
|
||||
|
||||
@@ -12,7 +9,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int value = 50;
|
||||
|
||||
// The tree of components. This defines how to navigate using the keyboard.
|
||||
@@ -37,3 +34,7 @@ int main() {
|
||||
screen.Loop(component);
|
||||
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.
|
||||
|
@@ -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 <string> // for operator+, to_string
|
||||
|
||||
@@ -14,7 +11,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int value = 50;
|
||||
|
||||
// The tree of components. This defines how to navigate using the keyboard.
|
||||
@@ -43,3 +40,7 @@ int main() {
|
||||
screen.Loop(component);
|
||||
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.
|
||||
|
@@ -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 <string> // for to_string, operator+
|
||||
|
||||
@@ -14,16 +11,17 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int counter = 0;
|
||||
auto on_click = [&] { counter++; };
|
||||
|
||||
auto style = ButtonOption::Animated(Color::Default, Color::GrayDark,
|
||||
Color::Default, Color::White);
|
||||
auto button_style = ButtonOption::Animated(Color::Default, Color::GrayDark,
|
||||
Color::Default, Color::White);
|
||||
|
||||
auto container = Container::Vertical({});
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -45,3 +43,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int value = 0;
|
||||
auto action = [&] { value++; };
|
||||
auto action_renderer =
|
||||
@@ -58,3 +55,7 @@ int main() {
|
||||
screen.Loop(buttons);
|
||||
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.
|
||||
|
@@ -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 <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border
|
||||
#include <ftxui/screen/screen.hpp> // for Pixel
|
||||
@@ -17,7 +14,7 @@
|
||||
#include "ftxui/dom/canvas.hpp" // for Canvas
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
int mouse_x = 0;
|
||||
@@ -260,3 +257,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string, operator+, to_string
|
||||
#include <vector> // for vector
|
||||
@@ -11,12 +8,12 @@
|
||||
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, size, border, frame, vscroll_indicator, HEIGHT, LESS_THAN
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
Component input_list = Container::Vertical({});
|
||||
std::vector<std::string> items(100, "");
|
||||
for (size_t i = 0; i < items.size(); ++i) {
|
||||
for (int i = 0; i < items.size(); ++i) {
|
||||
input_list->Add(Input(&(items[i]), "placeholder " + std::to_string(i)));
|
||||
}
|
||||
|
||||
@@ -28,3 +25,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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 <memory> // for shared_ptr, __shared_ptr_access
|
||||
#include <string> // for operator+, to_string
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::array<bool, 30> states;
|
||||
|
||||
auto container = Container::Vertical({});
|
||||
@@ -32,3 +29,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <utility> // for move
|
||||
#include <vector> // for vector
|
||||
@@ -29,7 +26,7 @@ Component Empty() {
|
||||
return std::make_shared<ComponentBase>();
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto component =
|
||||
Collapsible("Collapsible 1",
|
||||
Inner({
|
||||
@@ -55,3 +52,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for operator+, to_string
|
||||
|
||||
@@ -14,7 +11,7 @@ using namespace ftxui;
|
||||
|
||||
// An example of how to compose multiple components into one and maintain their
|
||||
// interactiveness.
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto left_count = 0;
|
||||
auto right_count = 0;
|
||||
|
||||
@@ -61,3 +58,7 @@ int main() {
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
@@ -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 <chrono> // for milliseconds
|
||||
#include <ftxui/component/event.hpp> // for Event
|
||||
@@ -14,7 +11,7 @@
|
||||
#include "ftxui/component/loop.hpp" // for Loop
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
|
||||
@@ -52,3 +49,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <vector> // for vector
|
||||
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/component/component.hpp" // for Dropdown, Horizontal, Vertical
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
std::vector<std::string> entries = {
|
||||
@@ -42,3 +39,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
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.
|
||||
|
@@ -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 <memory> // for shared_ptr, __shared_ptr_access, allocator
|
||||
#include <string> // for string, basic_string, to_string, operator+, char_traits
|
||||
@@ -16,7 +13,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
int direction_index = 0;
|
||||
@@ -189,3 +186,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for operator+, char_traits, to_string, string
|
||||
#include <vector> // for vector
|
||||
@@ -34,7 +31,7 @@ Element make_grid() {
|
||||
return gridbox(rows);
|
||||
};
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
float focus_x = 0.5f;
|
||||
float focus_y = 0.5f;
|
||||
|
||||
@@ -67,3 +64,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for allocator, operator+, char_traits, string
|
||||
|
||||
@@ -22,7 +19,7 @@ Component Instance(std::string label, Decorator focusCursor) {
|
||||
});
|
||||
};
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
screen.Loop(Container::Vertical({
|
||||
Instance("focus", focus),
|
||||
@@ -35,3 +32,7 @@ int main() {
|
||||
}));
|
||||
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.
|
||||
|
@@ -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 <memory> // for shared_ptr, allocator, __shared_ptr_access
|
||||
#include <string> // for string, basic_string
|
||||
@@ -26,7 +23,7 @@ Component Wrap(std::string name, Component component) {
|
||||
});
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
|
||||
// -- Menu
|
||||
@@ -131,3 +128,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <array> // for array
|
||||
#include <atomic> // for atomic
|
||||
@@ -27,7 +24,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -524,3 +521,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
BIN
examples/component/homescreen.gif
Normal file
BIN
examples/component/homescreen.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 966 KiB |
@@ -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 <string> // for char_traits, operator+, string, basic_string
|
||||
|
||||
@@ -12,7 +9,7 @@
|
||||
#include "ftxui/dom/elements.hpp" // for text, hbox, separator, Element, operator|, vbox, border
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
std::string first_name;
|
||||
@@ -46,3 +43,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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);
|
||||
}
|
@@ -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/dom/elements.hpp> // for operator|, Element, flex, bgcolor, text, vbox, center
|
||||
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
|
||||
@@ -12,7 +9,7 @@
|
||||
#include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
@@ -25,8 +22,8 @@ int main() {
|
||||
std::string slider_end_text;
|
||||
|
||||
auto slider_angle = Slider(&slider_angle_text, &angle, 0, 360);
|
||||
auto slider_start = Slider(&slider_start_text, &start, 0.f, 1.f, 0.05f);
|
||||
auto slider_end = Slider(&slider_end_text, &end, 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);
|
||||
|
||||
auto layout = Container::Vertical({
|
||||
slider_angle,
|
||||
@@ -53,3 +50,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <vector> // for vector
|
||||
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> entries = {
|
||||
"entry 1",
|
||||
"entry 2",
|
||||
@@ -39,3 +36,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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 <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
|
||||
#include <string> // for string, basic_string, allocator
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/component/component_options.hpp" // for MenuOption
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
@@ -24,9 +21,13 @@ int main() {
|
||||
|
||||
MenuOption option;
|
||||
option.on_enter = screen.ExitLoopClosure();
|
||||
auto menu = Menu(&entries, &selected, option);
|
||||
auto menu = Menu(&entries, &selected, &option);
|
||||
|
||||
screen.Loop(menu);
|
||||
|
||||
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.
|
||||
|
@@ -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 <memory> // for allocator, __shared_ptr_access
|
||||
#include <string> // for string, basic_string, operator+, to_string
|
||||
@@ -13,7 +10,7 @@
|
||||
#include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
|
||||
#include "ftxui/dom/elements.hpp" // for text, separator, bold, hcenter, vbox, hbox, gauge, Element, operator|, border
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
@@ -30,9 +27,9 @@ int main() {
|
||||
int left_menu_selected = 0;
|
||||
int right_menu_selected = 0;
|
||||
Component left_menu_ =
|
||||
Menu(&left_menu_entries, &left_menu_selected, menu_option);
|
||||
Menu(&left_menu_entries, &left_menu_selected, &menu_option);
|
||||
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({
|
||||
left_menu_,
|
||||
@@ -77,3 +74,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream
|
||||
#include <memory> // for allocator, shared_ptr, __shared_ptr_access
|
||||
@@ -31,7 +28,7 @@ MenuEntryOption Colored(ftxui::Color c) {
|
||||
return option;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
int selected = 0;
|
||||
@@ -79,3 +76,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <memory> // for shared_ptr, __shared_ptr_access
|
||||
#include <string> // for to_string, allocator
|
||||
@@ -27,7 +24,7 @@ MenuEntryOption Colored(ftxui::Color c) {
|
||||
return option;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
int selected = 0;
|
||||
@@ -63,3 +60,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string, operator+, to_string
|
||||
#include <vector> // for vector
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> entries;
|
||||
int selected = 0;
|
||||
|
||||
@@ -30,3 +27,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <memory> // for allocator, __shared_ptr_access
|
||||
#include <string> // for string, operator+, basic_string, to_string, char_traits
|
||||
@@ -20,7 +17,7 @@ Component Window(std::string title, Component component) {
|
||||
});
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int menu_selected[] = {0, 0, 0};
|
||||
std::vector<std::vector<std::string>> menu_entries = {
|
||||
{
|
||||
@@ -75,3 +72,7 @@ int main() {
|
||||
screen.Loop(global);
|
||||
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.
|
||||
|
@@ -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 <chrono> // for milliseconds
|
||||
#include <functional> // for function
|
||||
@@ -33,7 +30,7 @@ Component HMenu3(std::vector<std::string>* entries, int* selected);
|
||||
Component HMenu4(std::vector<std::string>* entries, int* selected);
|
||||
Component HMenu5(std::vector<std::string>* entries, int* selected);
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
std::vector<std::string> entries{
|
||||
@@ -113,7 +110,7 @@ int main() {
|
||||
|
||||
Component VMenu1(std::vector<std::string>* entries, int* selected) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
state.label = (state.active ? "> " : " ") + state.label;
|
||||
Element e = text(state.label);
|
||||
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) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
state.label += (state.active ? " <" : " ");
|
||||
Element e = hbox(filler(), text(state.label));
|
||||
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) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
Element e = state.active ? text("[" + state.label + "]")
|
||||
: text(" " + state.label + " ");
|
||||
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) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
if (state.active && state.focused) {
|
||||
return text(state.label) | color(Color::Yellow) | bgcolor(Color::Black) |
|
||||
bold;
|
||||
@@ -178,7 +175,7 @@ Component VMenu4(std::vector<std::string>* entries, int* selected) {
|
||||
|
||||
Component VMenu5(std::vector<std::string>* entries, int* selected) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
auto element = text(state.label);
|
||||
if (state.active && state.focused) {
|
||||
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) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.animated_colors.foreground.enabled = true;
|
||||
option.entries_option.animated_colors.background.enabled = true;
|
||||
option.entries_option.animated_colors.background.active = Color::Red;
|
||||
option.entries_option.animated_colors.background.inactive = Color::Black;
|
||||
option.entries_option.animated_colors.foreground.active = Color::White;
|
||||
option.entries_option.animated_colors.foreground.inactive = Color::Red;
|
||||
option.entries.animated_colors.foreground.enabled = true;
|
||||
option.entries.animated_colors.background.enabled = true;
|
||||
option.entries.animated_colors.background.active = Color::Red;
|
||||
option.entries.animated_colors.background.inactive = Color::Black;
|
||||
option.entries.animated_colors.foreground.active = Color::White;
|
||||
option.entries.animated_colors.foreground.inactive = Color::Red;
|
||||
return Menu(entries, selected, option);
|
||||
}
|
||||
|
||||
Component VMenu8(std::vector<std::string>* entries, int* selected) {
|
||||
auto option = MenuOption::Vertical();
|
||||
option.entries_option.animated_colors.foreground.Set(
|
||||
Color::Red, Color::White, std::chrono::milliseconds(500));
|
||||
option.entries.animated_colors.foreground.Set(Color::Red, Color::White,
|
||||
std::chrono::milliseconds(500));
|
||||
return Menu(entries, selected, option);
|
||||
}
|
||||
|
||||
@@ -243,7 +240,7 @@ Component HMenu5(std::vector<std::string>* entries, int* selected) {
|
||||
auto option = MenuOption::HorizontalAnimated();
|
||||
option.underline.SetAnimation(std::chrono::milliseconds(1500),
|
||||
animation::easing::ElasticOut);
|
||||
option.entries_option.transform = [](EntryState state) {
|
||||
option.entries.transform = [](EntryState state) {
|
||||
Element e = text(state.label) | hcenter | flex;
|
||||
if (state.active && state.focused)
|
||||
e = e | bold;
|
||||
@@ -255,3 +252,7 @@ Component HMenu5(std::vector<std::string>* entries, int* selected) {
|
||||
option.underline.color_active = Color::Red;
|
||||
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.
|
||||
|
@@ -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 <memory> // for allocator, shared_ptr, __shared_ptr_access
|
||||
#include <string> // for string, operator+, to_string, basic_string
|
||||
@@ -30,7 +27,7 @@ Component Text(const std::string& t) {
|
||||
return Renderer([t] { return text(t) | borderEmpty; });
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace std::literals;
|
||||
std::vector<std::string> tab_values{
|
||||
"Tab 1", "Tab 2", "Tab 3", "A very very long tab", "탭",
|
||||
@@ -91,3 +88,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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/mouse.hpp> // for ftxui
|
||||
#include <functional> // for function
|
||||
@@ -80,3 +77,7 @@ int main(int argc, const char* argv[]) {
|
||||
screen.Loop(main_component);
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string, char_traits, operator+
|
||||
#include <vector> // for vector
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
|
||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, filler, text, hbox, separator, center, vbox, bold, border, clear_under, dbox, size, GREATER_THAN, HEIGHT
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
@@ -91,3 +88,7 @@ int main() {
|
||||
screen.Loop(main_renderer);
|
||||
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.
|
||||
|
@@ -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 <string> // for operator+, string, char_traits, basic_string
|
||||
|
||||
@@ -38,7 +35,7 @@ void Nested(std::string path) {
|
||||
screen.Loop(renderer);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
auto button_quit = Button("Quit", screen.ExitLoopClosure());
|
||||
auto button_nested = Button("Nested", [] { Nested(""); });
|
||||
@@ -48,3 +45,7 @@ int main() {
|
||||
}));
|
||||
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.
|
||||
|
@@ -134,7 +134,7 @@ std::string Stringify(Event event) {
|
||||
return out;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
|
||||
std::vector<Event> keys;
|
||||
|
@@ -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 <vector> // for vector
|
||||
|
||||
@@ -10,7 +7,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> radiobox_list = {
|
||||
"Use gcc",
|
||||
"Use clang",
|
||||
@@ -23,3 +20,7 @@ int main() {
|
||||
screen.Loop(Radiobox(&radiobox_list, &selected));
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string, operator+, to_string
|
||||
#include <vector> // for vector
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> entries;
|
||||
int selected = 0;
|
||||
|
||||
@@ -30,3 +27,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
@@ -10,7 +7,7 @@
|
||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, text, bold, border, center, color
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto screen = ScreenInteractive::FitComponent();
|
||||
|
||||
@@ -46,3 +43,7 @@ int main() {
|
||||
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.
|
||||
|
@@ -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 "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
@@ -11,7 +8,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
auto middle = Renderer([] { return text("middle") | center; });
|
||||
@@ -36,3 +33,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
int value = 50;
|
||||
auto slider = Slider("Value:", &value, 0, 100, 1);
|
||||
|
@@ -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 <cmath> // for sin
|
||||
#include <ftxui/component/component_base.hpp> // for ComponentBase
|
||||
@@ -16,7 +13,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
std::array<int, 30> values;
|
||||
for (int i = 0; i < values.size(); ++i) {
|
||||
@@ -24,10 +21,10 @@ int main() {
|
||||
}
|
||||
|
||||
auto layout_horizontal = Container::Horizontal({});
|
||||
for (auto& value : values) {
|
||||
for (int i = 0; i < values.size(); ++i) {
|
||||
// In C++17:
|
||||
SliderOption<int> option;
|
||||
option.value = &value;
|
||||
option.value = &values[i];
|
||||
option.max = 100;
|
||||
option.increment = 5;
|
||||
option.direction = Direction::Up;
|
||||
@@ -47,3 +44,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <string> // for char_traits, operator+, to_string
|
||||
|
||||
@@ -26,7 +23,7 @@ Element ColorString(int red, int green, int blue) {
|
||||
);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
int red = 128;
|
||||
int green = 25;
|
||||
int blue = 100;
|
||||
@@ -59,3 +56,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> tab_values{
|
||||
"tab_1",
|
||||
"tab_2",
|
||||
@@ -68,3 +65,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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 <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> tab_values{
|
||||
"tab_1",
|
||||
"tab_2",
|
||||
@@ -68,3 +65,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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);
|
||||
}
|
@@ -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 <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
@@ -13,7 +10,7 @@
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::string> toggle_1_entries = {
|
||||
"On",
|
||||
"Off",
|
||||
@@ -62,3 +59,7 @@ int main() {
|
||||
auto screen = ScreenInteractive::TerminalOutput();
|
||||
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.
|
||||
|
@@ -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;
|
||||
}
|
@@ -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 <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
|
||||
@@ -58,3 +55,7 @@ int main() {
|
||||
screen.Loop(renderer);
|
||||
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.
|
||||
|
@@ -27,7 +27,6 @@ example(style_bold)
|
||||
example(style_color)
|
||||
example(style_dim)
|
||||
example(style_gallery)
|
||||
example(style_hyperlink)
|
||||
example(style_inverted)
|
||||
example(style_strikethrough)
|
||||
example(style_underlined)
|
||||
@@ -35,3 +34,4 @@ example(style_underlined_double)
|
||||
example(table)
|
||||
example(vbox_hbox)
|
||||
example(vflow)
|
||||
example(window)
|
||||
|
@@ -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 <ftxui/dom/elements.hpp> // for text, operator|, vbox, border, Element, Fit, hbox
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
@@ -36,3 +33,7 @@ int main() {
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Screen
|
||||
#include <iostream> // for endl, cout, ostream
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
auto make_boxed = [] {
|
||||
@@ -37,3 +34,7 @@ int main() {
|
||||
screen.Print();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -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/screen/screen.hpp> // for Screen
|
||||
#include <iostream> // for endl, cout, ostream
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
auto document = vbox({
|
||||
@@ -26,3 +23,7 @@ int main() {
|
||||
screen.Print();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -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 <cmath> // for cos
|
||||
#include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
auto c = Canvas(100, 100);
|
||||
@@ -46,3 +43,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen.hpp> // for Full, Screen
|
||||
#include <ftxui/screen/terminal.hpp> // for ColorSupport, Color, Palette16, Palette256, TrueColor
|
||||
@@ -139,3 +136,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/color_info.hpp> // for ColorInfo
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
@@ -13,7 +10,7 @@
|
||||
using namespace ftxui;
|
||||
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
std::vector<std::vector<ColorInfo>> info_columns = ColorInfoSorted2D();
|
||||
|
||||
// Draw every columns
|
||||
@@ -37,3 +34,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
int saturation = 255;
|
||||
@@ -33,3 +30,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
int saturation = 255;
|
||||
@@ -52,3 +49,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = dbox({
|
||||
vbox({
|
||||
@@ -27,3 +24,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <ftxui/dom/elements.hpp> // for text, gauge, operator|, flex, hbox, Element
|
||||
#include <ftxui/screen/screen.hpp> // for Screen
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -34,3 +31,7 @@ int main() {
|
||||
}
|
||||
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.
|
||||
|
@@ -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 <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
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -76,3 +73,7 @@ int main() {
|
||||
}
|
||||
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.
|
||||
|
@@ -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 <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
|
||||
@@ -83,3 +80,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <ftxui/dom/elements.hpp> // for Elements, gridbox, Fit, operator|, text, border, Element
|
||||
#include <ftxui/screen/screen.hpp> // for Screen
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto cell = [](const char* t) { return text(t) | border; };
|
||||
auto document = //
|
||||
@@ -46,3 +43,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <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
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto make_box = [](int dimx, int dimy) {
|
||||
std::string title = std::to_string(dimx) + "x" + std::to_string(dimy);
|
||||
@@ -50,3 +47,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <ftxui/screen/screen.hpp> // for Screen
|
||||
#include <iostream> // for cout, ostream
|
||||
@@ -12,7 +9,7 @@
|
||||
#include "ftxui/screen/box.hpp" // for ftxui
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Red
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -57,3 +54,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/linear_gradient.hpp> // for LinearGradient::Stop, LinearGradient
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::DeepPink1, Color::DeepSkyBlue1, Color::Yellow, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = text("gradient") | center;
|
||||
|
||||
@@ -23,3 +20,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <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
|
||||
@@ -15,7 +12,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
struct Task {
|
||||
@@ -146,3 +143,7 @@ int main() {
|
||||
}
|
||||
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.
|
||||
|
@@ -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 <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
#include <iostream> // for cout, ostream
|
||||
@@ -13,13 +10,13 @@
|
||||
#include "ftxui/screen/box.hpp" // for ftxui
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
std::string p =
|
||||
R"(In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes' theorem, a person's age can be used to more accurately assess the probability that they have cancer, compared to the assessment of the probability of cancer made without knowledge of the person's age. One of the many applications of Bayes' theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes' theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of related evidence. Bayesian inference is fundamental to Bayesian statistics.)";
|
||||
|
||||
std::string reset_position;
|
||||
while (true) {
|
||||
for (int i = 0;; ++i) {
|
||||
auto document = vbox({
|
||||
hflow(paragraph(p)),
|
||||
separator(),
|
||||
@@ -51,3 +48,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = hbox({
|
||||
text("left-column"),
|
||||
@@ -28,3 +25,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <iostream> // for endl, cout, ostream
|
||||
#include <memory> // for allocator
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/box.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
auto document = vbox({
|
||||
@@ -44,3 +41,7 @@ int main() {
|
||||
screen.Print();
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -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/screen/screen.hpp> // for Screen
|
||||
#include <memory> // for allocator, shared_ptr
|
||||
@@ -10,7 +7,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto make_box = [](const std::string& title) {
|
||||
return window(text(title) | hcenter | bold,
|
||||
@@ -29,3 +26,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <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
|
||||
@@ -13,7 +10,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -44,3 +41,7 @@ int main() {
|
||||
}
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, operator""_rgb, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::DeepSkyBlue4, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::SkyBlue1, Color::White, Color::Yellow, Color::YellowLight, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = hbox({
|
||||
vbox({
|
||||
@@ -65,3 +62,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
// clang-format off
|
||||
auto document =
|
||||
@@ -22,8 +19,7 @@ int main() {
|
||||
text("blink") | blink , text(" ") ,
|
||||
text("strikethrough") | strikethrough , text(" ") ,
|
||||
text("color") | color(Color::Blue) , text(" ") ,
|
||||
text("bgcolor") | bgcolor(Color::Blue) , text(" ") ,
|
||||
text("hyperlink") | hyperlink("https://github.com/ArthurSonzogni/FTXUI"),
|
||||
text("bgcolor") | bgcolor(Color::Blue) ,
|
||||
});
|
||||
// clang-format on
|
||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||
@@ -32,3 +28,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -1,24 +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/elements.hpp> // for text, operator|, bold, Fit, hbox, Element
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
text("This text is an "),
|
||||
text("hyperlink") | hyperlink("https://www.google.com"),
|
||||
text(". Do you like it?"),
|
||||
});
|
||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||
Render(screen, document);
|
||||
screen.Print();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = hbox({
|
||||
text("This text is "),
|
||||
@@ -21,3 +18,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/screen/screen.hpp> // for Full, Screen
|
||||
#include <memory> // for allocator
|
||||
@@ -8,7 +5,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
hbox({
|
||||
@@ -22,3 +19,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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/table.hpp> // for Table, TableSelection
|
||||
#include <ftxui/screen/screen.hpp> // for Screen
|
||||
@@ -11,7 +8,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White, ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
|
||||
auto table = Table({
|
||||
@@ -62,3 +59,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
@@ -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 <ftxui/dom/elements.hpp> // for filler, text, hbox, vbox
|
||||
#include <ftxui/screen/screen.hpp> // for Full, Screen
|
||||
@@ -9,7 +6,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
|
||||
int main() {
|
||||
int main(int argc, const char* argv[]) {
|
||||
using namespace ftxui;
|
||||
auto document = //
|
||||
vbox({
|
||||
@@ -38,3 +35,7 @@ int main() {
|
||||
|
||||
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.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user