[XAM] Don't allow an empty title.
[XAM] Don't allow an empty titles because ImGui explodes otherwise.
This commit is contained in:
parent
b12554c5af
commit
8d5d70c77f
|
@ -38,6 +38,9 @@ class MessageBoxDialog : public xe::ui::ImGuiDialog {
|
||||||
buttons_(std::move(buttons)),
|
buttons_(std::move(buttons)),
|
||||||
default_button_(default_button),
|
default_button_(default_button),
|
||||||
out_chosen_button_(out_chosen_button) {
|
out_chosen_button_(out_chosen_button) {
|
||||||
|
if (!title_.size()) {
|
||||||
|
title_ = "Message Box";
|
||||||
|
}
|
||||||
if (out_chosen_button) {
|
if (out_chosen_button) {
|
||||||
*out_chosen_button = default_button;
|
*out_chosen_button = default_button;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +55,9 @@ class MessageBoxDialog : public xe::ui::ImGuiDialog {
|
||||||
}
|
}
|
||||||
if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
|
if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::Text("%s", description_.c_str());
|
if (description_.size()) {
|
||||||
|
ImGui::Text("%s", description_.c_str());
|
||||||
|
}
|
||||||
if (first_draw) {
|
if (first_draw) {
|
||||||
ImGui::SetKeyboardFocusHere();
|
ImGui::SetKeyboardFocusHere();
|
||||||
}
|
}
|
||||||
|
@ -170,6 +175,14 @@ class KeyboardInputDialog : public xe::ui::ImGuiDialog {
|
||||||
default_text_(xe::to_string(default_text)),
|
default_text_(xe::to_string(default_text)),
|
||||||
out_text_(out_text),
|
out_text_(out_text),
|
||||||
max_length_(max_length) {
|
max_length_(max_length) {
|
||||||
|
if (!title_.size()) {
|
||||||
|
if (!description_.size()) {
|
||||||
|
title_ = "Keyboard Input";
|
||||||
|
} else {
|
||||||
|
title_ = description_;
|
||||||
|
description_ = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (out_text_) {
|
if (out_text_) {
|
||||||
*out_text_ = default_text;
|
*out_text_ = default_text;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +200,9 @@ class KeyboardInputDialog : public xe::ui::ImGuiDialog {
|
||||||
}
|
}
|
||||||
if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
|
if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
|
||||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::TextWrapped("%s", description_.c_str());
|
if (description_.size()) {
|
||||||
|
ImGui::TextWrapped("%s", description_.c_str());
|
||||||
|
}
|
||||||
if (first_draw) {
|
if (first_draw) {
|
||||||
ImGui::SetKeyboardFocusHere();
|
ImGui::SetKeyboardFocusHere();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue