Skip to content

Commit

Permalink
proper widgets alignment in top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
tritonas00 committed Feb 22, 2022
1 parent 1029511 commit a9d2a0a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions source/main/gui/panels/GUI_RepositorySelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
{
Expand Down Expand Up @@ -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")))
{
Expand All @@ -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();
Expand Down

0 comments on commit a9d2a0a

Please # to comment.