mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 08:04:21 +08:00
Add option for Button.
This commit is contained in:

committed by
Arthur Sonzogni

parent
cd84b187b3
commit
359100ca73
@@ -21,7 +21,9 @@ class ButtonBase : public ComponentBase {
|
||||
static ButtonBase* From(Component);
|
||||
|
||||
// Constructor.
|
||||
ButtonBase(ConstStringRef label, std::function<void()> on_click, bool border);
|
||||
ButtonBase(ConstStringRef label,
|
||||
std::function<void()> on_click,
|
||||
ConstRef<ButtonOption> option);
|
||||
~ButtonBase() override = default;
|
||||
|
||||
// Component implementation.
|
||||
@@ -31,8 +33,8 @@ class ButtonBase : public ComponentBase {
|
||||
private:
|
||||
ConstStringRef label_;
|
||||
std::function<void()> on_click_;
|
||||
bool border_;
|
||||
Box box_;
|
||||
ConstRef<ButtonOption> option_;
|
||||
};
|
||||
|
||||
} // namespace ftxui
|
||||
|
@@ -26,7 +26,7 @@ std::shared_ptr<T> Make(Args&&... args) {
|
||||
|
||||
Component Button(ConstStringRef label,
|
||||
std::function<void()> on_click,
|
||||
bool border = true);
|
||||
ConstRef<ButtonOption> = {});
|
||||
Component Checkbox(ConstStringRef label, bool* checked);
|
||||
Component Input(StringRef content, ConstStringRef placeholder);
|
||||
Component Menu(const std::vector<std::wstring>* entries,
|
||||
|
@@ -14,6 +14,10 @@ struct MenuOption {
|
||||
std::function<void()> on_enter = []() {};
|
||||
};
|
||||
|
||||
}; // namespace ftxui
|
||||
struct ButtonOption {
|
||||
bool border = true;
|
||||
};
|
||||
|
||||
}; // namespace ftxui
|
||||
|
||||
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */
|
||||
|
Reference in New Issue
Block a user