MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ShowExampleAppDocuments

Function ShowExampleAppDocuments

3rdparty/imgui/src/imgui_demo.cpp:10573–10769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10571};
10572
10573void ShowExampleAppDocuments(bool* p_open)
10574{
10575 static ExampleAppDocuments app;
10576
10577 // Options
10578 static bool opt_reorderable = true;
10579 static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
10580
10581 bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
10582 if (!window_contents_visible)
10583 {
10584 ImGui::End();
10585 return;
10586 }
10587 IMGUI_DEMO_MARKER("Examples/Documents");
10588
10589 // Menu
10590 if (ImGui::BeginMenuBar())
10591 {
10592 if (ImGui::BeginMenu("File"))
10593 {
10594 int open_count = 0;
10595 for (MyDocument& doc : app.Documents)
10596 open_count += doc.Open ? 1 : 0;
10597
10598 if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
10599 {
10600 for (MyDocument& doc : app.Documents)
10601 if (!doc.Open && ImGui::MenuItem(doc.Name))
10602 doc.DoOpen();
10603 ImGui::EndMenu();
10604 }
10605 if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
10606 for (MyDocument& doc : app.Documents)
10607 app.CloseQueue.push_back(&doc);
10608 if (ImGui::MenuItem("Exit") && p_open)
10609 *p_open = false;
10610 ImGui::EndMenu();
10611 }
10612 ImGui::EndMenuBar();
10613 }
10614
10615 // [Debug] List documents with one checkbox for each
10616 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
10617 {
10618 MyDocument& doc = app.Documents[doc_n];
10619 if (doc_n > 0)
10620 ImGui::SameLine();
10621 ImGui::PushID(&doc);
10622 if (ImGui::Checkbox(doc.Name, &doc.Open))
10623 if (!doc.Open)
10624 doc.DoForceClose();
10625 ImGui::PopID();
10626 }
10627
10628 ImGui::Separator();
10629
10630 // About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.

Callers 1

ShowDemoWindowMethod · 0.85

Calls 13

BeginFunction · 0.85
EndFunction · 0.85
DoOpenMethod · 0.80
DoForceCloseMethod · 0.80
GetTabNameMethod · 0.80
DisplayDocContextMenuMethod · 0.80
DisplayDocContentsMethod · 0.80
DoSaveMethod · 0.80
ImVec2Function · 0.50
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected