Commit Graph

107 Commits

Author SHA1 Message Date
ArthurSonzogni
43240a5fd4
Add missing includes for gcc
Bug:https://github.com/ArthurSonzogni/FTXUI/issues/695
2023-07-15 16:40:20 +02:00
Arthur Sonzogni
e19550ae69
Feature: Windows. (#690)
Into ftxui/component/, add:
```
Container::Stacked(...)
Window(...);
```

Together, they can be used to display draggable/resizable windows.

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/682

* Fix typo.
2023-07-15 16:29:48 +02:00
Arthur Sonzogni
455998d759
Remove Ref<XxxOption> and add new interfaces. (#686)
1. Stop taking Ref<XxxOption> in Component constructors. Instead, use
   the XxxOption directly. Passing by copy avoid problems developers had
   where one was shared in between multiple component, causing issues.

2. Add variants of most component constructors taking a struct only.

This replaces:
https://github.com/ArthurSonzogni/FTXUI/pull/670

This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/426
2023-06-25 17:22:05 +02:00
Prokop Randáček
59bbe3ed5e
fix some warnings (#660)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-06-03 13:59:39 +02:00
Arthur Sonzogni
7de4f8683d
Feature: Add multi-line input. (#630) 2023-05-02 13:32:37 +02:00
Vinicius Moura Longaray
e83e90ced2
Feature: LinearGradient color decorator. (#592)
Based on the existing color decorators, create new ones to apply a gradient effect on the DOM.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-03-22 13:59:02 +01:00
Arthur Sonzogni
9b074d1e27
Feature resizable spilt with custom separator (#583)
* Feature: ResizableSplit with custom separator

This resolves:
    https://github.com/ArthurSonzogni/FTXUI/issues/580

Co-authored-by: Pin Loon Lee <pinloon_0428@hotmail.com>
2023-03-09 20:21:23 +01:00
Arthur Sonzogni
0542227ba7
Execute clang tidy and IWYU (#528) 2022-12-19 19:44:43 +01:00
Arthur Sonzogni (slow/sick)
1689802349
Support multiple kind of cursor shapes. (#505)
https://github.com/ArthurSonzogni/FTXUI/issues/424
2022-11-11 14:09:53 +01:00
Arthur Sonzogni
aeaf39b8ea
Fix F1-F4 keymapping. (#501)
It was just wrong, even on Linux.

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/492
2022-10-18 22:58:22 +02:00
Arthur Sonzogni
0acfd8f255
Introduce Loop. (#476)
It can be used to give developers a better control on the loop. Users
can use it not to take full control of the thread, and poll FTXUI from
time to time as part of an external loop.

This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/474
2022-10-18 21:29:27 +02:00
Arthur Sonzogni
c8ec151154
Bring back C++17 minimal requirement. (#475) 2022-09-03 13:03:04 +02:00
Arthur Sonzogni
b3ba747d82
Feature: Slider in any directions. (#468)
Add the `SliderOption` option supporting:
```cpp
{
  Ref<T> value;
  ConstRef<T> min = T(0);
  ConstRef<T> max = T(100);
  ConstRef<T> increment = (max() - min()) / 20;
  GaugeDirection direction = GaugeDirection::Right;
  Color color_active = Color::White;
  Color color_inactive = Color::GrayDark;
};
```

In particular, this supports multiple direction. This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/467

This one do not support adding a label. The old constructors can still
be used to have a label.
2022-08-30 18:52:33 +02:00
Arthur Sonzogni
f461050759
Run IWYU (#450) 2022-08-07 14:44:33 +02:00
Arthur Sonzogni
57da24dfdb
Fix homescreen example thread safety. (#431)
This addresses and fix:
https://github.com/ArthurSonzogni/FTXUI/issues/430

This patchs makes |shift| to be read and written on the same thread. We
request the update to be made via a task posted on the main thread.

This patch has no real consequence, the previous behavior was fine.
I hope it will help users not to have thread safety issue and better
understand they can post tasks this way.
2022-07-04 23:34:37 +02:00
Arthur Sonzogni
925a7578d4
Feature: the Modal component. (#418) 2022-06-12 17:08:22 +02:00
Arthur Sonzogni
c033ca61ae
Remove NXXM. Execute IWYU. (#397) 2022-05-08 08:44:38 +02:00
ArthurSonzogni
c2e1920449 Execute IWYU. 2022-04-28 10:43:31 +02:00
Arthur Sonzogni
9f610a0110
Make the focused button to take the focus inside frame. (#371)
This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/370
2022-04-03 15:04:33 +02:00
Arthur Sonzogni
aebde94352
Add clang-tidy. (#368) 2022-03-31 02:17:43 +02:00
Arthur Sonzogni
62fb6298be
Bug fixes. (#367)
- Do not draw more frames than what is needed.
- Fix MenuEntry transform state.
- Fix Canvas animated example.
2022-03-26 07:55:52 +01:00
Arthur Sonzogni
4da63b9260
Animation (#355) 2022-03-13 18:51:46 +01:00
Kefu Chai
95c766e9e4
Component decorators (#354)
Add decorator variants for decorator components

Add the "pipe" operator for components, similar to what was done for Elements.
We are able to put something like:
```
Button(...) | Maybe(&show_button)
```

Add decorators for:
- `Maybe`
- `CatchEvent`
- `Renderer`

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2022-03-12 15:18:36 +01:00
Arthur Sonzogni
9c4218c2a8
Support SIGTSTP and task posting. (#331)
- Add support for SIGTSTP:
https://github.com/ArthurSonzogni/FTXUI/issues/330
This

- Add support for task posting.
This allows folks to defer function execution, and execute it directly
below the main loop. The task are executed in a FIFO order.
2022-02-13 11:11:34 +01:00
Nikola Dućak
689d5dd299
Replace std::clamp with util::clamp and reformat the code (#321)
* Replace std::clamp with util::clamp
* Apply clang-format
* Execute ./tools/iwyu.sh

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2022-02-05 15:03:45 +01:00
Vladislav Nepogodin
b4a655ec65
Introduce WithRestoredIO (#307)
This function allow running a callback with the terminal hooks
temporarily uninstalled.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2022-01-19 13:38:39 +01:00
Arthur Sonzogni
cdd6339849
Execute IWYU (#299) 2022-01-07 11:03:54 +01:00
Arthur Sonzogni
fc92f52b4c
The collapsible element. (#294) 2022-01-02 15:48:56 +01:00
Arthur Sonzogni
aea67743d4
Canvas bug fix and documentation. (#289) 2021-12-29 16:31:27 +01:00
Arthur Sonzogni
7614bf04a6
Address felixjulianheitmann suggestions. (#288)
- Remove unused examples/dom/flexbox.cpp
- Add canvas(width, height, void(Canvas&)) method
2021-12-24 17:29:39 +01:00
Arthur Sonzogni
0d47dd19ab
Feature: Canvas (#287)
Draw using braille and block characters on a grid.
2021-12-23 14:17:33 +01:00
Arthur Sonzogni
7e5cd23b4c
Add focusPosition[relative](x,y) (#280)
It allows when using inside a frame, to scroll the view toward a
particular position.

This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/125
2021-12-13 11:38:31 +01:00
Arthur Sonzogni
602392c43d
Implement flexbox (#277)
This implement the flexbox elements, following the HTML one.

Built from them, there is also the following elements:
- `paragraph`
- `paragraphAlignLeft`
- `paragraphAlignRight`
- `paragraphAlignCenter`
- `paragraphAlignJustify`

This is a breaking change.
2021-12-11 17:58:25 +01:00
Arthur Sonzogni
8652280c85
Input shouldn't take focus. (#253)
This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/252
2021-11-07 12:01:17 +01:00
Arthur Sonzogni
026a005753
Table (#229)
This class allows rendering stylized table.
2021-10-15 23:04:11 +02:00
ArthurSonzogni
84287eb217 Use vscroll_indicator in examples. 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
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
Arthur Sonzogni
4d50dadb41
feat: Support mouse scroll. (#201) 2021-09-08 09:36:37 +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
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
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