Commit Graph

674 Commits

Author SHA1 Message Date
Arthur Sonzogni
026a005753
Table (#229)
This class allows rendering stylized table.
2021-10-15 23:04:11 +02:00
Jarosław Pelczar
7298636e7c
Add API to set terminal fallback size (#230)
In case of embedded systems, the terminal size may not
always be detectable (e.g. in case of serial output).
Allow application to set up the default size in case
autodetection fails. On platform such as Emscripten,
there is only "fallback" size.

Signed-off-by: Jarosław Pelczar <jarek@jpelczar.com>
2021-10-13 13:44:30 +02:00
tomvg
5e199fcd85
Include <algorithm> for std::max for msvc 2017, (#226)
Msvc defined its own (lowercase) macros for min/max. Because of this, the std::min and std::max functions need to be explicitly included or otherwise are not availible.
In the msvc 2019 compiler this issue seems fixed. However, on msvc 2017 not including <algorithm> causes compilation errors. Adding the include is a simple fix that does not hurt the other platforms and enables compilation on msvc 2017.
2021-10-12 11:36:19 +02:00
Arthur Sonzogni
57a5512a22
Support dynamic library. (#225)
- Let the global `BUILD_SHARED_LIBS` dictates whether the library should
  be built statically or dynamically. The cmake's default is statically.
- Add library version and symlink.

This lead to the following install tree.
.
├── include
│   └── ftxui
│       ├── component [...]
│       ├── dom [...]
│       ├── screen [...]
│       └── util [...]
└── lib
    ├── cmake
    │   └── ftxui
    │       ├── ftxui-config.cmake
    │       ├── ftxui-config-version.cmake
    │       └── ftxui-config-version-noconfig.cmake
    ├── ftxui-component.so -> ftxui-component.so.0.10.369
    ├── ftxui-component.so.0.10.369
    ├── ftxui-dom.so -> ftxui-dom.so.0.10.369
    ├── ftxui-dom.so.0.10.369
    ├── ftxui-screen.so -> ftxui-screen.so.0.10.369
    └── ftxui-screen.so.0.10.369

Fixed: https://github.com/ArthurSonzogni/FTXUI/issues/223
2021-10-10 12:52:34 +02:00
Jarosław Pelczar
75482d82d4
Use sensible defaults in case TIOCGWINSZ fails (#224)
This can happen for example in embedded linux, in case
the application is started via serial terminal.

Signed-off-by: Jarosław Pelczar <jarek@jpelczar.com>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-10-09 11:51:00 +02:00
Arthur Sonzogni
31c26c6956
Update README.md 2021-10-08 14:12:27 +02:00
ArthurSonzogni
6dd626a79a Fix: Add separator(Pixel) back.
It was removed by mistacke previously.
Take the opportunity to create new documentation.
2021-10-03 10:45:47 +02:00
ArthurSonzogni
05fc866d74 Do not trigger the CQ twice on pull request. 2021-09-30 21:44:29 +02:00
ArthurSonzogni
46f481ded7 Submit release as draft.
This will let me time to add a description.
2021-09-30 21:42:52 +02:00
ArthurSonzogni
75cd2b0fca Fix workflow 2021-09-30 21:29:41 +02:00
ArthurSonzogni
0a5e9f2a2f Add workflow creating releases. 2021-09-30 21:25:47 +02:00
ArthurSonzogni
66cdf9b2a5 Fix: box drawing comparison.
There was a bug. Converting the bitfield to int using the union wasn't
working correctly.
2021-09-30 20:55:47 +02:00
ArthurSonzogni
84287eb217 Use vscroll_indicator in examples. 2021-09-30 20:55:47 +02:00
Arthur Sonzogni
535974d291 Update README.md 2021-09-30 20:55:47 +02:00
ArthurSonzogni
753502998c Add a C++ badge. 2021-09-30 20:55:47 +02:00
ArthurSonzogni
31b5fac9c5 Add fuzzer to Maybe & Dropdown. 2021-09-30 20:55:47 +02:00
ArthurSonzogni
76b2f17488 fix: vscroll_indicator. Reserve one cell. 2021-09-30 20:55:47 +02:00
Arthur Sonzogni
c5ef0c7fb5 feat: Dropdown select menu. (#214)
Dom
 - `vscroll_indicator`. Show a scrollback indicator on the right.

Component
 - `Maybe`: Display an component conditionnally based on a boolean.
 - `Dropdown`: A dropdown select list.

This address:
https://github.com/ArthurSonzogni/FTXUI/issues/204
2021-09-30 20:55:47 +02:00
Arthur Sonzogni
0d1a7ffe6d
Add Changelog. (#213)
- Increase version to 0.9
- Add a changelog.

From now one. Developpement happens on the `dev` branch.

See: https://github.com/ArthurSonzogni/FTXUI/discussions/207
2021-09-26 14:48:48 +02:00
Ahmet Sarı
1d09ff4b9b
Added TimeAccumulator in README.md (#209) 2021-09-21 09:54:58 +02:00
Arthur Sonzogni
2c84f0cf1a
Run IWYU. (#208) 2021-09-16 20:45:26 +02:00
Arthur Sonzogni
37b44e7557
Fix mouse wheel on checkbox. (#205) 2021-09-16 00:47:31 +02:00
Henrik Gaßmann
7d4452f45c
Add an UDL for combined hex RGB colors (#203)
In order to allow using the literal on its own it has been put into the
inline namespace `literals`.
2021-09-14 14:22:30 +02:00
Arthur Sonzogni
b5c3b17b3f
feat: Multiple border style. (#202) 2021-09-12 00:36:59 +02:00
Arthur Sonzogni
4d50dadb41
feat: Support mouse scroll. (#201) 2021-09-08 09:36:37 +02:00
Arthur Sonzogni
ed28bad02a
Fix Gauge of size zero. (#200) 2021-09-04 19:58:02 +02:00
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
9763dbf744
Fix lolskater size. (#197) 2021-08-23 15:01:13 +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
b95a7a4c6b
Update Input's options. (#195)
- Password is now taking a ref, allowing a shared state to be used by
  multiple passwords.

- Password cursor position is now optional. It will be used only when
  set to something different from -1.
2021-08-22 13:51:00 +02:00
Arthur Sonzogni
69b0c9e53e
Optimize performance. (#189)
Screen::ApplyShader accounted for 60% of the computation. This patch
optimize it.
Performance on a 80x80 frame improved from 1400 draw/s to 7000 draw/s.
2021-08-13 00:11:52 +02:00
Arthur Sonzogni
70cf088d6a
Fix input. (#188)
Instead of wrapping WideInputBase by composition, wrap it by
inheritance. This resolve the focus that was broken.
2021-08-10 22:22:50 +02:00
Arthur Sonzogni
79b8928f6e
Reland "Factorize box layout functions. (#185)"" (#187)
This reverts commit a7095970bc.
2021-08-10 22:15:24 +02:00
Arthur Sonzogni
98f49a581c
Revert "Factorize box layout functions. (#185)" (#186)
This reverts commit 71299daea4.
2021-08-10 19:36:57 +02:00
Arthur Sonzogni
71299daea4
Factorize box layout functions. (#185)
|hbox| and |vbox| are similar. They are just the same component, but
drawing in a different direction.

This patchs factorize the layout logic. Goal is to reduce code size and
reuse it for the |gridbox| dom element.

Bug: https://github.com/ArthurSonzogni/FTXUI/issues/114
2021-08-10 14:20:03 +02:00
Arthur Sonzogni
4450cca31a
Update docs to use std::string. (#184) 2021-08-09 22:51:48 +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
1ff894f6f5
Address @tusharpm comments. (#178)
@tusharpm let two comments in:
https://github.com/ArthurSonzogni/FTXUI/pull/175
but this already landed in:
https://github.com/ArthurSonzogni/FTXUI/pull/173

Address them here.
2021-08-08 08:49:46 +02:00
Arthur Sonzogni
d197e2f4fb
Switch to rounded borders. (#175)
They are nicer.
It would be nice supporting a way for FTXUI to let the user chose what
they prefer instead.
2021-08-07 22:30:55 +02:00
Arthur Sonzogni
3f005d7715
Add focusable Renderer. (#173) 2021-08-06 20:32:33 +02:00
Arthur Sonzogni
26e26fd41a
Add non focusable components. (#172) 2021-08-05 22:40:40 +02:00
Tushar Maheshwari
49e8cc57d3
Extract common struct Dimensions from Terminal (#171)
- Convert Dimension to namespace to allow defining Fit method from dom.
- Use Dimensions extracted from Terminal as replacement struct.
- Convert Terminal to namespace as it only defines static members.
- Remove dom references from screen library (circular dependency).
2021-08-02 23:19:29 +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
Arthur Sonzogni
eeb4fa3648
Update link from README.md (#168)
Update the link in the README.md. Use the auto-deployed documentations
and examples @tusharpm made.
2021-07-25 22:51:32 +02:00
Tushar Maheshwari
6a19371c9c
Merge Documentation and Emscripten workflow (#166)
Unify Documentation and Emscripten workflow
2021-07-25 19:31:45 +02:00
Arthur Sonzogni
2f9563a91b
Install graphviz to let Doxygen generate graph. (#165) 2021-07-23 09:18:23 +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
7f95d59954
Deduplicate logic in ComponentBase members (#162)
- Invoke DetachAllChildren from ~ComponentBase
- Define Focused using Active
- Compact TakeFocus loop code
- const-correctness for Parent, Active and Focused
2021-07-21 00:37:44 +02:00