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