MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ShowExampleAppDocuments

Function ShowExampleAppDocuments

lib/imgui/imgui_demo.cpp:4706–4884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4704}
4705
4706void ShowExampleAppDocuments(bool* p_open)
4707{
4708 static ExampleAppDocuments app;
4709
4710 // Options
4711 static bool opt_reorderable = true;
4712 static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
4713
4714 bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
4715 if (!window_contents_visible)
4716 {
4717 ImGui::End();
4718 return;
4719 }
4720
4721 // Menu
4722 if (ImGui::BeginMenuBar())
4723 {
4724 if (ImGui::BeginMenu("File"))
4725 {
4726 int open_count = 0;
4727 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
4728 open_count += app.Documents[doc_n].Open ? 1 : 0;
4729
4730 if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
4731 {
4732 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
4733 {
4734 MyDocument* doc = &app.Documents[doc_n];
4735 if (!doc->Open)
4736 if (ImGui::MenuItem(doc->Name))
4737 doc->DoOpen();
4738 }
4739 ImGui::EndMenu();
4740 }
4741 if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
4742 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
4743 app.Documents[doc_n].DoQueueClose();
4744 if (ImGui::MenuItem("Exit", "Alt+F4")) {}
4745 ImGui::EndMenu();
4746 }
4747 ImGui::EndMenuBar();
4748 }
4749
4750 // [Debug] List documents with one checkbox for each
4751 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
4752 {
4753 MyDocument* doc = &app.Documents[doc_n];
4754 if (doc_n > 0)
4755 ImGui::SameLine();
4756 ImGui::PushID(doc);
4757 if (ImGui::Checkbox(doc->Name, &doc->Open))
4758 if (!doc->Open)
4759 doc->DoForceClose();
4760 ImGui::PopID();
4761 }
4762
4763 ImGui::Separator();

Callers 1

ShowDemoWindowMethod · 0.85

Calls 9

ImVec2Class · 0.85
DoOpenMethod · 0.80
DoQueueCloseMethod · 0.80
DoForceCloseMethod · 0.80
DoSaveMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected