add new system navigation

This commit is contained in:
chatlanin
2023-03-26 11:01:48 +03:00
parent d775a65feb
commit 11ba975ec8
12 changed files with 98 additions and 116 deletions

View File

@@ -9,7 +9,7 @@ namespace rrr::layers::gui
BASE_WINDOW_FLAGS();
data = cnt->get(TYPE_WIN::HISTORY);
cursor_position = cnt->get_cursor_position(TYPE_WIN::HISTORY);
selected_file = cnt->get_selected_file(TYPE_WIN::HISTORY);
}
void history::on_detach()
@@ -34,7 +34,6 @@ namespace rrr::layers::gui
pos.y += 9.f; // небольшой отступ сверху
ImGui::SetCursorPosY(pos.y);
int index = 0;
for (auto& item : *data)
{
ImGui::PushID(item.id);
@@ -44,24 +43,21 @@ namespace rrr::layers::gui
else
ImGui::PushStyleColor(ImGuiCol_Text, file_color);
if (cursor_position == index)
if (selected_file.path == item.path)
{
font = try_engine::style::fonts::get_font(font_type::SEMI_BOLD, 18);
ImGui::PushFont(font);
TR_PUSH_FONT(SEMI_BOLD, 18);
ImGui::TextUnformatted(">");
ImGui::SameLine(22.f);
}
else
{
ImGui::SetCursorPosX(pos.x);
font = try_engine::style::fonts::get_font(font_type::MEDIUM, 18);
ImGui::PushFont(font);
TR_PUSH_FONT(MEDIUM, 18);
}
ImGui::TextUnformatted(item.path.filename().string().data());
++index;
ImGui::PopFont();
TR_POP_FONT();
ImGui::PopStyleColor();
ImGui::PopID();
}
@@ -89,7 +85,7 @@ namespace rrr::layers::gui
{
case types::event_type::NAVIGATION_LEFT:
case types::event_type::NAVIGATION_RIGHT:
cursor_position = cnt->get_cursor_position(TYPE_WIN::HISTORY);
selected_file = cnt->get_selected_file(TYPE_WIN::HISTORY);
break;
default:
break;