mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-22 12:48:09 +08:00
Introduce Options and use them for Menu.
Introduce Options for components. This allows me to add new features, without updating functions signatures.
This commit is contained in:

committed by
Arthur Sonzogni

parent
82adc3b410
commit
cd84b187b3
19
include/ftxui/component/component_options.hpp
Normal file
19
include/ftxui/component/component_options.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
|
||||
#define FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
struct MenuOption {
|
||||
Decorator normal_style = nothing;
|
||||
Decorator focused_style = inverted;
|
||||
Decorator selected_style = bold;
|
||||
Decorator selected_focused_style = focused_style | selected_style;
|
||||
|
||||
// State update callback.
|
||||
std::function<void()> on_change = []() {};
|
||||
std::function<void()> on_enter = []() {};
|
||||
};
|
||||
|
||||
}; // namespace ftxui
|
||||
|
||||
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */
|
Reference in New Issue
Block a user