mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-07-24 05:01:14 +08:00
Add changelog and example.
This commit is contained in:
parent
c71cf3e4bf
commit
5ff0764e77
@ -7,6 +7,7 @@ current (development)
|
|||||||
### Component
|
### Component
|
||||||
- Feature: Add support for `Input`'s insert mode. Add `InputOption::insert`
|
- Feature: Add support for `Input`'s insert mode. Add `InputOption::insert`
|
||||||
option. Added by @mingsheng13.
|
option. Added by @mingsheng13.
|
||||||
|
- Feature: Add `DropdownOption` to configure the dropdown. See #826.
|
||||||
- Bugfix/Breaking change: `Mouse transition`:
|
- Bugfix/Breaking change: `Mouse transition`:
|
||||||
- Detect when the mouse move, as opposed to being pressed.
|
- Detect when the mouse move, as opposed to being pressed.
|
||||||
The Mouse::Moved motion was added.
|
The Mouse::Moved motion was added.
|
||||||
|
@ -61,9 +61,44 @@ int main() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto dropdown_3 = Dropdown({
|
||||||
|
.radiobox =
|
||||||
|
{
|
||||||
|
.entries = &entries,
|
||||||
|
.transform =
|
||||||
|
[](const EntryState& s) {
|
||||||
|
auto t = text(s.label) | borderEmpty;
|
||||||
|
if (s.active) {
|
||||||
|
t |= bold;
|
||||||
|
}
|
||||||
|
if (s.focused) {
|
||||||
|
t |= inverted;
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.transform =
|
||||||
|
[](bool open, Element checkbox, Element radiobox) {
|
||||||
|
checkbox |= borderEmpty;
|
||||||
|
if (open) {
|
||||||
|
return vbox({
|
||||||
|
checkbox | inverted,
|
||||||
|
radiobox | vscroll_indicator | frame |
|
||||||
|
size(HEIGHT, LESS_THAN, 20) | bgcolor(Color::Red),
|
||||||
|
filler(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return vbox({
|
||||||
|
checkbox | bgcolor(Color::Red),
|
||||||
|
filler(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
auto screen = ScreenInteractive::FitComponent();
|
auto screen = ScreenInteractive::FitComponent();
|
||||||
screen.Loop(Container::Horizontal({
|
screen.Loop(Container::Horizontal({
|
||||||
dropdown_1,
|
dropdown_1,
|
||||||
dropdown_2,
|
dropdown_2,
|
||||||
|
dropdown_3,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -268,9 +268,13 @@ struct WindowOptions {
|
|||||||
/// @ingroup component
|
/// @ingroup component
|
||||||
/// A dropdown menu is a checkbox opening/closing a radiobox.
|
/// A dropdown menu is a checkbox opening/closing a radiobox.
|
||||||
struct DropdownOption {
|
struct DropdownOption {
|
||||||
|
/// Whether the dropdown is open or closed:
|
||||||
Ref<bool> open = false;
|
Ref<bool> open = false;
|
||||||
|
// The options for the checkbox:
|
||||||
CheckboxOption checkbox;
|
CheckboxOption checkbox;
|
||||||
|
// The options for the radiobox:
|
||||||
RadioboxOption radiobox;
|
RadioboxOption radiobox;
|
||||||
|
// The transformation function:
|
||||||
std::function<Element(bool open, Element checkbox, Element radiobox)>
|
std::function<Element(bool open, Element checkbox, Element radiobox)>
|
||||||
transform;
|
transform;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user