diff options
author | crupest <crupest@outlook.com> | 2022-02-15 20:52:37 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-15 20:52:37 +0800 |
commit | fa6e9a419f688df12a57199aa3b4dce10cc6fd49 (patch) | |
tree | ab29f60da18826d287e84bb53bc124694fcccb2a /include/cru/ui | |
parent | 85f4cb239f10e1801e43f0874a4f637def5daaee (diff) | |
download | cru-fa6e9a419f688df12a57199aa3b4dce10cc6fd49.tar.gz cru-fa6e9a419f688df12a57199aa3b4dce10cc6fd49.tar.bz2 cru-fa6e9a419f688df12a57199aa3b4dce10cc6fd49.zip |
...
Diffstat (limited to 'include/cru/ui')
-rw-r--r-- | include/cru/ui/components/PopupButton.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/cru/ui/components/PopupButton.h b/include/cru/ui/components/PopupButton.h new file mode 100644 index 00000000..f8c545bf --- /dev/null +++ b/include/cru/ui/components/PopupButton.h @@ -0,0 +1,31 @@ +#pragma once +#include "Component.h" +#include "cru/ui/components/Menu.h" +#include "cru/ui/controls/Button.h" +#include "cru/ui/controls/Popup.h" +#include "cru/ui/controls/TextBlock.h" + +namespace cru::ui::components { +class PopupMenuTextButton : public Component { + public: + PopupMenuTextButton(); + ~PopupMenuTextButton() override; + + public: + ui::controls::Control* GetRootControl() override { return &button_; } + + String GetButtonText() { return button_text_.GetText(); } + void SetButtonText(String text) { button_text_.SetText(std::move(text)); } + + void SetMenuItems(std::vector<String> items); + + IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; } + + private: + ui::controls::Button button_; + ui::controls::TextBlock button_text_; + PopupMenu popup_menu_; + + Event<Index> menu_item_selected_event_; +}; +} // namespace cru::ui::components |