Commit Graph

447 Commits

Author SHA1 Message Date
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
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
210e8c5863
Add general fuzzer. (#159) 2021-07-17 15:53:25 +02:00
Tushar Maheshwari
21d746e858
Remove explicit default destructors (#157)
From CppCoreGuidelines:

Rule of Zero: C.20: If you can avoid defining default operations, do.
C.52: Use inheriting constructors to import constructors into a derived class that does not need further explicit initialization.
DRY forward and using declarations.
Miscellaneous:

Fix format.sh to output examples with normalised paths in sorted order.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-07-17 12:02:08 +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
Arthur Sonzogni
a56bb50807
Fix compilation errors. (#155) 2021-07-15 22:45:10 +02:00
Felix Heitmann
c34494ce26
Allows components to remove a child or access to children in general (#152)
Allows components to remove a child or access to children in general.

Co-authored-by: Felix Heitmann <fheitmann@se-gpu-03.intern.plath.de>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-07-15 15:29:33 +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
Arthur Sonzogni
e87ff7e873
Minor update of the documentation. (#148) 2021-07-12 23:22:15 +02:00
cmorganBE
cd828bf94d
mainpage.md - Document 'refreshing / invalidating the screen to cause… (#147)
Add a section explaining the use for ScreenInteractive::PostEvent.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-07-12 23:15:44 +02:00
Arthur Sonzogni
fe290e7fed
Increase version. (#146) 2021-07-11 12:25:54 +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
7f514ff41c Remove toggle.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
bead2134d6 Remove radiobox.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
d5cb4648d2 Remove menu.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
0ca7da630b Remove container.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
e66ebe5443 Remove button.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
f53dc139e9 Add documentation for options. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
fac373494d Add option for Toggle. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
ae6473363d Add option for radiobox 2021-07-11 12:23:42 +02:00
ArthurSonzogni
33b3d1c7ab Add option for input. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
2b7daf061f Add options for checkbox. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
359100ca73 Add option for Button. 2021-07-11 12:23:42 +02:00