MCPcopy Create free account
hub / github.com/clementgallet/libTAS / ShowExampleAppDocuments

Function ShowExampleAppDocuments

src/external/imgui/imgui_demo.cpp:8271–8453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8269}
8270
8271void ShowExampleAppDocuments(bool* p_open)
8272{
8273 static ExampleAppDocuments app;
8274
8275 // Options
8276 static bool opt_reorderable = true;
8277 static ImGuiTabBarFlags opt_fitting_flags = ImGuiTabBarFlags_FittingPolicyDefault_;
8278
8279 bool window_contents_visible = ImGui::Begin("Example: Documents", p_open, ImGuiWindowFlags_MenuBar);
8280 if (!window_contents_visible)
8281 {
8282 ImGui::End();
8283 return;
8284 }
8285
8286 // Menu
8287 if (ImGui::BeginMenuBar())
8288 {
8289 if (ImGui::BeginMenu("File"))
8290 {
8291 int open_count = 0;
8292 for (MyDocument& doc : app.Documents)
8293 open_count += doc.Open ? 1 : 0;
8294
8295 if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
8296 {
8297 for (MyDocument& doc : app.Documents)
8298 if (!doc.Open && ImGui::MenuItem(doc.Name))
8299 doc.DoOpen();
8300 ImGui::EndMenu();
8301 }
8302 if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
8303 for (MyDocument& doc : app.Documents)
8304 doc.DoQueueClose();
8305 if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open)
8306 *p_open = false;
8307 ImGui::EndMenu();
8308 }
8309 ImGui::EndMenuBar();
8310 }
8311
8312 // [Debug] List documents with one checkbox for each
8313 for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
8314 {
8315 MyDocument& doc = app.Documents[doc_n];
8316 if (doc_n > 0)
8317 ImGui::SameLine();
8318 ImGui::PushID(&doc);
8319 if (ImGui::Checkbox(doc.Name, &doc.Open))
8320 if (!doc.Open)
8321 doc.DoForceClose();
8322 ImGui::PopID();
8323 }
8324
8325 ImGui::Separator();
8326
8327 // About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.
8328 // They have multiple effects:

Callers 1

ShowDemoWindowMethod · 0.85

Calls 8

ImVec2Function · 0.85
DoOpenMethod · 0.80
DoQueueCloseMethod · 0.80
DoForceCloseMethod · 0.80
DoSaveMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected