add style and base navigation
This commit is contained in:
@@ -5,6 +5,9 @@ namespace rrr::layers::gui
|
||||
void history::on_attach()
|
||||
{
|
||||
BASE_WINDOW_FLAGS();
|
||||
|
||||
data = cnt->get(TYPE_WIN::HISTORY);
|
||||
cursor_position = cnt->get_cursor_position(TYPE_WIN::HISTORY);
|
||||
}
|
||||
|
||||
void history::on_detach()
|
||||
@@ -17,8 +20,47 @@ namespace rrr::layers::gui
|
||||
ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y));
|
||||
ImGui::SetNextWindowSize(ImVec2(width, height));
|
||||
|
||||
ImGuiStyle& st = ImGui::GetStyle();
|
||||
st.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.14f, 0.18f, 1.00f);
|
||||
|
||||
BEGIN_IMGUI_WIN();
|
||||
|
||||
auto pos = ImGui::GetCursorPos();
|
||||
pos.x += 17.f;
|
||||
pos.y += 9.f; // небольшой отступ сверху
|
||||
ImGui::SetCursorPosY(pos.y);
|
||||
|
||||
int index = 0;
|
||||
for (auto& item : *data)
|
||||
{
|
||||
ImGui::PushID(item.id);
|
||||
|
||||
if (item.type == file_type::DIR)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, dir_color);
|
||||
else
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, file_color);
|
||||
|
||||
if (cursor_position == index)
|
||||
{
|
||||
font = try_engine::style::fonts::get_font(font_type::SEMI_BOLD, 18);
|
||||
ImGui::PushFont(font);
|
||||
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);
|
||||
}
|
||||
|
||||
ImGui::TextUnformatted(item.path.filename().string().data());
|
||||
++index;
|
||||
|
||||
ImGui::PopFont();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
END_IMGUI_WIN();
|
||||
}
|
||||
@@ -26,10 +68,13 @@ namespace rrr::layers::gui
|
||||
void history::on_event(system_event& e)
|
||||
{
|
||||
if (e.get_name() == try_engine::system_event::classificator::WINDOW_RESIZE())
|
||||
{
|
||||
height = try_engine::application::get()->get_window()->height() - 40.f;
|
||||
width = try_engine::application::get()->get_window()->width() / 3.f;
|
||||
}
|
||||
resize();
|
||||
}
|
||||
|
||||
void history::resize()
|
||||
{
|
||||
height = try_engine::application::get()->get_window()->height();
|
||||
width = try_engine::application::get()->get_window()->width() / 3.f;
|
||||
}
|
||||
|
||||
void history::on_event(std::any e, std::any value)
|
||||
|
||||
Reference in New Issue
Block a user