Commit Graph

121 Commits

Author SHA1 Message Date
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
ArthurSonzogni
98b31ff1fe
Remove ButtonOption::Arthur()
It was added by mistacke previously.
2023-06-11 13:39:33 +02:00
Nick Fistere
9bfa241627
Delete copy constructor and copy operator (#638)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-05-16 18:33:41 +02:00
Arthur Sonzogni
7de4f8683d
Feature: Add multi-line input. (#630) 2023-05-02 13:32:37 +02:00
Marc
eed7e2ea70
Multiple fixes: signed/unsigned, etc... (#600)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-03-26 20:20:02 +02:00
Arthur Sonzogni
e177409bd3
Update float style in animation.cpp (#607)
Partially taken out of:
https://github.com/ArthurSonzogni/FTXUI/pull/600

Co-authored-by: LostInCompilation <12819635+LostInCompilation@users.noreply.github.com>
2023-03-26 16:42:08 +02: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
3e35f45830
Execute clang-tidy and IWYU. (#576) 2023-02-12 14:07:28 +01:00
Arthur Sonzogni
60b9e491db
Add all the Slider implementations. (#532)
This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/524
2022-12-22 21:15:54 +01:00
Arthur Sonzogni
0542227ba7
Execute clang tidy and IWYU (#528) 2022-12-19 19:44:43 +01:00
Arthur Sonzogni (slow/sick)
0d54285e19
Add the Hoverable wrapper. (#522)
This will make it easier for developers. For instance:
https://github.com/ArthurSonzogni/FTXUI/issues/521
2022-12-04 11:54:49 +01:00
mr-mocap
f21ca3aa14
Improve UNIX signal handling (#518)
There was a dead lock caused by the reentrancy of the post method.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2022-12-01 22:56:35 +01: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
f4b47333be
Featre: Support ctrl+arrow in input. (#494)
CTRL+LEFT: Move the cursor to the beginning of the word.
CTRL+RIGHT: Move the cursor to the beginning of the word.

This was requested by:
https://github.com/ArthurSonzogni/FTXUI/issues/490
2022-10-06 21:16:55 +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
Jan Sende
d04e04adc6
Fixed typo (#465) 2022-08-24 12:00:54 +02:00
Arthur Sonzogni
d755356481
Add ref for sliders. (#457)
This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/456
2022-08-13 16:26:53 +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
ArthurSonzogni
114cbfcffd Add coverage and remove deprecated WideInput. 2022-04-27 11:33:42 +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
Kefu Chai
63e8dadad9
allow passing move-only parameter to Make() (#338)
ftxui::Ref<> is used for passing Options, for instance, MenuOption,
to the corresponding component which is supposed to hold a strong
reference of it. and we can observe the events sent to the component
by setting callback(s) in the option instance passed to the owner
component.

but the callback function is not always copyable, despite that it
might be moveable.

in this change,

* Make<>() is updated to use the perfect forwarding to avoid
  enforcing its parameters to be copyable.
* Ref<> is also updated to take a rvalue reference, so we can
  move away from the contructor parameter when creating an
  instance of Ref<>() from it.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2022-02-16 14:09:08 +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
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
1888631bec
Main (#303)
* Refresh cursor reporting on resize.

* Fix invalid size write.

This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/302
2022-01-11 23:06:36 +01:00
Arthur Sonzogni
fc92f52b4c
The collapsible element. (#294) 2022-01-02 15:48:56 +01:00
Arthur Sonzogni
026a005753
Table (#229)
This class allows rendering stylized table.
2021-10-15 23:04:11 +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
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
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
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
Arthur Sonzogni
26e26fd41a
Add non focusable components. (#172) 2021-08-05 22:40:40 +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
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
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
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