86 void Set(std::string_view title, std::string_view info, std::vector<std::string_view> all_btn)
88 _txtTitle->SetString(title);
90 _txt->SetString(std::string{
"\t" } + std::string{ info });
92 _txt->SetString(info);
95 _numBtn = all_btn.size();
96 if (_numBtn > _allBtn.size())
98 _allBtn.resize(_numBtn);
108 for (std::size_t i = 0; i < _numBtn; ++i)
110 _allBtn[i]->SetString(all_btn[i]);
114 Float w_btn = _btn->GetSize()[0];
115 Float h_btn = _btn->GetSize()[1];
117 Float w = w_btn * _numBtn + _dxBtn * (1 + _numBtn);
119 _txt->SetMaxW((
unsigned)w);
121 Float h_txt = _txt->GetSize()[1];
122 Float h_title = _txtTitle->GetSize()[1];
124 Float h = h_title + h_txt * 1 + h_btn * 1;
131 _bg->GetCoor()->SetPosition(
toPosition(_bg->GetOffset()) - size_half);
132 _txtTitle->SetPositionAlign(-size_half,
Align::LC);
133 _btnClose->GetCoor()->SetPosition({ size_half[0], -size_half[1] });
138 Float sx_btn = (w_btn * _numBtn + _dxBtn * (_numBtn - 1)) * -0.5_f + w_btn * 0.5_f;
139 for (std::size_t i = 0; i < _numBtn; ++i)
141 _allBtn[i]->GetCoor()->SetPosition({ sx_btn + i * (w_btn + _dxBtn), size_half[1] });
150 void Set(std::string_view str)
152 std::string_view str_title =
lang(
"msg_box", std::string{ str } +
"_title");
153 std::string_view str_info =
lang(
"msg_box", std::string{ str } +
"_info");
154 std::vector<std::string_view> all_btn;
157 std::string str_name = fmt::format(
"{}_{}", str, i);
158 auto str =
g_lang->GetCheck(
"msg_box", str_name);
159 if (!str.has_value())
163 all_btn.push_back(str.value());
166 Set(str_title, str_info, all_btn);