mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 10:40:00 +08:00
Add a doxygen documentation.
This commit is contained in:
parent
5f15b2881e
commit
20b9a0f0f5
@ -1,7 +1,15 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-list --count HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE git_version
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 0.1
|
VERSION 0.1.${git_version}
|
||||||
)
|
)
|
||||||
|
|
||||||
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" ON)
|
option(FTXUI_BUILD_EXAMPLES "Set to ON to build examples" ON)
|
||||||
|
@ -38,7 +38,7 @@ PROJECT_NAME = "FTXUI"
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 1.0
|
PROJECT_NUMBER = @CMAKE_PROJECT_VERSION@
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
@ -51,7 +51,7 @@ PROJECT_BRIEF = "C++ functionnal terminal UI."
|
|||||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||||
# the logo to the output directory.
|
# the logo to the output directory.
|
||||||
|
|
||||||
PROJECT_LOGO =
|
#PROJECT_LOGO = ./logo.png
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||||
# into which the generated documentation will be written. If a relative path is
|
# into which the generated documentation will be written. If a relative path is
|
||||||
@ -440,19 +440,19 @@ EXTRACT_ALL = YES
|
|||||||
# be included in the documentation.
|
# be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PRIVATE = YES
|
EXTRACT_PRIVATE = NO
|
||||||
|
|
||||||
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
||||||
# scope will be included in the documentation.
|
# scope will be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PACKAGE = YES
|
EXTRACT_PACKAGE = NO
|
||||||
|
|
||||||
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
|
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
|
||||||
# included in the documentation.
|
# included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_STATIC = YES
|
EXTRACT_STATIC = NO
|
||||||
|
|
||||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
||||||
# locally in source files will be included in the documentation. If set to NO,
|
# locally in source files will be included in the documentation. If set to NO,
|
||||||
@ -460,7 +460,7 @@ EXTRACT_STATIC = YES
|
|||||||
# for Java sources.
|
# for Java sources.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = NO
|
||||||
|
|
||||||
# This flag is only useful for Objective-C code. If set to YES, local methods,
|
# This flag is only useful for Objective-C code. If set to YES, local methods,
|
||||||
# which are defined in the implementation section but not in the interface are
|
# which are defined in the implementation section but not in the interface are
|
||||||
@ -468,7 +468,7 @@ EXTRACT_LOCAL_CLASSES = YES
|
|||||||
# included.
|
# included.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_LOCAL_METHODS = YES
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
|
|
||||||
# If this flag is set to YES, the members of anonymous namespaces will be
|
# If this flag is set to YES, the members of anonymous namespaces will be
|
||||||
# extracted and appear in the documentation as a namespace called
|
# extracted and appear in the documentation as a namespace called
|
||||||
@ -477,7 +477,7 @@ EXTRACT_LOCAL_METHODS = YES
|
|||||||
# are hidden.
|
# are hidden.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_ANON_NSPACES = YES
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
|
||||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
||||||
# undocumented members inside documented classes or files. If set to NO these
|
# undocumented members inside documented classes or files. If set to NO these
|
||||||
@ -702,7 +702,7 @@ FILE_VERSION_FILTER =
|
|||||||
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
||||||
# tag is left empty.
|
# tag is left empty.
|
||||||
|
|
||||||
#LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml
|
LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_layout.xml
|
||||||
|
|
||||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
||||||
# the reference definitions. This must be a list of .bib files. The .bib
|
# the reference definitions. This must be a list of .bib files. The .bib
|
||||||
@ -891,7 +891,8 @@ EXCLUDE_SYMLINKS = NO
|
|||||||
# Note that the wildcards are matched against the file with absolute path, so to
|
# Note that the wildcards are matched against the file with absolute path, so to
|
||||||
# exclude all test directories for example use the pattern */test/*
|
# exclude all test directories for example use the pattern */test/*
|
||||||
|
|
||||||
EXCLUDE_PATTERNS =
|
EXCLUDE_PATTERNS += *test.cpp
|
||||||
|
EXCLUDE_PATTERNS += *take_any_args.hpp
|
||||||
|
|
||||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||||
@ -1164,7 +1165,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
# of the possible markers and block names see the documentation.
|
# of the possible markers and block names see the documentation.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
#HTML_HEADER = @CMAKE_CURRENT_SOURCE_DIR@/header.html
|
HTML_HEADER = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_header.html
|
||||||
|
|
||||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||||
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
||||||
@ -1174,7 +1175,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
# that doxygen normally uses.
|
# that doxygen normally uses.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
#HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/footer.html
|
HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_footer.html
|
||||||
|
|
||||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
|
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
|
||||||
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
||||||
@ -1199,7 +1200,7 @@ HTML_STYLESHEET =
|
|||||||
# list). For an example see the documentation.
|
# list). For an example see the documentation.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
#HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_style.css
|
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/doxygen_extra.css
|
||||||
|
|
||||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||||
# other source files which should be copied to the HTML output directory. Note
|
# other source files which should be copied to the HTML output directory. Note
|
||||||
@ -2339,7 +2340,7 @@ INCLUDED_BY_GRAPH = YES
|
|||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
CALL_GRAPH = YES
|
CALL_GRAPH = NO
|
||||||
|
|
||||||
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
|
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
|
||||||
# dependency graph for every global function or class method.
|
# dependency graph for every global function or class method.
|
||||||
@ -2351,7 +2352,7 @@ CALL_GRAPH = YES
|
|||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
CALLER_GRAPH = YES
|
CALLER_GRAPH = NO
|
||||||
|
|
||||||
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
|
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
|
||||||
# hierarchy of all classes instead of a textual one.
|
# hierarchy of all classes instead of a textual one.
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
# Build ftxui and install
|
|
||||||
|
|
||||||
~~~bash
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
~~~
|
|
||||||
|
|
||||||
# Example project
|
|
||||||
|
|
||||||
main.cpp
|
|
||||||
~~~cpp
|
|
||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
|
||||||
using namespace ftxui;
|
|
||||||
auto document =
|
|
||||||
hbox({
|
|
||||||
text(L"left") | bold | border,
|
|
||||||
text(L"middle") | flex | border,
|
|
||||||
text(L"right") | border,
|
|
||||||
});
|
|
||||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
|
||||||
Render(screen, document);
|
|
||||||
|
|
||||||
std::cout << screen.ToString();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
~~~
|
|
||||||
|
|
||||||
# Add dependency
|
|
||||||
|
|
||||||
CMakeLists.txt
|
|
||||||
~~~cmake
|
|
||||||
cmake_minimum_required(VERSION 3.0)
|
|
||||||
|
|
||||||
find_package(ftxui REQUIRED)
|
|
||||||
add_executable(main main.cpp)
|
|
||||||
target_link_libraries(main PUBLIC ftxui::dom)
|
|
||||||
~~~
|
|
||||||
|
|
||||||
# Build
|
|
||||||
~~~
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake ..
|
|
||||||
make
|
|
||||||
./main
|
|
||||||
~~~
|
|
@ -1,39 +0,0 @@
|
|||||||
# Add dependency
|
|
||||||
|
|
||||||
.nxxm/deps
|
|
||||||
~~~json
|
|
||||||
{
|
|
||||||
"ArthurSonzogni/FTXUI": {}
|
|
||||||
}
|
|
||||||
~~~
|
|
||||||
|
|
||||||
# Example project
|
|
||||||
|
|
||||||
main.cpp
|
|
||||||
~~~cpp
|
|
||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
|
||||||
using namespace ftxui;
|
|
||||||
auto document =
|
|
||||||
hbox({
|
|
||||||
text(L"left") | bold | border,
|
|
||||||
text(L"middle") | flex | border,
|
|
||||||
text(L"right") | border,
|
|
||||||
});
|
|
||||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
|
||||||
Render(screen, document);
|
|
||||||
|
|
||||||
std::cout << screen.ToString();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
~~~
|
|
||||||
|
|
||||||
# Build
|
|
||||||
|
|
||||||
~~~
|
|
||||||
nxxm . -t clang-cxx17
|
|
||||||
~~~
|
|
335
doc/doxygen_extra.css
Executable file
335
doc/doxygen_extra.css
Executable file
@ -0,0 +1,335 @@
|
|||||||
|
/*
|
||||||
|
* GitHub Markdown style CSS for doxygen 1.8.14
|
||||||
|
* Source: https://github.com/sindresorhus/github-markdown-css
|
||||||
|
* License: MIT <EFBFBD> Sindre Sorhus
|
||||||
|
*/
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, table, div, p, dl {
|
||||||
|
-ms-text-size-adjust: 100%;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #24292e;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
b {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @group Heading Levels */
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
margin-top: 24px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
border-bottom: 1px solid #eaecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
font-size: 1.5em;
|
||||||
|
border-bottom: 1px solid #eaecef;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 0.85em;
|
||||||
|
color: #6a737d;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
background-color: transparent;
|
||||||
|
color: #0366d6;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contents a:visited {
|
||||||
|
color: #0366d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:active, a:hover {
|
||||||
|
outline-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]) {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.el {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip {
|
||||||
|
background-image: url(tip.png);
|
||||||
|
background-position: left center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-left: 30px;
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
min-height: 31px;
|
||||||
|
display: block;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warn {
|
||||||
|
background-image: url(warn.png);
|
||||||
|
background-position: left center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-left: 48px;
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
min-height: 31px;
|
||||||
|
display: block;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectname
|
||||||
|
{
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectbrief
|
||||||
|
{
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectnumber
|
||||||
|
{
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.contents {
|
||||||
|
width: 980px;
|
||||||
|
padding: 40px;
|
||||||
|
margin-top: -1px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #d1d5da;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.toc {
|
||||||
|
border: 0 none;
|
||||||
|
border-radius: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.header
|
||||||
|
{
|
||||||
|
width: 980px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
background-image: none;
|
||||||
|
background-repeat: none;
|
||||||
|
background-color: #f6f8fa;
|
||||||
|
border: 1px solid #d1d5da;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.headertitle
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title ol {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title ol li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-resizable-e {
|
||||||
|
background: none;
|
||||||
|
background-color: #E6E6E6;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.fragment {
|
||||||
|
padding: 16px;
|
||||||
|
background-color: #f3f3f3;
|
||||||
|
border: 0 solid;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
border-radius:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.fragment:hover {
|
||||||
|
background-color: #e9e9e9;
|
||||||
|
box-shadow: 0 5px 10px -5px rgb(0,0,0,0.5) inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.line {
|
||||||
|
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||||
|
font-size: 85%;
|
||||||
|
line-height: 1.45;
|
||||||
|
-webkit-transition-duration: 0;
|
||||||
|
-moz-transition-duration: 0;
|
||||||
|
-ms-transition-duration: 0;
|
||||||
|
-o-transition-duration: 0;
|
||||||
|
transition-duration: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.line.glow {
|
||||||
|
background-color: auto;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.fragment {
|
||||||
|
border: 0 solid #C4CFE5;
|
||||||
|
padding: 16px;
|
||||||
|
background-color: #f3f3f3;
|
||||||
|
font-size: 85%;
|
||||||
|
line-height: 1.45;
|
||||||
|
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @group Code Colorization */
|
||||||
|
span.keyword {
|
||||||
|
color: #808000
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keywordtype {
|
||||||
|
color: #808000
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keywordflow {
|
||||||
|
color: #808000
|
||||||
|
}
|
||||||
|
|
||||||
|
span.comment {
|
||||||
|
color: #008000
|
||||||
|
}
|
||||||
|
|
||||||
|
span.preprocessor {
|
||||||
|
color: #800000
|
||||||
|
}
|
||||||
|
|
||||||
|
span.stringliteral {
|
||||||
|
color: #000080
|
||||||
|
}
|
||||||
|
|
||||||
|
span.charliteral {
|
||||||
|
color: #000080
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
border-left: 2px solid #606060;
|
||||||
|
margin: 0 24px 0 4px;
|
||||||
|
padding: 0 12px 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-tree {
|
||||||
|
background-image: none;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-tree .label {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#side-nav {
|
||||||
|
width: 25%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memtitle {
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memproto {
|
||||||
|
text-shadow: none;
|
||||||
|
/* opera specific markup */
|
||||||
|
box-shadow: none;
|
||||||
|
/* firefox specific markup */
|
||||||
|
-moz-box-shadow: none;
|
||||||
|
-moz-border-radius-topright: 4px;
|
||||||
|
/* webkit specific markup */
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
-webkit-border-top-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memdoc {
|
||||||
|
background-image:none;
|
||||||
|
background-repeat:repeat-x;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
/* opera specific markup */
|
||||||
|
box-shadow: none;
|
||||||
|
/* firefox specific markup */
|
||||||
|
-moz-box-shadow: none;
|
||||||
|
/* webkit specific markup */
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-menu {
|
||||||
|
background: none;
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-menu li {
|
||||||
|
border: none !important;
|
||||||
|
transition: all 0.1s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-menu li:hover {
|
||||||
|
color:black;
|
||||||
|
background-color:black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-dox a, .sm-dox a:focus, .sm-dox a:active, .sm-dox a:hover, .sm-dox a.highlighted {
|
||||||
|
background-image:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#titlearea {
|
||||||
|
margin: 8px;
|
||||||
|
border: none;
|
||||||
|
}
|
10
doc/doxygen_footer.html
Normal file
10
doc/doxygen_footer.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!-- HTML footer for doxygen 1.8.14-->
|
||||||
|
<!-- start footer part -->
|
||||||
|
<!--BEGIN GENERATE_TREEVIEW-->
|
||||||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||||
|
</div>
|
||||||
|
<!--END GENERATE_TREEVIEW-->
|
||||||
|
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||||
|
<!--END !GENERATE_TREEVIEW-->
|
||||||
|
</body>
|
||||||
|
</html>
|
59
doc/doxygen_header.html
Normal file
59
doc/doxygen_header.html
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<!-- HTML header for doxygen 1.8.14-->
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="cache-control" content="max-age=86400"/>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||||
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
|
$treeview
|
||||||
|
$search
|
||||||
|
$mathjax
|
||||||
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
|
$extrastylesheet
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 56px;">
|
||||||
|
<!--BEGIN PROJECT_LOGO-->
|
||||||
|
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
|
||||||
|
<!--END PROJECT_LOGO-->
|
||||||
|
<!--BEGIN PROJECT_NAME-->
|
||||||
|
<td id="projectalign" style="padding-left: 0.5em;">
|
||||||
|
<div id="projectname">$projectname
|
||||||
|
<!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
|
||||||
|
</div>
|
||||||
|
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME-->
|
||||||
|
<!--BEGIN PROJECT_BRIEF-->
|
||||||
|
<td style="padding-left: 0.5em;">
|
||||||
|
<div id="projectbrief">$projectbrief</div>
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_BRIEF-->
|
||||||
|
<!--END !PROJECT_NAME-->
|
||||||
|
<!--BEGIN DISABLE_INDEX-->
|
||||||
|
<!--BEGIN SEARCHENGINE-->
|
||||||
|
<td>$searchbox</td>
|
||||||
|
<!--END SEARCHENGINE-->
|
||||||
|
<!--END DISABLE_INDEX-->
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!--END TITLEAREA-->
|
||||||
|
<!-- end header part -->
|
||||||
|
|
||||||
|
|
194
doc/doxygen_layout.xml
Normal file
194
doc/doxygen_layout.xml
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<doxygenlayout version="1.0">
|
||||||
|
<!-- Generated by doxygen 1.8.14 -->
|
||||||
|
<!-- Navigation index tabs for HTML output -->
|
||||||
|
<navindex>
|
||||||
|
<tab type="mainpage" visible="yes" title=""/>
|
||||||
|
<tab type="pages" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="modules" visible="yes" title="C modules" intro=""/>
|
||||||
|
<tab type="namespaces" visible="yes" title="">
|
||||||
|
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="classes" visible="yes" title="">
|
||||||
|
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||||
|
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="files" visible="yes" title="">
|
||||||
|
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="globals" visible="yes" title="" intro=""/>
|
||||||
|
</tab>
|
||||||
|
<tab type="examples" visible="yes" title="" intro=""/>
|
||||||
|
</navindex>
|
||||||
|
|
||||||
|
<!-- Layout definition for a class page -->
|
||||||
|
<class>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||||
|
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||||
|
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestedclasses visible="yes" title=""/>
|
||||||
|
<publictypes title=""/>
|
||||||
|
<services title=""/>
|
||||||
|
<interfaces title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicmethods title=""/>
|
||||||
|
<publicstaticmethods title=""/>
|
||||||
|
<publicattributes title=""/>
|
||||||
|
<publicstaticattributes title=""/>
|
||||||
|
<protectedtypes title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<protectedmethods title=""/>
|
||||||
|
<protectedstaticmethods title=""/>
|
||||||
|
<protectedattributes title=""/>
|
||||||
|
<protectedstaticattributes title=""/>
|
||||||
|
<packagetypes title=""/>
|
||||||
|
<packagemethods title=""/>
|
||||||
|
<packagestaticmethods title=""/>
|
||||||
|
<packageattributes title=""/>
|
||||||
|
<packagestaticattributes title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<privatetypes title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<privatemethods title=""/>
|
||||||
|
<privatestaticmethods title=""/>
|
||||||
|
<privateattributes title=""/>
|
||||||
|
<privatestaticattributes title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
<related title="" subtitle=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<services title=""/>
|
||||||
|
<interfaces title=""/>
|
||||||
|
<constructors title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<related title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<allmemberslink visible="yes"/>
|
||||||
|
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
<!-- Layout definition for a namespace page -->
|
||||||
|
<namespace>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestednamespaces visible="yes" title=""/>
|
||||||
|
<constantgroups visible="yes" title=""/>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</namespace>
|
||||||
|
|
||||||
|
<!-- Layout definition for a file page -->
|
||||||
|
<file>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||||
|
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||||
|
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||||
|
<sourcelink visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<namespaces visible="yes" title=""/>
|
||||||
|
<constantgroups visible="yes" title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedes title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection/>
|
||||||
|
</file>
|
||||||
|
|
||||||
|
<!-- Layout definition for a group page -->
|
||||||
|
<group>
|
||||||
|
<briefdescription visible="no"/>
|
||||||
|
<detaileddescription title="Description"/>
|
||||||
|
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||||
|
<memberdecl>
|
||||||
|
<nestedgroups visible="yes" title=""/>
|
||||||
|
<dirs visible="yes" title=""/>
|
||||||
|
<files visible="yes" title=""/>
|
||||||
|
<namespaces visible="yes" title=""/>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<enumvalues title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<memberdef>
|
||||||
|
<pagedocs/>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<enumvalues title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<signals title=""/>
|
||||||
|
<publicslots title=""/>
|
||||||
|
<protectedslots title=""/>
|
||||||
|
<privateslots title=""/>
|
||||||
|
<events title=""/>
|
||||||
|
<properties title=""/>
|
||||||
|
<friends title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection visible="yes"/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<!-- Layout definition for a directory page -->
|
||||||
|
<directory>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<directorygraph visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<dirs visible="yes"/>
|
||||||
|
<files visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
</directory>
|
||||||
|
</doxygenlayout>
|
34
doc/example_list.h
Normal file
34
doc/example_list.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/// @example ./examples/util/print_key_press.cpp
|
||||||
|
/// @example ./examples/dom/dbox.cpp
|
||||||
|
/// @example ./examples/dom/separator.cpp
|
||||||
|
/// @example ./examples/dom/style_color.cpp
|
||||||
|
/// @example ./examples/dom/paragraph.cpp
|
||||||
|
/// @example ./examples/dom/style_blink.cpp
|
||||||
|
/// @example ./examples/dom/style_dim.cpp
|
||||||
|
/// @example ./examples/dom/style_inverted.cpp
|
||||||
|
/// @example ./examples/dom/graph.cpp
|
||||||
|
/// @example ./examples/dom/package_manager.cpp
|
||||||
|
/// @example ./examples/dom/window.cpp
|
||||||
|
/// @example ./examples/dom/html_like.cpp
|
||||||
|
/// @example ./examples/dom/border.cpp
|
||||||
|
/// @example ./examples/dom/style_underlined.cpp
|
||||||
|
/// @example ./examples/dom/gauge.cpp
|
||||||
|
/// @example ./examples/dom/style_bold.cpp
|
||||||
|
/// @example ./examples/dom/spinner.cpp
|
||||||
|
/// @example ./examples/dom/style_gallery.cpp
|
||||||
|
/// @example ./examples/dom/vbox_hbox.cpp
|
||||||
|
/// @example ./examples/dom/size.cpp
|
||||||
|
/// @example ./examples/dom/hflow.cpp
|
||||||
|
/// @example ./examples/component/tab_vertical.cpp
|
||||||
|
/// @example ./examples/component/gallery.cpp
|
||||||
|
/// @example ./examples/component/checkbox.cpp
|
||||||
|
/// @example ./examples/component/checkbox_in_frame.cpp
|
||||||
|
/// @example ./examples/component/menu2.cpp
|
||||||
|
/// @example ./examples/component/tab_horizontal.cpp
|
||||||
|
/// @example ./examples/component/input.cpp
|
||||||
|
/// @example ./examples/component/homescreen.cpp
|
||||||
|
/// @example ./examples/component/radiobox.cpp
|
||||||
|
/// @example ./examples/component/menu.cpp
|
||||||
|
/// @example ./examples/component/menu_style.cpp
|
||||||
|
/// @example ./examples/component/radiobox_in_frame.cpp
|
||||||
|
/// @example ./examples/component/toggle.cpp
|
@ -1,35 +0,0 @@
|
|||||||
# Examples
|
|
||||||
@example ./examples/util/print_key_press.cpp
|
|
||||||
@example ./examples/dom/dbox.cpp
|
|
||||||
@example ./examples/dom/separator.cpp
|
|
||||||
@example ./examples/dom/style_color.cpp
|
|
||||||
@example ./examples/dom/paragraph.cpp
|
|
||||||
@example ./examples/dom/style_blink.cpp
|
|
||||||
@example ./examples/dom/style_dim.cpp
|
|
||||||
@example ./examples/dom/style_inverted.cpp
|
|
||||||
@example ./examples/dom/graph.cpp
|
|
||||||
@example ./examples/dom/package_manager.cpp
|
|
||||||
@example ./examples/dom/window.cpp
|
|
||||||
@example ./examples/dom/html_like.cpp
|
|
||||||
@example ./examples/dom/border.cpp
|
|
||||||
@example ./examples/dom/style_underlined.cpp
|
|
||||||
@example ./examples/dom/gauge.cpp
|
|
||||||
@example ./examples/dom/style_bold.cpp
|
|
||||||
@example ./examples/dom/spinner.cpp
|
|
||||||
@example ./examples/dom/style_gallery.cpp
|
|
||||||
@example ./examples/dom/vbox_hbox.cpp
|
|
||||||
@example ./examples/dom/size.cpp
|
|
||||||
@example ./examples/dom/hflow.cpp
|
|
||||||
@example ./examples/component/tab_vertical.cpp
|
|
||||||
@example ./examples/component/gallery.cpp
|
|
||||||
@example ./examples/component/checkbox.cpp
|
|
||||||
@example ./examples/component/checkbox_in_frame.cpp
|
|
||||||
@example ./examples/component/menu2.cpp
|
|
||||||
@example ./examples/component/tab_horizontal.cpp
|
|
||||||
@example ./examples/component/input.cpp
|
|
||||||
@example ./examples/component/homescreen.cpp
|
|
||||||
@example ./examples/component/radiobox.cpp
|
|
||||||
@example ./examples/component/menu.cpp
|
|
||||||
@example ./examples/component/menu_style.cpp
|
|
||||||
@example ./examples/component/radiobox_in_frame.cpp
|
|
||||||
@example ./examples/component/toggle.cpp
|
|
BIN
doc/logo.png
BIN
doc/logo.png
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
260
doc/mainpage.md
260
doc/mainpage.md
@ -26,7 +26,10 @@ int main(void) {
|
|||||||
text(L"right") | border,
|
text(L"right") | border,
|
||||||
});
|
});
|
||||||
|
|
||||||
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
auto screen = Screen::Create(
|
||||||
|
Dimension::Full(), // Width
|
||||||
|
Dimension::Fit(document) // Height
|
||||||
|
);
|
||||||
Render(screen, document);
|
Render(screen, document);
|
||||||
std::cout << screen.ToString() << std::endl;
|
std::cout << screen.ToString() << std::endl;
|
||||||
|
|
||||||
@ -42,7 +45,7 @@ int main(void) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
**cmake**
|
**cmake**
|
||||||
```cpp
|
```
|
||||||
cmake_minimum_required (VERSION 3.11)
|
cmake_minimum_required (VERSION 3.11)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
@ -64,20 +67,17 @@ target_link_libraries(main
|
|||||||
set_target_properties(main PROPERTIES CXX_STANDARD 17)
|
set_target_properties(main PROPERTIES CXX_STANDARD 17)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Modules
|
# List of modules.
|
||||||
|
|
||||||
The project is split into 3 modules:
|
The project is split into 3 modules:
|
||||||
1. ftxui/screen
|
|
||||||
2. ftxui/dom
|
|
||||||
3. ftxui/component
|
|
||||||
|
|
||||||
ftxui/screen defines a ftxui::Screen, this is a grid of ftxui::Pixel.
|
1. **ftxui/screen** defines a ftxui::Screen, this is a grid of ftxui::Pixel.
|
||||||
|
|
||||||
ftxui/dom is the main module. It defines a hierarchical set of ftxui::Element.
|
2. **ftxui/dom** is the main module. It defines a hierarchical set of ftxui::Element.
|
||||||
An element draws something on the ftxui::Screen. It is responsive to the size of
|
An element draws something on the ftxui::Screen. It is responsive to the size of
|
||||||
its container.
|
its container.
|
||||||
|
|
||||||
ftxui/component. The part is only needed if you need to respond to the User
|
3. **ftxui/component** The part is only needed if you need to respond to the User
|
||||||
input. It defines a set of ftxui::Component. The use can navigates using the
|
input. It defines a set of ftxui::Component. The use can navigates using the
|
||||||
arrow keys and interact with widgets like checkbox/inputbox/... You can make you
|
arrow keys and interact with widgets like checkbox/inputbox/... You can make you
|
||||||
own components.
|
own components.
|
||||||
@ -85,19 +85,20 @@ own components.
|
|||||||
## screen
|
## screen
|
||||||
|
|
||||||
It defines a ftxui::Screen. This is a grid of ftxui::Pixel. A Pixel represent a
|
It defines a ftxui::Screen. This is a grid of ftxui::Pixel. A Pixel represent a
|
||||||
unicode character and its style. The screen can be printed as a string using ftxui::Screen::ToString().
|
unicode character and its associated style (bold, colors, etc...).
|
||||||
|
The screen can be printed as a string using ftxui::Screen::ToString().
|
||||||
|
|
||||||
Example:
|
|
||||||
~~~cpp
|
~~~cpp
|
||||||
#include <ftxui/screen/screen.hpp>
|
#include <ftxui/screen/screen.hpp>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
auto screen = ftxui::Screen(Dimension::Fixed(32), Dimension::Fixed(10));
|
auto screen = Screen(Dimension::Fixed(32), Dimension::Fixed(10));
|
||||||
|
|
||||||
auto& pixel = screen.PixelAt(10,10);
|
auto& pixel = screen.PixelAt(10,10);
|
||||||
pixel.character = U'A';
|
pixel.character = U'A';
|
||||||
pixel.bold = true;
|
pixel.bold = true;
|
||||||
|
pixel.foreground_color = Color::Blue;
|
||||||
|
|
||||||
std::cout << screen.ToString();
|
std::cout << screen.ToString();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@ -108,11 +109,45 @@ Example:
|
|||||||
|
|
||||||
This module defines a hierachical set of Element. An element manages layout and can be responsive to the terminal dimensions.
|
This module defines a hierachical set of Element. An element manages layout and can be responsive to the terminal dimensions.
|
||||||
|
|
||||||
They are declared in ftxui/dom/elements.hpp>
|
|
||||||
|
**Example:**
|
||||||
|
```cpp
|
||||||
|
// Define the document
|
||||||
|
Element document = vbox({
|
||||||
|
text(L"The window") | bold | color(Color::Blue),
|
||||||
|
gauge(0.5)
|
||||||
|
text(L"The footer")
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a border.
|
||||||
|
document = border(document);
|
||||||
|
```
|
||||||
|
|
||||||
|
**List of elements**
|
||||||
|
|
||||||
|
You only need one header: ftxui/dom/elements.hpp
|
||||||
|
|
||||||
\include ftxui/dom/elements.hpp
|
\include ftxui/dom/elements.hpp
|
||||||
|
|
||||||
### text
|
## component
|
||||||
|
|
||||||
|
Finally, the ftxui/component directory defines the logic to get interactivity.
|
||||||
|
|
||||||
|
Please take a look at ./examples/component
|
||||||
|
|
||||||
|
This provides:
|
||||||
|
1. A main loop.
|
||||||
|
2. Get events and respond to them.
|
||||||
|
3. A predefined implementation of "keyboard navigation".
|
||||||
|
4. A set of predefined widget: CheckBox, RadioBox, Input, Menu, Toggle.
|
||||||
|
|
||||||
|
# ftxui/dom
|
||||||
|
|
||||||
|
Every elements of the dom are declared from:
|
||||||
|
|
||||||
|
\include ftxui/dom/elements.hpp
|
||||||
|
|
||||||
|
## text
|
||||||
|
|
||||||
The most simple widget. It displays a text.
|
The most simple widget. It displays a text.
|
||||||
~~~cpp
|
~~~cpp
|
||||||
@ -124,7 +159,7 @@ text(L"I am a piece of text");
|
|||||||
I am a piece of text.
|
I am a piece of text.
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### border
|
## border
|
||||||
|
|
||||||
Add a border around an element
|
Add a border around an element
|
||||||
~~~cpp
|
~~~cpp
|
||||||
@ -139,7 +174,23 @@ border(text(L"The element"))
|
|||||||
└───────────┘
|
└───────────┘
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### separator
|
## window
|
||||||
|
|
||||||
|
A ftxui::window is a ftxui::border, but with some text on top of the border.
|
||||||
|
Add a border around an element
|
||||||
|
~~~cpp
|
||||||
|
using namespace ftxui;
|
||||||
|
|
||||||
|
window(L"The window", text(L"The element"))
|
||||||
|
~~~
|
||||||
|
|
||||||
|
~~~bash
|
||||||
|
┌The window─┐
|
||||||
|
│The element│
|
||||||
|
└───────────┘
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## separator
|
||||||
|
|
||||||
Display a vertical or horizontal line to visually split the content of a
|
Display a vertical or horizontal line to visually split the content of a
|
||||||
container in two.
|
container in two.
|
||||||
@ -160,7 +211,7 @@ border(
|
|||||||
└────┴─────┘
|
└────┴─────┘
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### gauge
|
## gauge
|
||||||
|
|
||||||
A gauge. It can be used to represent a progress bar.
|
A gauge. It can be used to represent a progress bar.
|
||||||
~~~cpp
|
~~~cpp
|
||||||
@ -173,11 +224,54 @@ border(gauge(0.5))
|
|||||||
└────────────────────────────────────────────────────────────────────────────┘
|
└────────────────────────────────────────────────────────────────────────────┘
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### graph
|
## graph
|
||||||
[![asciicast](https://asciinema.org/a/223726.svg)](https://asciinema.org/a/223726)
|
@htmlonly
|
||||||
|
<script id="asciicast-223726" src="https://asciinema.org/a/223726.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
|
## Colors
|
||||||
|
A terminal console can usually display colored text and colored background.
|
||||||
|
|
||||||
### Style
|
~~~cpp
|
||||||
|
Decorator color(Color);
|
||||||
|
Decorator bgcolor(Color);
|
||||||
|
~~~
|
||||||
|
|
||||||
|
The following colors are available:
|
||||||
|
- Default
|
||||||
|
|
||||||
|
- Black
|
||||||
|
- GrayDark
|
||||||
|
- GrayLight
|
||||||
|
|
||||||
|
- White
|
||||||
|
|
||||||
|
- Blue
|
||||||
|
- BlueLight
|
||||||
|
|
||||||
|
- Cyan
|
||||||
|
- CyanLight
|
||||||
|
|
||||||
|
- Green
|
||||||
|
- GreenLight
|
||||||
|
|
||||||
|
- Magenta
|
||||||
|
- MagentaLight
|
||||||
|
|
||||||
|
- Red
|
||||||
|
- RedLight
|
||||||
|
|
||||||
|
- Yellow
|
||||||
|
- YellowLight
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```cpp
|
||||||
|
text(L"Blue foreground") | color(Color::Blue);
|
||||||
|
text(L"Blue backgrond") | bgcolor(Color::Blue);
|
||||||
|
text(L"Black on white") | color(Color::Black) | bgcolor(Color::White);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Style
|
||||||
A terminal console can usually display colored text and colored background.
|
A terminal console can usually display colored text and colored background.
|
||||||
The text can also have different effects: bold, dim, underlined, inverted,
|
The text can also have different effects: bold, dim, underlined, inverted,
|
||||||
blink.
|
blink.
|
||||||
@ -202,7 +296,7 @@ Tips: The pipe operator can be used to chain Decorator:
|
|||||||
text(L"This text is bold")) | bold | underlined
|
text(L"This text is bold")) | bold | underlined
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### Layout
|
## Layout
|
||||||
|
|
||||||
These layout are similar to the HTML flexbox:
|
These layout are similar to the HTML flexbox:
|
||||||
* vbox (Vertical-box)
|
* vbox (Vertical-box)
|
||||||
@ -246,23 +340,125 @@ An horizontal flow layout is implemented by:
|
|||||||
└────┘└───────────────────────────────────┘└───────────────────────────────────┘
|
└────┘└───────────────────────────────────┘└───────────────────────────────────┘
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## Components.
|
# ftxui/component
|
||||||
|
|
||||||
Element are stateless object. On the other side, components are used when an
|
Element are stateless object. On the other side, components are used when an
|
||||||
internal state is needed. Components are used to interact with the user with
|
internal state is needed. Components are used to interact with the user with
|
||||||
its keyboard. They handle keyboard navigation, including component focus.
|
its keyboard. They handle keyboard navigation, including component focus.
|
||||||
|
|
||||||
### Input
|
## Input
|
||||||
[![asciicast](https://asciinema.org/a/223719.svg)](https://asciinema.org/a/223719)
|
|
||||||
|
|
||||||
### Menu
|
@htmlonly
|
||||||
[![asciicast](https://asciinema.org/a/223720.svg)](https://asciinema.org/a/223720)
|
<script id="asciicast-223719" src="https://asciinema.org/a/223719.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
### Toggle.
|
## Menu
|
||||||
[![asciicast](https://asciinema.org/a/223722.svg)](https://asciinema.org/a/223722)
|
@htmlonly
|
||||||
|
<script id="asciicast-223720" src="https://asciinema.org/a/223720.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
### CheckBox
|
## Toggle.
|
||||||
[![asciicast](https://asciinema.org/a/223724.svg)](https://asciinema.org/a/223724)
|
@htmlonly
|
||||||
|
<script id="asciicast-223722" src="https://asciinema.org/a/223722.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
### RadioBox
|
## CheckBox
|
||||||
[![asciicast](https://asciinema.org/a/223725.svg)](https://asciinema.org/a/223725)
|
@htmlonly
|
||||||
|
<script id="asciicast-223724" src="https://asciinema.org/a/223724.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
|
## RadioBox
|
||||||
|
@htmlonly
|
||||||
|
<script id="asciicast-223725" src="https://asciinema.org/a/223725.js" async></script>
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
|
# Build
|
||||||
|
|
||||||
|
Assuming this example example.cpp file.
|
||||||
|
|
||||||
|
**main.cpp**
|
||||||
|
~~~cpp
|
||||||
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
#include "ftxui/dom/elements.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[]) {
|
||||||
|
using namespace ftxui;
|
||||||
|
auto document =
|
||||||
|
hbox({
|
||||||
|
text(L"left") | bold | border,
|
||||||
|
text(L"middle") | flex | border,
|
||||||
|
text(L"right") | border,
|
||||||
|
});
|
||||||
|
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
|
||||||
|
Render(screen, document);
|
||||||
|
|
||||||
|
std::cout << screen.ToString();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## Using CMake
|
||||||
|
|
||||||
|
CMakeLists.txt
|
||||||
|
~~~cmake
|
||||||
|
cmake_minimum_required (VERSION 3.11)
|
||||||
|
|
||||||
|
# --- Fetch FTXUI --------------------------------------------------------------
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
|
||||||
|
FetchContent_Declare(ftxui
|
||||||
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||||
|
# Specify a GIT TAG here.
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(ftxui)
|
||||||
|
if(NOT ftxui_POPULATED)
|
||||||
|
FetchContent_Populate(ftxui)
|
||||||
|
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
project(ftxui-starter
|
||||||
|
LANGUAGES CXX
|
||||||
|
VERSION 1.0.0
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(ftxui-starter src/main.cpp)
|
||||||
|
target_include_directories(ftxui-starter PRIVATE src)
|
||||||
|
|
||||||
|
target_link_libraries(ftxui-starter
|
||||||
|
PRIVATE ftxui::screen
|
||||||
|
PRIVATE ftxui::dom
|
||||||
|
PRIVATE ftxui::component # Not needed for this example.
|
||||||
|
)
|
||||||
|
|
||||||
|
# C++17 is used. We requires fold expressions at least.
|
||||||
|
set_target_properties(ftxui-starter PROPERTIES CXX_STANDARD 17)
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Build
|
||||||
|
~~~
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
./main
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## Using NXXM
|
||||||
|
|
||||||
|
**.nxxm/deps**
|
||||||
|
~~~json
|
||||||
|
{
|
||||||
|
"ArthurSonzogni/FTXUI": {}
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Build:
|
||||||
|
~~~
|
||||||
|
nxxm . -t clang-cxx17
|
||||||
|
~~~
|
||||||
|
289
doc/tutorial.md
289
doc/tutorial.md
@ -1,289 +0,0 @@
|
|||||||
## Introduction
|
|
||||||
|
|
||||||
The library is split in 3 parts:
|
|
||||||
|
|
||||||
1. ftxui/screen/
|
|
||||||
2. ftxui/dom/
|
|
||||||
3. ftxui/component/
|
|
||||||
|
|
||||||
# ftxui/screen/
|
|
||||||
|
|
||||||
It defines a ftxui::Screen. This is a grid of ftxui::Pixel. A Pixel represent a
|
|
||||||
unicode character and its style. The screen can be printed as a string using ftxui::Screen::ToString().
|
|
||||||
|
|
||||||
Example:
|
|
||||||
~~~cpp
|
|
||||||
#include <ftxui/screen/screen.hpp>
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
using namespace ftxui;
|
|
||||||
auto screen = ftxui::Screen(Dimension::Fixed(32), Dimension::Fixed(10));
|
|
||||||
|
|
||||||
auto& pixel = screen.PixelAt(10,10);
|
|
||||||
pixel.character = U'A';
|
|
||||||
pixel.bold = true;
|
|
||||||
|
|
||||||
std::cout << screen.ToString();
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
~~~
|
|
||||||
|
|
||||||
|
|
||||||
2. [ftuix/dom/](../include/ftxui/dom/)
|
|
||||||
These are a set of hierachical ftxui::Element declared in
|
|
||||||
[ftxui/dom/elements.hpp](../ftxui/dom/elements.hpp). An element can render
|
|
||||||
itself on the the Screen. It manage layout and is responsive to the Screen
|
|
||||||
dimensions.
|
|
||||||
|
|
||||||
3. [ftuix/component/](../include/ftxui/component)
|
|
||||||
The part is only needed if you need to respond to the User input. It defines a
|
|
||||||
set of ftxui::Component. The use can navigates using the arrow keys and
|
|
||||||
interact with widgets like checkbox/inputbox/... You can make you own
|
|
||||||
components.
|
|
||||||
|
|
||||||
~~~cpp
|
|
||||||
using namespace ftxui;
|
|
||||||
|
|
||||||
auto document = text(L"Hello world");
|
|
||||||
|
|
||||||
auto screen = Screen::Create(Dimension::Fit(document));
|
|
||||||
Render(screen, document);
|
|
||||||
|
|
||||||
std::cout << screen.ToString();
|
|
||||||
~~~
|
|
||||||
|
|
||||||
|
|
||||||
I recommand not to take too much time reading the tutorial. Instead,
|
|
||||||
you should try to read the examples (in [../examples/](../examples)).
|
|
||||||
|
|
||||||
## DOM
|
|
||||||
All the dom element are declared in one header:
|
|
||||||
|
|
||||||
\include ./ftxui/dom/elements.hpp
|
|
||||||
|
|
||||||
It declares the following set of elements:
|
|
||||||
|
|
||||||
~~~cpp
|
|
||||||
// --- Widget ---
|
|
||||||
Element text(std::wstring text);
|
|
||||||
Element separator();
|
|
||||||
Element separator(Pixel);
|
|
||||||
Element gauge(float ratio);
|
|
||||||
Element border(Element);
|
|
||||||
Decorator borderWith(Pixel);
|
|
||||||
Element window(Element title, Element content);
|
|
||||||
Element spinner(int charset_index, size_t image_index);
|
|
||||||
Elements paragraph(std::wstring text); // Use inside hflow(). Split by space.
|
|
||||||
Element graph(GraphFunction);
|
|
||||||
|
|
||||||
// -- Decorator ---
|
|
||||||
Element bold(Element);
|
|
||||||
Element dim(Element);
|
|
||||||
Element inverted(Element);
|
|
||||||
Element underlined(Element);
|
|
||||||
Element blink(Element);
|
|
||||||
Decorator color(Color);
|
|
||||||
Decorator bgcolor(Color);
|
|
||||||
Element color(Color, Element);
|
|
||||||
Element bgcolor(Color, Element);
|
|
||||||
|
|
||||||
// --- Layout ---
|
|
||||||
// Horizontal, Vertical or stacked set of elements.
|
|
||||||
Element hbox(Elements);
|
|
||||||
Element vbox(Elements);
|
|
||||||
Element dbox(Elements);
|
|
||||||
Element hflow(Elements);
|
|
||||||
|
|
||||||
// -- Flexibility ---
|
|
||||||
// Define how to share the remaining space when not all of it is used inside a
|
|
||||||
// container.
|
|
||||||
Element filler();
|
|
||||||
Element flex(Element);
|
|
||||||
Element notflex(Element);
|
|
||||||
|
|
||||||
// -- Size override;
|
|
||||||
enum Direction { WIDTH, HEIGHT };
|
|
||||||
enum Constraint { LESS_THAN, EQUAL, GREATER_THAN };
|
|
||||||
Decorator size(Direction, Constraint, int value);
|
|
||||||
|
|
||||||
// --- Frame ---
|
|
||||||
// A frame is a scrollable area. The internal area is potentially larger than
|
|
||||||
// the external one. The internal area is scrolled in order to make visible the
|
|
||||||
// focused element.
|
|
||||||
Element frame(Element);
|
|
||||||
Element focus(Element);
|
|
||||||
Element select(Element);
|
|
||||||
|
|
||||||
// --- Util --------------------------------------------------------------------
|
|
||||||
Element hcenter(Element);
|
|
||||||
Element vcenter(Element);
|
|
||||||
Element center(Element);
|
|
||||||
Element align_right(Element);
|
|
||||||
Element nothing(Element element);
|
|
||||||
~~~
|
|
||||||
|
|
||||||
### Widget.
|
|
||||||
|
|
||||||
#### text
|
|
||||||
|
|
||||||
The most simple widget. It displays a text.
|
|
||||||
~~~cpp
|
|
||||||
using namespace ftxui;
|
|
||||||
|
|
||||||
text(L"I am a piece of text");
|
|
||||||
~~~
|
|
||||||
~~~bash
|
|
||||||
I am a piece of text.
|
|
||||||
~~~
|
|
||||||
|
|
||||||
#### border
|
|
||||||
Add a border around an element
|
|
||||||
~~~cpp
|
|
||||||
using namespace ftxui;
|
|
||||||
|
|
||||||
border(text(L"The element"))
|
|
||||||
~~~
|
|
||||||
|
|
||||||
~~~bash
|
|
||||||
┌───────────┐
|
|
||||||
│The element│
|
|
||||||
└───────────┘
|
|
||||||
~~~
|
|
||||||
|
|
||||||
#### separator
|
|
||||||
|
|
||||||
Display a vertical or horizontal line to visually split the content of a
|
|
||||||
container in two.
|
|
||||||
|
|
||||||
~~~cpp
|
|
||||||
border(
|
|
||||||
hbox({
|
|
||||||
vbox({
|
|
||||||
text(L"left top"),
|
|
||||||
text(L"left bottom"),
|
|
||||||
}),
|
|
||||||
separator(),
|
|
||||||
vbox({
|
|
||||||
text(L"right top"),
|
|
||||||
text(L"right bottom"),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
~~~
|
|
||||||
|
|
||||||
~~~bash
|
|
||||||
┌───────────┬────────────┐
|
|
||||||
│left top │right top │
|
|
||||||
│left bottom│right bottom│
|
|
||||||
└───────────┴────────────┘
|
|
||||||
~~~
|
|
||||||
|
|
||||||
#### gauge
|
|
||||||
|
|
||||||
A gauge. It can be used to represent a progress bar.
|
|
||||||
~~~cpp
|
|
||||||
border(gauge(0.5))
|
|
||||||
~~~
|
|
||||||
|
|
||||||
~~~bash
|
|
||||||
┌────────────────────────────────────────────────────────────────────────────┐
|
|
||||||
│██████████████████████████████████████ │
|
|
||||||
└────────────────────────────────────────────────────────────────────────────┘
|
|
||||||
~~~
|
|
||||||
|
|
||||||
#### graph
|
|
||||||
[![asciicast](https://asciinema.org/a/223726.svg)](https://asciinema.org/a/223726)
|
|
||||||
|
|
||||||
|
|
||||||
### Style
|
|
||||||
A terminal console can usually display colored text and colored background.
|
|
||||||
The text can also have different effects: bold, dim, underlined, inverted,
|
|
||||||
blink.
|
|
||||||
|
|
||||||
~~~cpp
|
|
||||||
Element bold(Element);
|
|
||||||
Element dim(Element);
|
|
||||||
Element inverted(Element);
|
|
||||||
Element underlined(Element);
|
|
||||||
Element blink(Element);
|
|
||||||
Decorator color(Color);
|
|
||||||
Decorator bgcolor(Color);
|
|
||||||
~~~
|
|
||||||
|
|
||||||
Example:
|
|
||||||
~~~cpp
|
|
||||||
underlined(bold(text(L"This text is bold and underlined")))
|
|
||||||
~~~
|
|
||||||
|
|
||||||
Tips: The pipe operator can be used to chain Decorator:
|
|
||||||
~~~cpp
|
|
||||||
text(L"This text is bold")) | bold | underlined
|
|
||||||
~~~
|
|
||||||
|
|
||||||
### Layout
|
|
||||||
|
|
||||||
These layout are similar to the HTML flexbox:
|
|
||||||
* vbox (Vertical-box)
|
|
||||||
* hbox (Horizontal-box)
|
|
||||||
* dbox (Z-axis-box)
|
|
||||||
They are used to compose all the elements together. Each
|
|
||||||
children are put side by side. If the container is flexible, the extra space
|
|
||||||
available will be shared among the remaining flexible children.
|
|
||||||
|
|
||||||
flex(element) can be used to make a non-flexible element flexible. filler() is a
|
|
||||||
flexible empty element. You can use it align children on one side of the
|
|
||||||
container.
|
|
||||||
|
|
||||||
An horizontal flow layout is implemented by:
|
|
||||||
* hflow (Horizontal flow)
|
|
||||||
|
|
||||||
#### Examples
|
|
||||||
~~~cpp
|
|
||||||
hbox({
|
|
||||||
text(L"left") | border ,
|
|
||||||
text(L"middle") | border | flex,
|
|
||||||
text(L"right") | border,
|
|
||||||
});
|
|
||||||
~~~
|
|
||||||
~~~bash
|
|
||||||
┌────┐┌─────────────────────────────────────────────────────────────────┐┌─────┐
|
|
||||||
│left││middle ││right│
|
|
||||||
└────┘└─────────────────────────────────────────────────────────────────┘└─────┘
|
|
||||||
~~~
|
|
||||||
|
|
||||||
~~~cpp
|
|
||||||
hbox({
|
|
||||||
text(L"left") | border ,
|
|
||||||
text(L"middle") | border | flex,
|
|
||||||
text(L"right") | border | flex,
|
|
||||||
});
|
|
||||||
~~~
|
|
||||||
~~~bash
|
|
||||||
┌────┐┌───────────────────────────────────┐┌───────────────────────────────────┐
|
|
||||||
│left││middle ││right │
|
|
||||||
└────┘└───────────────────────────────────┘└───────────────────────────────────┘
|
|
||||||
~~~
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Components.
|
|
||||||
|
|
||||||
Element are stateless object. On the other side, components are used when an
|
|
||||||
internal state is needed. Components are used to interact with the user with
|
|
||||||
its keyboard. They handle keyboard navigation, including component focus.
|
|
||||||
|
|
||||||
### Input
|
|
||||||
[![asciicast](https://asciinema.org/a/223719.svg)](https://asciinema.org/a/223719)
|
|
||||||
![asciicast](https://asciinema.org/a/223719.svg)
|
|
||||||
|
|
||||||
### Menu
|
|
||||||
[![asciicast](https://asciinema.org/a/223720.svg)](https://asciinema.org/a/223720)
|
|
||||||
|
|
||||||
### Toggle.
|
|
||||||
[![asciicast](https://asciinema.org/a/223722.svg)](https://asciinema.org/a/223722)
|
|
||||||
|
|
||||||
### CheckBox
|
|
||||||
[![asciicast](https://asciinema.org/a/223724.svg)](https://asciinema.org/a/223724)
|
|
||||||
|
|
||||||
### RadioBox
|
|
||||||
[![asciicast](https://asciinema.org/a/223725.svg)](https://asciinema.org/a/223725)
|
|
@ -1,30 +0,0 @@
|
|||||||
# Level of abstractions:
|
|
||||||
* Level 0: terminal output.
|
|
||||||
* Level 1: ftxui::Screen
|
|
||||||
* Level 2: ftxui::Node
|
|
||||||
* Level 3: ftxui::Component
|
|
||||||
|
|
||||||
## Level 0: terminal output.
|
|
||||||
This is std::cout. You can send text to it.
|
|
||||||
|
|
||||||
## Level 1: ftxui::Screen
|
|
||||||
A rectangular grid of characters.
|
|
||||||
Use Terminal::ToString() to append its content to the console (level 0).
|
|
||||||
|
|
||||||
## Level 2: ftxui::Node
|
|
||||||
A hierarchial set of element.
|
|
||||||
They handle layout and render themself on the screen (level 1)
|
|
||||||
See [elements.hpp](./dom/elements.hpp)
|
|
||||||
|
|
||||||
You can make implement your own.
|
|
||||||
|
|
||||||
## Level 3: ftxui::Component
|
|
||||||
A hierarchical set of components.
|
|
||||||
Components store some state and react to events:
|
|
||||||
* keyboard
|
|
||||||
* mouse
|
|
||||||
* terminal event
|
|
||||||
|
|
||||||
Components renders themself by producing ftxui::Node (Level 2)
|
|
||||||
|
|
||||||
Implement your own!
|
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace ftxui {
|
||||||
std::string to_string(const std::wstring& s);
|
std::string to_string(const std::wstring& s);
|
||||||
std::wstring to_wstring(const std::string& s);
|
std::wstring to_wstring(const std::string& s);
|
||||||
|
|
||||||
@ -19,5 +20,6 @@ int wchar_width(wchar_t);
|
|||||||
int wchar_width_cjk(wchar_t);
|
int wchar_width_cjk(wchar_t);
|
||||||
int wstring_width(const std::wstring&);
|
int wstring_width(const std::wstring&);
|
||||||
int wstring_width_cjk(const std::wstring&);
|
int wstring_width_cjk(const std::wstring&);
|
||||||
|
} // namespace ftxui
|
||||||
|
|
||||||
#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */
|
#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */
|
||||||
|
@ -10,35 +10,7 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
// static
|
namespace {
|
||||||
Event Event::Character(const std::string& input) {
|
|
||||||
Event event;
|
|
||||||
event.input_ = input;
|
|
||||||
event.is_character_ = true;
|
|
||||||
event.character_ = to_wstring(input)[0];
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
Event Event::Character(char c) {
|
|
||||||
return Character(wchar_t(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
Event Event::Character(wchar_t c) {
|
|
||||||
Event event;
|
|
||||||
event.input_ = {(char)c};
|
|
||||||
event.is_character_ = true;
|
|
||||||
event.character_ = c;
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
Event Event::Special(const std::string& input) {
|
|
||||||
Event event;
|
|
||||||
event.input_ = std::move(input);
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ParseUTF8(Receiver<char>& in, Sender<Event>& out, std::string& input) {
|
void ParseUTF8(Receiver<char>& in, Sender<Event>& out, std::string& input) {
|
||||||
char c;
|
char c;
|
||||||
@ -131,6 +103,38 @@ void ParseESC(Receiver<char>& in, Sender<Event>& out, std::string& input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
// static
|
||||||
|
Event Event::Character(const std::string& input) {
|
||||||
|
Event event;
|
||||||
|
event.input_ = input;
|
||||||
|
event.is_character_ = true;
|
||||||
|
event.character_ = to_wstring(input)[0];
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
Event Event::Character(char c) {
|
||||||
|
return Character(wchar_t(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
Event Event::Character(wchar_t c) {
|
||||||
|
Event event;
|
||||||
|
event.input_ = {(char)c};
|
||||||
|
event.is_character_ = true;
|
||||||
|
event.character_ = c;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
Event Event::Special(const std::string& input) {
|
||||||
|
Event event;
|
||||||
|
event.input_ = std::move(input);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void Event::Convert(Receiver<char>& in, Sender<Event>& out, char c) {
|
void Event::Convert(Receiver<char>& in, Sender<Event>& out, char c) {
|
||||||
std::string input;
|
std::string input;
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include "ftxui/component/screen_interactive.hpp"
|
#include "ftxui/component/screen_interactive.hpp"
|
||||||
|
|
||||||
#define DEFINE_CONSOLEV2_PROPERTIES
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -20,6 +18,7 @@
|
|||||||
#include "ftxui/screen/terminal.hpp"
|
#include "ftxui/screen/terminal.hpp"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
#define DEFINE_CONSOLEV2_PROPERTIES
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
@ -40,6 +39,7 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
namespace {
|
||||||
// Produce a stream of Event from a stream of char.
|
// Produce a stream of Event from a stream of char.
|
||||||
void CharToEventStream(Receiver<char> receiver, Sender<Event> sender) {
|
void CharToEventStream(Receiver<char> receiver, Sender<Event> sender) {
|
||||||
char c;
|
char c;
|
||||||
@ -154,6 +154,8 @@ void OnResize(int /* signal */) {
|
|||||||
on_resize();
|
on_resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
ScreenInteractive::ScreenInteractive(int dimx,
|
ScreenInteractive::ScreenInteractive(int dimx,
|
||||||
int dimy,
|
int dimy,
|
||||||
Dimension dimension,
|
Dimension dimension,
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
using FlexFunction = void (*)(Requirement&);
|
using FlexFunction = void (*)(Requirement&);
|
||||||
|
|
||||||
void function_flex_grow(Requirement& r) {
|
void function_flex_grow(Requirement& r) {
|
||||||
@ -59,6 +61,8 @@ void function_not_flex(Requirement& r) {
|
|||||||
r.flex_shrink_y = 0;
|
r.flex_shrink_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
class Flex : public Node {
|
class Flex : public Node {
|
||||||
public:
|
public:
|
||||||
Flex(FlexFunction f) { f_ = f; }
|
Flex(FlexFunction f) { f_ = f; }
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
|
namespace ftxui {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
||||||
@ -24,4 +25,6 @@ std::wstring to_wstring(const std::string& s) {
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // namespace ftxui
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
|
|
||||||
#include "ftxui/screen/string.hpp"
|
#include "ftxui/screen/string.hpp"
|
||||||
|
|
||||||
|
namespace ftxui {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct interval {
|
struct interval {
|
||||||
int first;
|
int first;
|
||||||
@ -303,3 +305,5 @@ int wstring_width_cjk(const std::wstring& text) {
|
|||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace ftxui
|
||||||
|
Loading…
Reference in New Issue
Block a user