MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / ShowExampleAppDocuments

Function ShowExampleAppDocuments

Source/3rdParty/imgui/imgui_demo.cpp:10475–10671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10473};
10474
10475void ShowExampleAppDocuments(bool* p_open)
10476{
10477 static ExampleAppDocuments app;
10478
10479 // Options
10480 static bool opt_reorderable = true;
10481 static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
10482
10483 bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
10484 if (!window_contents_visible)
10485 {
10486 ImGui::End();
10487 return;
10488 }
10489 IMGUI_DEMO_MARKER("Examples/Documents");
10490
10491 // Menu
10492 if (ImGui::BeginMenuBar())
10493 {
10494 if (ImGui::BeginMenu("File"))
10495 {
10496 int open_count = 0;
10497 for (MyDocument& doc : app.Documents)
10498 open_count += doc.Open ? 1 : 0;
10499
10500 if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
10501 {
10502 for (MyDocument& doc : app.Documents)
10503 if (!doc.Open && ImGui::MenuItem(doc.Name))
10504 doc.DoOpen();
10505 ImGui::EndMenu();
10506 }
10507 if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
10508 for (MyDocument& doc : app.Documents)
10509 app.CloseQueue.push_back(&doc);
10510 if (ImGui::MenuItem("Exit") && p_open)
10511 *p_open = false;
10512 ImGui::EndMenu();
10513 }
10514 ImGui::EndMenuBar();
10515 }
10516
10517 // [Debug] List documents with one checkbox for each
10518 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
10519 {
10520 MyDocument& doc = app.Documents[doc_n];
10521 if (doc_n > 0)
10522 ImGui::SameLine();
10523 ImGui::PushID(&doc);
10524 if (ImGui::Checkbox(doc.Name, &doc.Open))
10525 if (!doc.Open)
10526 doc.DoForceClose();
10527 ImGui::PopID();
10528 }
10529
10530 ImGui::Separator();
10531
10532 // About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

EndFunction · 0.85
BeginMenuFunction · 0.85
MenuItemFunction · 0.85
PushIDFunction · 0.85
CheckboxFunction · 0.85
SeparatorFunction · 0.85
BeginTabBarFunction · 0.85
BeginTabItemFunction · 0.85
OpenPopupFunction · 0.85
BeginPopupFunction · 0.85
InputTextFunction · 0.85
BeginPopupModalFunction · 0.85

Tested by

no test coverage detected