diff --git a/CHANGELOG.md b/CHANGELOG.md index d766685..6241e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ current (development) - various values (value, min, max, increment). - Improvement: The `Menu` keeps the focus when an entry is selected with the mouse. +- Bug: Add implementation of `ButtonOption::Border()`. It was missing. ### Screen - Feature: add `Box::Union(a,b) -> Box` diff --git a/src/ftxui/component/component_options.cpp b/src/ftxui/component/component_options.cpp index 57a2c14..e8a1cf1 100644 --- a/src/ftxui/component/component_options.cpp +++ b/src/ftxui/component/component_options.cpp @@ -144,6 +144,23 @@ ButtonOption ButtonOption::Simple() { return option; } +/// @brief Create a ButtonOption. The button is shown using a border, inverted +/// when focused. This is the current default. +ButtonOption ButtonOption::Border() { + ButtonOption option; + option.transform = [](const EntryState& s) { + auto element = text(s.label) | border; + if (s.active) { + element |= bold; + } + if (s.focused) { + element |= inverted; + } + return element; + }; + return option; +} + /// @brief Create a ButtonOption, using animated colors. // static ButtonOption ButtonOption::Animated() {