MCPcopy Create free account
hub / github.com/cinder/Cinder / Draw

Method Draw

src/imgui/imgui_demo.cpp:10565–10835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10563 }
10564
10565 void Draw(const char* title, bool* p_open)
10566 {
10567 ImGui::SetNextWindowSize(ImVec2(IconSize * 25, IconSize * 15), ImGuiCond_FirstUseEver);
10568 if (!ImGui::Begin(title, p_open, ImGuiWindowFlags_MenuBar))
10569 {
10570 ImGui::End();
10571 return;
10572 }
10573
10574 // Menu bar
10575 if (ImGui::BeginMenuBar())
10576 {
10577 if (ImGui::BeginMenu("File"))
10578 {
10579 if (ImGui::MenuItem("Add 10000 items"))
10580 AddItems(10000);
10581 if (ImGui::MenuItem("Clear items"))
10582 ClearItems();
10583 ImGui::Separator();
10584 if (ImGui::MenuItem("Close", NULL, false, p_open != NULL))
10585 *p_open = false;
10586 ImGui::EndMenu();
10587 }
10588 if (ImGui::BeginMenu("Edit"))
10589 {
10590 if (ImGui::MenuItem("Delete", "Del", false, Selection.Size > 0))
10591 RequestDelete = true;
10592 ImGui::EndMenu();
10593 }
10594 if (ImGui::BeginMenu("Options"))
10595 {
10596 ImGui::PushItemWidth(ImGui::GetFontSize() * 10);
10597
10598 ImGui::SeparatorText("Contents");
10599 ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay);
10600 ImGui::Checkbox("Allow Sorting", &AllowSorting);
10601
10602 ImGui::SeparatorText("Selection Behavior");
10603 ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected);
10604 ImGui::Checkbox("Allow box-selection", &AllowBoxSelect);
10605
10606 ImGui::SeparatorText("Layout");
10607 ImGui::SliderFloat("Icon Size", &IconSize, 16.0f, 128.0f, "%.0f");
10608 ImGui::SameLine(); HelpMarker("Use CTRL+Wheel to zoom");
10609 ImGui::SliderInt("Icon Spacing", &IconSpacing, 0, 32);
10610 ImGui::SliderInt("Icon Hit Spacing", &IconHitSpacing, 0, 32);
10611 ImGui::Checkbox("Stretch Spacing", &StretchSpacing);
10612 ImGui::PopItemWidth();
10613 ImGui::EndMenu();
10614 }
10615 ImGui::EndMenuBar();
10616 }
10617
10618 // Show a table with ONLY one header row to showcase the idea/possibility of using this to provide a sorting UI
10619 if (AllowSorting)
10620 {
10621 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
10622 ImGuiTableFlags table_flags_for_sort_specs = ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders;

Callers 8

ShowStyleEditorMethod · 0.45
DrawFunction · 0.45
ShowExampleAppConsoleFunction · 0.45
ShowExampleAppLogFunction · 0.45

Calls 14

ImVec2Function · 0.85
HelpMarkerFunction · 0.85
ApplyRequestsMethod · 0.80
ApplyDeletionPreLoopMethod · 0.80
BeginMethod · 0.80
IncludeItemByIndexMethod · 0.80
GetNextSelectedItemMethod · 0.80
AddRectFilledMethod · 0.80
AddTextMethod · 0.80
EndMethod · 0.80
ApplyDeletionPostLoopMethod · 0.80
StepMethod · 0.45

Tested by

no test coverage detected