| 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; |
no test coverage detected