mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Updated style for file browser
This commit is contained in:
@@ -61,16 +61,16 @@ namespace Nuake
|
||||
|
||||
void FileSystemUI::EditorInterfaceDrawFiletree(Ref<Directory> dir)
|
||||
{
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_FramePadding;
|
||||
//if (is_selected)
|
||||
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
if (m_CurrentDirectory == dir)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
if (dir->Directories.size() <= 0)
|
||||
base_flags = ImGuiTreeNodeFlags_Leaf;
|
||||
base_flags |= ImGuiTreeNodeFlags_Leaf;
|
||||
|
||||
bool open = ImGui::TreeNodeEx(dir->name.c_str(), base_flags);
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + dir->name.c_str()).c_str(), base_flags);
|
||||
|
||||
if (ImGui::IsItemClicked())
|
||||
m_CurrentDirectory = dir;
|
||||
@@ -324,16 +324,19 @@ namespace Nuake
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
Splitter(true, 4.0f, &sz1, &sz2, 100, 8, avail.y);
|
||||
|
||||
if (ImGui::BeginChild("Tree browser", ImVec2(sz1, avail.y)))
|
||||
ImVec4* colors = ImGui::GetStyle().Colors;
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, colors[ImGuiCol_TitleBgCollapsed]);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 8);
|
||||
if (ImGui::BeginChild("Tree browser", ImVec2(sz1, avail.y), true))
|
||||
{
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_DefaultOpen;
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_DefaultOpen | ImGuiTreeNodeFlags_FramePadding;
|
||||
|
||||
bool is_selected = m_CurrentDirectory == FileSystem::RootDirectory;
|
||||
if (is_selected)
|
||||
base_flags |= ImGuiTreeNodeFlags_Selected;
|
||||
|
||||
std::string icon = ICON_FA_FOLDER;
|
||||
bool open = ImGui::TreeNodeEx((icon + " " + "Project files").c_str(), base_flags);
|
||||
bool open = ImGui::TreeNodeEx((icon + " Project files").c_str(), base_flags);
|
||||
if (ImGui::IsItemClicked())
|
||||
{
|
||||
m_CurrentDirectory = FileSystem::RootDirectory;
|
||||
@@ -348,6 +351,8 @@ namespace Nuake
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndChild();
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -368,31 +373,82 @@ namespace Nuake
|
||||
if (ImGui::BeginChild("Wrapper", avail))
|
||||
{
|
||||
avail.y = 30;
|
||||
if (ImGui::BeginChild("Path", avail))
|
||||
if (ImGui::BeginChild("Path", avail, true))
|
||||
{
|
||||
if (ImGui::Button("Refresh"))
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||
|
||||
const auto buttonSize = ImVec2(24, 24);
|
||||
std::string refreshIcon = ICON_FA_SYNC_ALT;
|
||||
if (ImGui::Button((refreshIcon).c_str(), buttonSize))
|
||||
{
|
||||
RefreshFileBrowser();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button((std::string(ICON_FA_ANGLE_LEFT)).c_str(), buttonSize))
|
||||
{
|
||||
if (m_CurrentDirectory != FileSystem::RootDirectory)
|
||||
{
|
||||
m_CurrentDirectory = m_CurrentDirectory->Parent;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button((std::string(ICON_FA_ANGLE_RIGHT)).c_str(), buttonSize))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, colors[ImGuiCol_TitleBgCollapsed]);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4));
|
||||
ImGui::BeginChild("pathBrowser", ImVec2(ImGui::GetContentRegionAvailWidth(), 24));
|
||||
for (int i = paths.size() - 1; i > 0; i--)
|
||||
{
|
||||
if (i != paths.size())
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(paths[i]->name.c_str()))
|
||||
std::string pathLabel;
|
||||
if (i == paths.size() - 1)
|
||||
{
|
||||
pathLabel = "Project files";
|
||||
}
|
||||
else
|
||||
{
|
||||
pathLabel = paths[i]->name;
|
||||
}
|
||||
|
||||
if (ImGui::Button(pathLabel.c_str()))
|
||||
{
|
||||
m_CurrentDirectory = paths[i];
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("/");
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
ImGui::GetWindowDrawList()->AddLine(ImVec2(ImGui::GetCursorPosX(), ImGui::GetCursorPosY()), ImVec2(ImGui::GetContentRegionAvailWidth(), ImGui::GetCursorPosY()), IM_COL32(255, 0, 0, 255), 1.0f);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0, 0));
|
||||
avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
if (ImGui::BeginChild("Content", avail))
|
||||
bool child = ImGui::BeginChild("Content", avail);
|
||||
ImGui::PopStyleVar();
|
||||
if (child)
|
||||
{
|
||||
int width = avail.x;
|
||||
ImVec2 buttonSize = ImVec2(80, 80);
|
||||
|
||||
@@ -240,8 +240,10 @@ namespace Nuake
|
||||
s.FrameRounding = 2.0f;
|
||||
s.GrabRounding = 2.0f;
|
||||
s.CellPadding = ImVec2(8, 8);
|
||||
s.WindowPadding = ImVec2(8, 8);
|
||||
s.WindowPadding = ImVec2(2, 2);
|
||||
s.ScrollbarRounding = 9.0f;
|
||||
s.ScrollbarSize = 15.0f;
|
||||
s.GrabMinSize = 32.0f;
|
||||
s.TabRounding = 0;
|
||||
s.WindowRounding = 0;
|
||||
s.ChildRounding = 0;
|
||||
@@ -252,6 +254,7 @@ namespace Nuake
|
||||
s.ItemInnerSpacing = ImVec2(4, 4);
|
||||
s.TabRounding = 4.0f;
|
||||
s.WindowBorderSize = 0.0f;
|
||||
s.IndentSpacing = 12.0f;
|
||||
s.ChildBorderSize = 0.0f;
|
||||
|
||||
ImVec4* colors = ImGui::GetStyle().Colors;
|
||||
@@ -269,7 +272,7 @@ namespace Nuake
|
||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
|
||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.00f);
|
||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.34f, 0.34f, 0.34f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.29f, 0.29f, 0.29f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.16f, 0.16f, 0.16f, 1.00f);
|
||||
|
||||
Reference in New Issue
Block a user