MCPcopy Create free account
hub / github.com/chrxh/alien / processFolderTreeSymbols

Method processFolderTreeSymbols

source/Gui/BrowserWindow.cpp:975–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973}
974
975bool BrowserWindow::processFolderTreeSymbols(NetworkResourceTreeTO const& treeTO, std::set<std::vector<std::string>>& collapsedFolderNames)
976{
977 auto result = false;
978 ImGui::PushStyleColor(ImGuiCol_Text, (ImU32)Const::BrowserResourceSymbolColor);
979 ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(0, 0, 0, 0));
980 auto const& treeSymbols = treeTO->treeSymbols;
981 for (auto const& folderLine : treeSymbols) {
982 ImVec2 pos = ImGui::GetCursorScreenPos();
983 ImGuiStyle& style = ImGui::GetStyle();
984 switch (folderLine) {
985 case FolderTreeSymbols::Expanded: {
986 if (AlienImGui::Button(ICON_FA_MINUS_SQUARE, 20.0f)) {
987 collapsedFolderNames.insert(treeTO->folderNames);
988 result = true;
989 }
990 } break;
991 case FolderTreeSymbols::Collapsed: {
992 if (AlienImGui::Button(ICON_FA_PLUS_SQUARE, 20.0f)) {
993 collapsedFolderNames.erase(treeTO->folderNames);
994 result = true;
995 }
996 } break;
997 case FolderTreeSymbols::Continue: {
998 ImGui::GetWindowDrawList()->AddRectFilled(
999 ImVec2(pos.x + style.FramePadding.x + scale(6.0f), pos.y),
1000 ImVec2(pos.x + style.FramePadding.x + scale(7.5f), pos.y + scale(RowHeight) + style.FramePadding.y),
1001 Const::BrowserResourceLineColor);
1002 ImGui::Dummy({scale(20.0f), 0});
1003 } break;
1004 case FolderTreeSymbols::Branch: {
1005 ImGui::GetWindowDrawList()->AddRectFilled(
1006 ImVec2(pos.x + style.FramePadding.x + scale(6.0f), pos.y),
1007 ImVec2(pos.x + style.FramePadding.x + scale(7.5f), pos.y + scale(RowHeight) + style.FramePadding.y),
1008 Const::BrowserResourceLineColor);
1009 ImGui::GetWindowDrawList()->AddRectFilled(
1010 ImVec2(pos.x + style.FramePadding.x + scale(7.5f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y),
1011 ImVec2(pos.x + style.FramePadding.x + scale(20.0f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y + scale(1.5f)),
1012 Const::BrowserResourceLineColor);
1013 ImGui::GetWindowDrawList()->AddRectFilled(
1014 ImVec2(pos.x + style.FramePadding.x + scale(20.0f - 0.5f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y - scale(0.5f)),
1015 ImVec2(pos.x + style.FramePadding.x + scale(20.0f + 2.0f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y + scale(2.0f)),
1016 Const::BrowserResourceLineColor);
1017 ImGui::Dummy({scale(20.0f), 0});
1018 } break;
1019 case FolderTreeSymbols::End: {
1020 ImGui::GetWindowDrawList()->AddRectFilled(
1021 ImVec2(pos.x + style.FramePadding.x + scale(6.0f), pos.y),
1022 ImVec2(pos.x + style.FramePadding.x + scale(7.5f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y + scale(1.5f)),
1023 Const::BrowserResourceLineColor);
1024 ImGui::GetWindowDrawList()->AddRectFilled(
1025 ImVec2(pos.x + style.FramePadding.x + scale(7.5f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y),
1026 ImVec2(pos.x + style.FramePadding.x + scale(20.0f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y + scale(1.5f)),
1027 Const::BrowserResourceLineColor);
1028 ImGui::GetWindowDrawList()->AddRectFilled(
1029 ImVec2(pos.x + style.FramePadding.x + scale(20.0f - 0.5f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y - scale(0.5f)),
1030 ImVec2(pos.x + style.FramePadding.x + scale(20.0f + 2.0f), pos.y + scale(RowHeight) / 2 - style.FramePadding.y + scale(2.0f)),
1031 Const::BrowserResourceLineColor);
1032 ImGui::Dummy({scale(20.0f), 0});

Callers

nothing calls this directly

Calls 2

ImVec2Class · 0.85
scaleFunction · 0.85

Tested by

no test coverage detected