fix: Draw title bar correctly when no title bar buttons exist
This commit is contained in:
parent
2059ad82c3
commit
33e9ad7775
@ -258,12 +258,14 @@ namespace hex {
|
|||||||
auto &titleBarButtons = ContentRegistry::Interface::impl::getTitleBarButtons();
|
auto &titleBarButtons = ContentRegistry::Interface::impl::getTitleBarButtons();
|
||||||
|
|
||||||
// Draw custom title bar buttons
|
// Draw custom title bar buttons
|
||||||
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (4 + titleBarButtons.size()));
|
if(!titleBarButtons.empty()) {
|
||||||
for (const auto &[icon, tooltip, callback] : titleBarButtons) {
|
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (4 + titleBarButtons.size()));
|
||||||
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
|
for (const auto &[icon, tooltip, callback]: titleBarButtons) {
|
||||||
callback();
|
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
ImGui::InfoTooltip(LangEntry(tooltip));
|
||||||
}
|
}
|
||||||
ImGui::InfoTooltip(LangEntry(tooltip));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw minimize, restore and maximize buttons
|
// Draw minimize, restore and maximize buttons
|
||||||
@ -306,12 +308,14 @@ namespace hex {
|
|||||||
auto &titleBarButtons = ContentRegistry::Interface::impl::getTitleBarButtons();
|
auto &titleBarButtons = ContentRegistry::Interface::impl::getTitleBarButtons();
|
||||||
|
|
||||||
// Draw custom title bar buttons
|
// Draw custom title bar buttons
|
||||||
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (titleBarButtons.size()+0.5));
|
if(!titleBarButtons.empty()) {
|
||||||
for (const auto &[icon, tooltip, callback] : titleBarButtons) {
|
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * (titleBarButtons.size() + 0.5));
|
||||||
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
|
for (const auto &[icon, tooltip, callback]: titleBarButtons) {
|
||||||
callback();
|
if (ImGui::TitleBarButton(icon.c_str(), buttonSize)) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
ImGui::InfoTooltip(LangEntry(tooltip));
|
||||||
}
|
}
|
||||||
ImGui::InfoTooltip(LangEntry(tooltip));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopStyleColor(3);
|
ImGui::PopStyleColor(3);
|
||||||
|
Loading…
Reference in New Issue
Block a user