aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/components/Select.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-15 21:34:21 +0800
committercrupest <crupest@outlook.com>2022-02-15 21:34:21 +0800
commit24aaa8fbc5da8370506402facdb8ccaf563454e5 (patch)
tree0075bfbee729b1ccc57966bef97bda4be09cbde9 /include/cru/ui/components/Select.h
parentfa6e9a419f688df12a57199aa3b4dce10cc6fd49 (diff)
downloadcru-24aaa8fbc5da8370506402facdb8ccaf563454e5.tar.gz
cru-24aaa8fbc5da8370506402facdb8ccaf563454e5.tar.bz2
cru-24aaa8fbc5da8370506402facdb8ccaf563454e5.zip
...
Diffstat (limited to 'include/cru/ui/components/Select.h')
-rw-r--r--include/cru/ui/components/Select.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/cru/ui/components/Select.h b/include/cru/ui/components/Select.h
new file mode 100644
index 00000000..cc658092
--- /dev/null
+++ b/include/cru/ui/components/Select.h
@@ -0,0 +1,34 @@
+#pragma once
+#include "Component.h"
+#include "Menu.h"
+#include "cru/ui/controls/Button.h"
+#include "cru/ui/controls/TextBlock.h"
+
+namespace cru::ui::components {
+class CRU_UI_API Select : public Component {
+ public:
+ Select();
+ ~Select() override;
+
+ public:
+ ui::controls::Control* GetRootControl() override { return &button_; }
+
+ std::vector<String> GetItems() { return items_; }
+ void SetItems(std::vector<String> items);
+
+ Index GetSelectedIndex() { return selected_index_; }
+ void SetSelectedIndex(Index index);
+
+ IEvent<Index>* ItemSelectedEvent() { return &item_selected_event_; }
+
+ private:
+ Index selected_index_;
+ std::vector<String> items_;
+
+ ui::controls::Button button_;
+ ui::controls::TextBlock button_text_;
+ PopupMenu popup_menu_;
+
+ Event<Index> item_selected_event_;
+};
+} // namespace cru::ui::components