mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-19 01:38:08 +08:00
Add documentation for options.
This commit is contained in:

committed by
Arthur Sonzogni

parent
fac373494d
commit
f53dc139e9
@@ -57,9 +57,9 @@ CheckboxBase::CheckboxBase(ConstStringRef label,
|
||||
|
||||
Element CheckboxBase::Render() {
|
||||
bool is_focused = Focused();
|
||||
auto style = is_focused ? option_->focused_style : option_->unfocused_style;
|
||||
auto style = is_focused ? option_->style_focused : option_->style_unfocused;
|
||||
auto focus_management = is_focused ? focus : *state_ ? select : nothing;
|
||||
return hbox(text(*state_ ? option_->checked : option_->unchecked),
|
||||
return hbox(text(*state_ ? option_->style_checked : option_->style_unchecked),
|
||||
text(*label_) | style | focus_management) |
|
||||
reflect(box_);
|
||||
}
|
||||
|
@@ -62,10 +62,10 @@ Element MenuBase::Render() {
|
||||
bool is_focused = (focused == int(i)) && is_menu_focused;
|
||||
bool is_selected = (*selected_ == int(i));
|
||||
|
||||
auto style = is_selected ? (is_focused ? option_->selected_focused_style
|
||||
: option_->selected_style)
|
||||
: (is_focused ? option_->focused_style
|
||||
: option_->normal_style);
|
||||
auto style = is_selected ? (is_focused ? option_->style_selected_focused
|
||||
: option_->style_selected)
|
||||
: (is_focused ? option_->style_focused
|
||||
: option_->style_normal);
|
||||
auto focus_management = !is_selected ? nothing
|
||||
: is_menu_focused ? focus
|
||||
: select;
|
||||
|
@@ -69,14 +69,15 @@ Element RadioboxBase::Render() {
|
||||
bool is_focused = Focused();
|
||||
boxes_.resize(entries_->size());
|
||||
for (size_t i = 0; i < entries_->size(); ++i) {
|
||||
auto style = (focused == int(i) && is_focused) ? option_->focused_style
|
||||
: option_->unfocused_style;
|
||||
auto style = (focused == int(i) && is_focused) ? option_->style_focused
|
||||
: option_->style_unfocused;
|
||||
auto focus_management = (focused != int(i)) ? nothing
|
||||
: is_focused ? focus
|
||||
: select;
|
||||
|
||||
const std::wstring& symbol =
|
||||
*selected_ == int(i) ? option_->checked : option_->unchecked;
|
||||
const std::wstring& symbol = *selected_ == int(i)
|
||||
? option_->style_checked
|
||||
: option_->style_unchecked;
|
||||
elements.push_back(hbox(text(symbol), text(entries_->at(i)) | style) |
|
||||
focus_management | reflect(boxes_[i]));
|
||||
}
|
||||
|
@@ -38,10 +38,10 @@ Element ToggleBase::Render() {
|
||||
bool is_focused = (focused == int(i)) && is_toggle_focused;
|
||||
bool is_selected = (*selected_ == int(i));
|
||||
|
||||
auto style = is_selected ? (is_focused ? option_->selected_focused_style
|
||||
: option_->selected_style)
|
||||
: (is_focused ? option_->focused_style
|
||||
: option_->normal_style);
|
||||
auto style = is_selected ? (is_focused ? option_->style_selected_focused
|
||||
: option_->style_selected)
|
||||
: (is_focused ? option_->style_focused
|
||||
: option_->style_normal);
|
||||
auto focus_management = !is_selected ? nothing
|
||||
: is_toggle_focused ? focus
|
||||
: select;
|
||||
|
@@ -6,13 +6,11 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
Decorator compose(Decorator a, Decorator b) {
|
||||
return [a = std::move(a), b = std::move(b)](Element element) {
|
||||
return b(a(std::move(element)));
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
/// @brief A decoration doing absolutely nothing.
|
||||
/// @ingroup dom
|
||||
|
Reference in New Issue
Block a user