87 void Set(std::string_view title, std::string_view info, std::vector<std::string_view> all_btn)
89 _txtTitle->SetString(title);
91 _txt->SetString(std::string{
"\t" } + std::string{ info });
93 _txt->SetString(info);
96 _numBtn = all_btn.size();
97 if (_numBtn > _allBtn.size())
99 _allBtn.resize(_numBtn);
109 for (std::size_t i = 0; i < _numBtn; ++i)
111 _allBtn[i]->SetString(all_btn[i]);
115 Float w_btn = _btn->GetSize()[0];
116 Float h_btn = _btn->GetSize()[1];
118 Float w = w_btn * _numBtn + _dxBtn * (1 + _numBtn);
120 _txt->SetMaxW((
unsigned)w);
122 Float h_txt = _txt->GetSize()[1];
123 Float h_title = _txtTitle->GetSize()[1];
125 Float h = h_title + h_txt * 1 + h_btn * 1;
132 _bg->GetCoor()->SetPosition(
toPosition(_bg->GetOffset()) - size_half);
133 _txtTitle->SetPositionAlign(-size_half,
Align::LC);
134 _btnClose->GetCoor()->SetPosition({ size_half[0], -size_half[1] });
139 Float sx_btn = (w_btn * _numBtn + _dxBtn * (_numBtn - 1)) * -0.5_f + w_btn * 0.5_f;
140 for (std::size_t i = 0; i < _numBtn; ++i)
142 _allBtn[i]->GetCoor()->SetPosition({ sx_btn + i * (w_btn + _dxBtn), size_half[1] });
151 void Set(std::string_view str)
153 std::string_view str_title =
lang(
"msg_box", std::string{ str } +
"_title");
154 std::string_view str_info =
lang(
"msg_box", std::string{ str } +
"_info");
155 std::vector<std::string_view> all_btn;
158 std::string str_name = fmt::format(
"{}_{}", str, i);
159 auto str =
g_lang->GetCheck(
"msg_box", str_name);
160 if (!str.has_value())
164 all_btn.push_back(str.value());
167 Set(str_title, str_info, all_btn);