MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ShowExampleAppDocuments

Function ShowExampleAppDocuments

plugins/Cardinal/src/DearImGui/imgui_demo.cpp:7653–7842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7651}
7652
7653void ShowExampleAppDocuments(bool* p_open)
7654{
7655 static ExampleAppDocuments app;
7656
7657 // Options
7658 static bool opt_reorderable = true;
7659 static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
7660
7661 bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
7662 if (!window_contents_visible)
7663 {
7664 ImGui::End();
7665 return;
7666 }
7667
7668 // Menu
7669 if (ImGui::BeginMenuBar())
7670 {
7671 if (ImGui::BeginMenu("File"))
7672 {
7673 int open_count = 0;
7674 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
7675 open_count += app.Documents[doc_n].Open ? 1 : 0;
7676
7677 if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
7678 {
7679 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
7680 {
7681 MyDocument* doc = &app.Documents[doc_n];
7682 if (!doc->Open)
7683 if (ImGui::MenuItem(doc->Name))
7684 doc->DoOpen();
7685 }
7686 ImGui::EndMenu();
7687 }
7688 if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
7689 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
7690 app.Documents[doc_n].DoQueueClose();
7691 if (ImGui::MenuItem("Exit", "Alt+F4")) {}
7692 ImGui::EndMenu();
7693 }
7694 ImGui::EndMenuBar();
7695 }
7696
7697 // [Debug] List documents with one checkbox for each
7698 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
7699 {
7700 MyDocument* doc = &app.Documents[doc_n];
7701 if (doc_n > 0)
7702 ImGui::SameLine();
7703 ImGui::PushID(doc);
7704 if (ImGui::Checkbox(doc->Name, &doc->Open))
7705 if (!doc->Open)
7706 doc->DoForceClose();
7707 ImGui::PopID();
7708 }
7709
7710 ImGui::Separator();

Callers 1

ShowDemoWindowMethod · 0.85

Calls 11

MenuItemClass · 0.85
ImVec2Function · 0.85
ButtonClass · 0.85
DoOpenMethod · 0.80
DoQueueCloseMethod · 0.80
DoForceCloseMethod · 0.80
push_backMethod · 0.80
DoSaveMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected