FTXUI
0.8.1
C++ functional terminal UI.
|
Go to the documentation of this file.
19 class ButtonBase :
public ComponentBase {
21 ButtonBase(ConstStringRef label,
22 std::function<
void()> on_click,
23 Ref<ButtonOption> option)
24 : label_(label), on_click_(on_click), option_(std::move(option)) {}
30 return text(*label_) | my_border | style |
reflect(box_);
33 bool OnEvent(Event event)
override {
34 if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) {
35 if (!CaptureMouse(event))
56 bool Focusable() const final {
return true; }
59 ConstStringRef label_;
60 std::function<void()> on_click_;
62 Ref<ButtonOption> option_;
91 std::function<
void()> on_click,
93 return Make<ButtonBase>(label, std::move(on_click), std::move(option));
Element border(Element)
Draw a border around the element.
std::shared_ptr< ComponentBase > Component
Element nothing(Element element)
A decoration doing absolutely nothing.
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
Decorator reflect(Box &box)
static const Event Return
std::shared_ptr< Node > Element
An adapter. Own or reference an mutable object.
Component Button(ConstStringRef label, std::function< void()> on_click, Ref< ButtonOption >={})
Draw a button. Execute a function when clicked.
void Render(Screen &screen, const Element &node)
Display an element on a ftxui::Screen.
An adapter. Own or reference a constant string. For convenience, this class convert multiple immutabl...
Element text(std::wstring text)
Display a piece of unicode text.