dl
dl_ui_msg_box.h
浏览该文件的文档.
1
12#pragma once
13
14#ifndef DL_DISABLE_RENDER
16#include "ui/dl_ui_background.h"
17#include "ui/dl_ui_panel.h"
18#include "ui/dl_ui_window.h"
19#include "ui/dl_ui_list_box.h"
20
21namespace dl::UI
22{
24class MsgBox : public Window
25{
26public:
27
32 static MsgBox* Create(UI::Text* title, UI::Text* content, UI::Button* btn);
33
38 Panel* GetPanelButton() { return _panelBtn; }
39
40 virtual void Update() override;
45 void SetClickClose(bool close)
46 {
47 _bClickClose = close;
48 }
49
52 size_t GetClickIndex();
57
65 void Set(std::string_view title, std::string_view info, std::vector<std::string_view> all_btn);
66
67
69private:
70 MsgBox() :
71 _bAddTab{ true },
72 _bClickClose{ true },
73 _btn{ nullptr }
74 {
75 }
76
77 bool _bAddTab;
78 bool _bClickClose; // 点击任意按钮直接关闭
79
80 UI::Text* _txtTitle;
81 UI::Text* _txtContent;
82 UI::Button* _btn;
83 UI::Panel* _panelBtn;
84
85 std::vector<UI::Button*> _allBtn;
86
87 void _init();
88};
89}
90
91#endif
按钮(Button、Switch、Radio)
void Set(std::string_view title, std::string_view info, std::vector< std::string_view > all_btn)
设置内容
void SetClickClose(bool close)
设置是否点击任意按钮关闭窗口
virtual void Update() override
帧函数 @info 子类重载后,需要调用 Window::Update()
Panel * GetPanelButton()
返回按钮组 @info 设置整体位置和按钮布局
static MsgBox * Create(UI::Text *title, UI::Text *content, UI::Button *btn)
创建窗口
size_t GetOverOnceIndex()
返回经过的按钮下标,不包含关闭按钮
size_t GetClickIndex()
返回点击的按钮下标,不包含关闭按钮
组件实例
作为绘图背景
UI之列表框
ui之panel
UI之窗口