blob: c8ef9c504394a6d2d6287c42e103cbb7d77a88f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#pragma once
#include "Component.h"
#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"
namespace cru::ui::components {
class CRU_UI_API PopupMenuTextButton : public Component {
public:
PopupMenuTextButton();
~PopupMenuTextButton() override;
public:
ui::controls::Control* GetRootControl() override { return &button_; }
ui::controls::Button* GetButton() { return &button_; }
String GetButtonText() { return button_text_.GetText(); }
void SetButtonText(String text) { button_text_.SetText(std::move(text)); }
void SetButtonTextColor(const Color& color) {
button_text_.SetTextColor(color);
}
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_;
};
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
|