aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/components/PopupButton.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-03-02 22:07:33 +0800
committercrupest <crupest@outlook.com>2022-03-02 22:07:33 +0800
commit57353bd3acd97957cb5f970016fec52977cc6e95 (patch)
tree6e47a50f33466f7bcdce7c7aa9bf15b82fe4a58a /include/cru/ui/components/PopupButton.h
parent7adfe813c23d20abe936aa0624fd68e0112717b3 (diff)
downloadcru-57353bd3acd97957cb5f970016fec52977cc6e95.tar.gz
cru-57353bd3acd97957cb5f970016fec52977cc6e95.tar.bz2
cru-57353bd3acd97957cb5f970016fec52977cc6e95.zip
...
Diffstat (limited to 'include/cru/ui/components/PopupButton.h')
-rw-r--r--include/cru/ui/components/PopupButton.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/cru/ui/components/PopupButton.h b/include/cru/ui/components/PopupButton.h
index 37420ff6..c8ef9c50 100644
--- a/include/cru/ui/components/PopupButton.h
+++ b/include/cru/ui/components/PopupButton.h
@@ -3,6 +3,7 @@
#include "cru/ui/Base.h"
#include "cru/ui/components/Menu.h"
#include "cru/ui/controls/Button.h"
+#include "cru/ui/controls/IconButton.h"
#include "cru/ui/controls/Popup.h"
#include "cru/ui/controls/TextBlock.h"
@@ -35,4 +36,25 @@ class CRU_UI_API PopupMenuTextButton : public Component {
Event<Index> menu_item_selected_event_;
};
+
+class CRU_UI_API PopupMenuIconButton : public Component {
+ public:
+ PopupMenuIconButton();
+ ~PopupMenuIconButton() override;
+
+ public:
+ ui::controls::Control* GetRootControl() override { return &button_; }
+
+ ui::controls::IconButton* GetButton() { return &button_; }
+
+ void SetMenuItems(std::vector<String> items);
+
+ IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; }
+
+ private:
+ ui::controls::IconButton button_;
+ PopupMenu popup_menu_;
+
+ Event<Index> menu_item_selected_event_;
+};
} // namespace cru::ui::components