From a9d2a0a0323f9b635da16b8cad998e3cd2b9fd59 Mon Sep 17 00:00:00 2001 From: tritonas00 Date: Tue, 22 Feb 2022 18:10:50 +0200 Subject: [PATCH] proper widgets alignment in top bar --- .../gui/panels/GUI_RepositorySelector.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/main/gui/panels/GUI_RepositorySelector.cpp b/source/main/gui/panels/GUI_RepositorySelector.cpp index 88ca7b9980..86fe509761 100644 --- a/source/main/gui/panels/GUI_RepositorySelector.cpp +++ b/source/main/gui/panels/GUI_RepositorySelector.cpp @@ -444,23 +444,15 @@ void RepositorySelector::Draw() ImGui::EndCombo(); } - // Search + // Search box ImGui::SameLine(); ImGui::SetNextItemWidth(170); float search_pos = ImGui::GetCursorPosX(); ImGui::InputText("##Search", m_search_input.GetBuffer(), m_search_input.GetCapacity()); - if (m_search_input.IsEmpty()) - { - ImGui::SameLine(); - ImGui::SetCursorPosX(search_pos + ImGui::GetStyle().ItemSpacing.x); - ImGui::TextDisabled("%s", _LC("RepositorySelector", "Search Title, Author")); - } - // Sort dropdown ImGui::SameLine(); ImGui::SetNextItemWidth(80); - ImGui::SetCursorPosX(ImGui::GetWindowSize().x - 165 - ImGui::GetStyle().WindowPadding.x); if (ImGui::BeginCombo("##repo-selector-sort", _LC("RepositorySelector", "Sort"))) { @@ -500,7 +492,6 @@ void RepositorySelector::Draw() // View mode dropdown ImGui::SameLine(); ImGui::SetNextItemWidth(80); - ImGui::SetCursorPosX(ImGui::GetWindowSize().x - 80 - ImGui::GetStyle().WindowPadding.x); if (ImGui::BeginCombo("##repo-selector-view", _LC("RepositorySelector", "View"))) { @@ -519,6 +510,14 @@ void RepositorySelector::Draw() ImGui::EndCombo(); } + // Search box default text + if (m_search_input.IsEmpty()) + { + ImGui::SameLine(); + ImGui::SetCursorPosX(search_pos + ImGui::GetStyle().ItemSpacing.x); + ImGui::TextDisabled("%s", _LC("RepositorySelector", "Search Title, Author")); + } + if (m_resource_view) { ImGui::PopItemFlag();