Commit Graph

158 Commits

Author SHA1 Message Date
Arthur Sonzogni
b99106a7c9
Add MenuEntry. (#199)
This will address comments from:
https://github.com/ArthurSonzogni/FTXUI/issues/194
2021-09-04 18:43:56 +02:00
Arthur Sonzogni
2ccc599db9
Support reentrant screen. (#196) 2021-09-01 17:47:48 +02:00
Arthur Sonzogni
51850f1189
Introduce gridbox. (#190)
Introduce gridbox.
Similar to hbox and vbox, this component combine both into a grid.
2021-08-22 19:36:11 +02:00
Arthur Sonzogni
9a54528bca
Update examples to use std::string. (#182)
In examples and tests, use std::string.

In addtion:
1. Address follow-up from:
https://github.com/ArthurSonzogni/FTXUI/pull/179
2. Fix a bug when Input is used with std::string.
2021-08-09 00:27:37 +02:00
Arthur Sonzogni
3b4ab618a3
Prefer std::string over std::wstring. (#179)
In the past, FTXUI switched from std::string to std::wstring to support
fullwidth characters. The reasons was that fullwidth characters can be
stored inside a single wchar_t.

Then FTXUI added support for combining characters. A single glygh
doesn't even fit a wchar_t. Instead, a glyph can be arbitrary large.

The usage of wstring doesn't really fit the new model and have several
drawbacks:
1. It doesn't simplify the implementation of FTXUI, because of combining
   characters.
2. It reduces drawing performance by 2x.
3. It increase Screen's memory allocation by 2x.

This patch converts FTXUI to use std::string internally. It now exposes
std::string based API. The std::wstring API remains, but is now
deprecated.

Tests and examples haven't been update to show the breakage is limited.
They will be updated in a second set of patches.

Bug: https://github.com/ArthurSonzogni/FTXUI/issues/153
Co-authored-by: Tushar Maheshwari <tushar27192@gmail.com>
2021-08-08 23:25:20 +02:00
Arthur Sonzogni
3f005d7715
Add focusable Renderer. (#173) 2021-08-06 20:32:33 +02:00
Tushar Maheshwari
34d955e9ac
Refactor examples list in CMake (#170)
* Reduce example list duplication

* Add COEP and COOP headers in local HTTP server

* Revert Examples URL in readme
2021-07-31 18:32:48 +02:00
Tushar Maheshwari
a40a54ec10
Improve documentation workflow (#163)
* Compact project relative paths from doc directory

* Remove committed example_list.md

- generate example_list from cmake for documentation

* Fix doxygen same-line comments

* Add workflow for generating documentation
2021-07-23 08:40:47 +02:00
Tushar Maheshwari
09805e5e86
Miscellaneous refactoring (#160)
* Reorganize ContainerBase

- Reduce Container overloads using default arguments
- Extract member function pointers to virtual functions
- Separate classes for Vertical, Horizontal and Tab containers

* Collect unpack from NodeDecorator subclasses

* Reduce redundant expansion for aliases
2021-07-20 09:59:47 +02:00
Arthur Sonzogni
b3a333b417
Add support for password for input element. (#158)
This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/139

CC:@Creapermann
2021-07-17 10:36:50 +02:00
Tushar Maheshwari
5ee4ec40de
Update CMake usage to enable C++17 (#156)
The target_compile_features command allows setting PUBLIC compile features for the library, making it implicit for the applications linking it. This reduces the CMake boilerplate required to set up a dependent project (eg. ftxui-starter).
2021-07-17 09:16:02 +02:00
cmorganBE
23789c2d7b
Component example showing composition of components (#150)
This approach can allow for UI sections that are more modular and reusable
2021-07-14 15:04:12 +02:00
Arthur Sonzogni
9b7ddb1130
Resolve compile error on cygwin. (#151)
This should solve issue:
https://github.com/ArthurSonzogni/FTXUI/issues/149
2021-07-14 14:41:31 +02:00
ArthurSonzogni
9820832fea Improve the documentation. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
5c4cd1add1 Execute IWYU 2021-07-11 12:23:42 +02:00
ArthurSonzogni
d5cb4648d2 Remove menu.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
26db8228f9 Remove input.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
7ee6edfd1f Remove checkbox.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
f53dc139e9 Add documentation for options. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
33b3d1c7ab Add option for input. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
359100ca73 Add option for Button. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
cd84b187b3 Introduce Options and use them for Menu.
Introduce Options for components. This allows me to add new features,
without updating functions signatures.
2021-07-11 12:23:42 +02:00
Shreyas Atre
bd21cac2b6
Menu of components (#131)
Allow Container::Vertical and Container::Horizontal to have an
external selector, similar to Container::Tab.

This is useful for implementing a menu of menu.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-06-27 17:53:17 +02:00
Arthur Sonzogni
2ea480f4f6
Update example homescreen. Wait for the thread to join. (#129) 2021-06-26 01:37:18 +02:00
ArthurSonzogni
20a05e99ca Execute IWYU and format. 2021-06-21 23:10:51 +02:00
Nathan Lanza
e9eab32b2f Fix compiler output argument in homescreen 2021-06-07 10:11:32 +02:00
ArthurSonzogni
2504a24ee0 Add documentation for ResizableSplit 2021-05-28 15:07:08 +02:00
ArthurSonzogni
bba2abbb60 Introduce ResizableSplit 2021-05-28 15:07:08 +02:00
Arthur Sonzogni
aacb677e84
Introduce CatchEvent (#104) 2021-05-23 12:53:20 +02:00
Arthur Sonzogni
84debba10c
Fix button example. (#102) 2021-05-18 17:53:58 +02:00
Arthur Sonzogni
7b88656e25
Add option to have button without border. (#101) 2021-05-18 17:49:53 +02:00
Arthur Sonzogni
7daeac25c0
Modify signature of Container::Tab(...) (#92)
Take selector at the end to get more pleasing results with clang-format.
2021-05-15 02:32:42 +02:00
ArthurSonzogni
fcc49fdce7
Format using iwyu. 2021-05-15 00:19:19 +02:00
ArthurSonzogni
048efb6912
Add {Const,}StringRef to simplify components. 2021-05-14 21:47:51 +02:00
ArthurSonzogni
58287c147a
Update every component examples.
Use the functional style instead of classes.
2021-05-14 00:45:03 +02:00
ArthurSonzogni
c9aa1805eb
Add the Renderer component. 2021-05-13 11:44:47 +02:00
ArthurSonzogni
6d75cb2748
Make component more functionnal 2021-05-09 22:35:34 +02:00
ArthurSonzogni
be219633e3
Merge remote-tracking branch 'origin' into feature/mouse-support 2021-05-01 23:45:13 +02:00
ArthurSonzogni
155758c073
Use IWYU. 2021-05-01 23:19:07 +02:00
ArthurSonzogni
eb399d20c5
Capture mouse for the slider component. 2021-05-01 18:13:56 +02:00
ArthurSonzogni
0af8201023
Add the slider component. 2021-04-29 00:18:58 +02:00
ArthurSonzogni
a27c878a3f
Mouse support. Fix & verify Webassembly support.
There was some undefined behavior to be fixed in the terminal input
parser.

The behavior of flush seems to have change. The fix was to invert '\0'
and std::flush.
2021-04-25 16:58:16 +02:00
ArthurSonzogni
0b9b6c692a
Improve mouse support 2021-04-25 15:22:38 +02:00
ArthurSonzogni
8037a5fa5f
Improve mouse support for menu and toggle. 2021-04-24 18:16:13 +02:00
ArthurSonzogni
d685a8655e
Parse mouse middle 2021-04-18 18:42:42 +02:00
ArthurSonzogni
cbd13499ae
Parse mouse events. 2021-04-18 18:32:38 +02:00
Arthur Sonzogni
373b016ca9
Add webassembly support (#79) 2021-03-22 00:26:52 +01:00
ArthurSonzogni
cac94439ff
Add webassembly support 2021-03-21 23:30:46 +01:00
Arthur Sonzogni
406355df8c
Fix parsing of keys that are prefix of others. (#58)
The ESC key generates sequences that are prefix of others. For instance:
- ESC => [27]
- F1 =>  [27, 79, 8]

As a result, we can't generate the ESC event when receiving [27],
because it might be the start of the [27, 79, 8] sequence (or not).

Application usually applies a timeout to help detecting the ESC key.
This patch introduce a timeout. It is set to 50ms.

Bug: https://github.com/ArthurSonzogni/FTXUI/issues/55
2020-10-25 01:57:56 +02:00
Arthur Sonzogni
d969c74341
Improve color handling. (#49) 2020-10-16 22:31:24 +02:00
ArthurSonzogni
5291f660ca Automatically fix style. 2020-09-07 11:25:50 +02:00
ArthurSonzogni
d09996a6c7 Add more example for colors. 2020-09-07 11:25:50 +02:00
Damien D
dc8c090753 Add support for full RGB colors.
FTXUI supported only the 16 colors palette.
This patch adds support for the 256 palette and the TrueColor(8×8×8)
mode.

This was made by kerdelos@ and fixes issue:
https://github.com/ArthurSonzogni/FTXUI/issues/45

Co-authored-by: Damien D <kerdelos@gmail.com>
Co-authored-by: Arthur Sonzogni <sonzogniarthur@gmail.com>
2020-09-07 11:25:50 +02:00
ArthurSonzogni
4ad4946de3 Add the modal dialog example.
New component: clear_under.
2020-08-28 23:54:25 +02:00
ArthurSonzogni
5a8ed208da Add the Button component. 2020-08-28 23:54:25 +02:00
ArthurSonzogni
75c424cea9 Update document WIP. 2020-08-09 10:49:06 +02:00
ArthurSonzogni
e3ca437a48 Introduce xflex and yflex. 2020-07-21 01:22:42 +02:00
ArthurSonzogni
08ee49f3e6 Add flex_grow and flex_shrink.
Two new elements:
- flex_grow  : Expand the element to occupy free space.
- flex_shrink: Minimize the element leave away missing space.

flex = flex_grow | flex_shrink.

Other changes:
- hbox and vbox are now non flexible by default.
- the vtext element has been added to help writting tests.
- Many new tests.
2020-06-07 02:30:45 +02:00
ArthurSonzogni
e34f051f7a Simplify the Render(screen, document) function. 2020-05-20 21:23:59 +02:00
ArthurSonzogni
957387adaa Format. 2020-05-20 20:51:20 +02:00
ArthurSonzogni
985cb35ffb Improve the utility print_key_press 2020-05-20 20:51:20 +02:00
ArthurSonzogni
e1a71d5b9f Use shared_ptr instead of unique_ptr for elements.
This allow users to pass it into initializer list. Then clang-format
will produce 'acceptable' indentations.

This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/18
2020-05-20 20:51:20 +02:00
ArthurSonzogni
f506be941d Add automatic formatting and license. 2020-04-19 21:01:09 +02:00
ArthurSonzogni
fce29a03b3 Run clang-format. 2020-03-27 01:42:46 +01:00
Mikael Olenfalk
f3cef48328 Fix more narrow conversion warnings 2020-03-23 21:32:12 +01:00
Mikael Olenfalk
c4f87a40b7 Fix narrow cast warnings 2020-03-23 21:27:16 +01:00
ArthurSonzogni
a402cb4fbb Fix format. Try compile on Windows. 2020-03-22 22:32:44 +01:00
ArthurSonzogni
4ff45ee540 Add travis configuration. 2020-03-22 21:33:41 +01:00
ArthurSonzogni
a8fdfafe6a Support the -pedantic flag. 2020-02-11 21:44:55 +01:00
ArthurSonzogni
e1efcf2d97 Make DEL to be a special character. 2019-07-02 23:09:20 +02:00
ArthurSonzogni
9c1913de51 Fix xterm parsing. unsigned vs signed char problem. 2019-06-23 17:59:34 +02:00
ArthurSonzogni
001a0ae925 Add UTF8 support and a better xterm parsing.
This fixes: https://github.com/ArthurSonzogni/FTXUI/issues/2
2019-06-23 17:52:31 +02:00
ArthurSonzogni
620f70c3e5 Fix example/component/ CMakeLists.txt 2019-02-02 17:19:33 +01:00
ArthurSonzogni
15da9cdc18 Improve ScreenInteractive wait function. 2019-02-02 16:59:08 +01:00
ArthurSonzogni
77ecfb22f7 disable examples/html/test.html 2019-02-02 11:38:40 +01:00
ArthurSonzogni
ef0de8d873 Add support for nxxm.
[nxxm](https://nxxm.github.io)
2019-02-02 02:25:06 +01:00
ArthurSonzogni
65adb42124 Add Demo GIF. 2019-01-27 16:23:12 +01:00
ArthurSonzogni
eacb634a9e Add example homepage.cpp 2019-01-27 02:33:06 +01:00
ArthurSonzogni
9117166541 Add Graph. 2019-01-26 21:52:55 +01:00
Arthur Sonzogni
1e92db7ec0 Add html_like example. Improve take_any_args. 2019-01-23 02:16:00 +01:00
Arthur Sonzogni
ce7867ab03 Add paragraph and fix hflow 2019-01-23 00:34:37 +01:00
Arthur Sonzogni
610b86183b Add hflow. 2019-01-22 23:42:57 +01:00
Arthur Sonzogni
456ede70fd Add size(direction, constraint, value).
For example:
============

element
  | size(WIDTH, EQUAL 10);

element
  | size(HEIGHT, GREATER_THAN, 10);

element
  | size(WIDTH, EQUAL, 10)
  | size(HEIGHT, EQUAL, 10)
2019-01-20 23:04:10 +01:00
Arthur Sonzogni
fddcbdea65 Add "frame" : scrollable area. 2019-01-19 22:06:05 +01:00
Arthur Sonzogni
cb4df0b56f Renames examples for style. 2019-01-19 02:24:05 +01:00
Arthur Sonzogni
5840966049 Update tutorial.md 2019-01-19 00:20:29 +01:00
Arthur Sonzogni
da5b4b5014 Update example/component/gallery.cpp 2019-01-18 22:58:32 +01:00
Arthur Sonzogni
01827ea8ce Add RadioBox. 2019-01-18 22:41:33 +01:00
Arthur Sonzogni
a6040bc360 Add CheckBox. 2019-01-12 22:25:49 +01:00
Arthur Sonzogni
dba019139b Refactor component containers. 2019-01-12 18:24:46 +01:00
Arthur Sonzogni
21644eea6b Flatten the namespaces.
Remove:
* ftxui::screen
* ftxui::dom
* ftxui::component

Keep:
* ftxui
2019-01-12 15:00:08 +01:00
Arthur Sonzogni
acc7012f58 Add spinner. 2019-01-06 22:28:15 +01:00
Arthur Sonzogni
ccb437f4da Add size(width, height) decorator. 2019-01-06 19:17:27 +01:00
Arthur Sonzogni
7efe8a6385 Separator ftxui::{screen,dom,component} into separate build unit. 2019-01-06 18:53:02 +01:00
Arthur Sonzogni
5887114793 Refactor directory structure.
The goal is to increase the separation in between:

 * ftxui::screen
 * ftxui::dom
 * ftxui::component
2019-01-06 17:10:35 +01:00
Arthur Sonzogni
805c9061e5 Clean source code. Add to_wstring<T> T={int, float, double, ...} 2019-01-06 16:10:57 +01:00
Arthur Sonzogni
0b8a2ec181 Add more examples. 2019-01-06 01:28:14 +01:00
Arthur Sonzogni
6bf7acbd54 Update example package_manager. 2019-01-06 00:51:56 +01:00
Arthur Sonzogni
961e3dcb50 Pipeable decoration and the package_manager example.
- Pipeable decorator.
- package_manager example.
2019-01-05 02:03:49 +01:00
Arthur Sonzogni
178feaa6a9 Add menu styles. 2019-01-03 00:35:59 +01:00