19class CheckboxBase :
public ComponentBase,
public CheckboxOption {
21 explicit CheckboxBase(CheckboxOption option)
22 : CheckboxOption(std::move(option)) {}
27 const bool is_focused = Focused();
28 const bool is_active = Active();
29 auto entry_state = EntryState{
30 *label, *checked, is_active, is_focused || hovered_, -1,
39 bool OnEvent(Event event)
override {
40 if (!CaptureMouse(event)) {
44 if (event.is_mouse()) {
45 return OnMouseEvent(event);
49 if (event == Event::Character(
' ') || event ==
Event::Return) {
58 bool OnMouseEvent(Event event) {
59 hovered_ = box_.Contain(event.mouse().x, event.mouse().y);
61 if (!CaptureMouse(event)) {
79 bool Focusable() const final {
return true; }
81 bool hovered_ =
false;
136 option.
label = std::move(label);
An adapter. Own or reference a constant string. For convenience, this class convert multiple immutabl...
std::function< Element(const EntryState &)> transform
static CheckboxOption Simple()
Option for standard Checkbox.
Component Checkbox(CheckboxOption options)
Draw checkable element.
Option for the Checkbox component.
Element focus(Element)
Set the child to be the one focused among its siblings.
The FTXUI ftxui:: namespace.
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< Node > Element
Decorator reflect(Box &box)
std::shared_ptr< ComponentBase > Component
static const Event Return