MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / m_DrawPlacesPane

Method m_DrawPlacesPane

external/ImGuiFileDialog/ImGuiFileDialog.cpp:3231–3324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3229}
3230
3231bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogInternal, const ImVec2& vSize) {
3232 bool res = false;
3233 ImGui::BeginChild("##placespane", vSize);
3234 for (const auto& group : m_OrderedGroups) {
3235 auto group_ptr = group.second.lock();
3236 if (group_ptr != nullptr) {
3237 if (ImGui::CollapsingHeader(group_ptr->name.c_str(), group_ptr->collapsingHeaderFlag)) {
3238 ImGui::BeginChild(group_ptr->name.c_str(), ImVec2(0, 0), ImGuiChildFlags_AutoResizeY);
3239 if (group_ptr->canBeEdited) {
3240 ImGui::PushID(group_ptr.get());
3241 if (IMGUI_BUTTON(addPlaceButtonString "##ImGuiFileDialogAddPlace")) {
3242 if (!vFileDialogInternal.fileManager.IsComposerEmpty()) {
3243 group_ptr->AddPlace(vFileDialogInternal.fileManager.GetBack(), vFileDialogInternal.fileManager.GetCurrentPath(), true);
3244 }
3245 }
3246 if (group_ptr->selectedPlaceForEdition >= 0 && group_ptr->selectedPlaceForEdition < (int)group_ptr->places.size()) {
3247 ImGui::SameLine();
3248 if (IMGUI_BUTTON(removePlaceButtonString "##ImGuiFileDialogRemovePlace")) {
3249 group_ptr->places.erase(group_ptr->places.begin() + group_ptr->selectedPlaceForEdition);
3250 if (group_ptr->selectedPlaceForEdition == (int)group_ptr->places.size()) {
3251 --group_ptr->selectedPlaceForEdition;
3252 }
3253 }
3254 if (group_ptr->selectedPlaceForEdition >= 0 && group_ptr->selectedPlaceForEdition < (int)group_ptr->places.size()) {
3255 ImGui::SameLine();
3256 if (IMGUI_BUTTON(validatePlaceButtonString "##ImGuiFileDialogOkPlace")) {
3257 group_ptr->places[(size_t)group_ptr->selectedPlaceForEdition].name = std::string(group_ptr->editBuffer);
3258 group_ptr->selectedPlaceForEdition = -1;
3259 }
3260 ImGui::SameLine();
3261 ImGui::PushItemWidth(vSize.x - ImGui::GetCursorPosX());
3262 if (ImGui::InputText("##ImGuiFileDialogPlaceEdit", group_ptr->editBuffer, MAX_FILE_DIALOG_NAME_BUFFER)) {
3263 group_ptr->places[(size_t)group_ptr->selectedPlaceForEdition].name = std::string(group_ptr->editBuffer);
3264 }
3265 ImGui::PopItemWidth();
3266 }
3267 }
3268 ImGui::PopID();
3269 ImGui::Separator();
3270 }
3271 if (!group_ptr->places.empty()) {
3272 const auto& current_path = vFileDialogInternal.fileManager.GetCurrentPath();
3273 group_ptr->clipper.Begin((int)group_ptr->places.size(), ImGui::GetTextLineHeightWithSpacing());
3274 while (group_ptr->clipper.Step()) {
3275 for (int i = group_ptr->clipper.DisplayStart; i < group_ptr->clipper.DisplayEnd; i++) {
3276 if (i < 0) {
3277 continue;
3278 }
3279 const PlaceStruct& place = group_ptr->places[(size_t)i];
3280 if (place.thickness > 0.0f) {
3281 ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal, place.thickness);
3282 } else {
3283 ImGui::PushID(i);
3284 std::string place_name = place.name;
3285 if (!place.style.icon.empty()) {
3286 place_name = place.style.icon + " " + place_name;
3287 }
3288 if (group_ptr->canBeEdited) {

Callers

nothing calls this directly

Calls 15

ImVec2Function · 0.85
ImVec4Class · 0.85
c_strMethod · 0.80
IsComposerEmptyMethod · 0.80
AddPlaceMethod · 0.80
GetBackMethod · 0.80
GetCurrentPathMethod · 0.80
eraseMethod · 0.80
BeginMethod · 0.80
SetCurrentPathMethod · 0.80
OpenCurrentPathMethod · 0.80
EndMethod · 0.80

Tested by

no test coverage detected