| 10794 | } |
| 10795 | |
| 10796 | void Draw(const char* title, bool* p_open) |
| 10797 | { |
| 10798 | if (IconSize <= 0.0f) |
| 10799 | IconSize = ImGui::CalcTextSize("99999").x; |
| 10800 | |
| 10801 | ImGui::SetNextWindowSize(ImVec2(IconSize * 25, IconSize * 15), ImGuiCond_FirstUseEver); |
| 10802 | if (!ImGui::Begin(title, p_open, ImGuiWindowFlags_MenuBar)) |
| 10803 | { |
| 10804 | ImGui::End(); |
| 10805 | return; |
| 10806 | } |
| 10807 | IMGUI_DEMO_MARKER("Examples/Assets Browser"); |
| 10808 | |
| 10809 | // Menu bar |
| 10810 | if (ImGui::BeginMenuBar()) |
| 10811 | { |
| 10812 | if (ImGui::BeginMenu("File")) |
| 10813 | { |
| 10814 | if (ImGui::MenuItem("Add 10000 items")) |
| 10815 | AddItems(10000); |
| 10816 | if (ImGui::MenuItem("Clear items")) |
| 10817 | ClearItems(); |
| 10818 | ImGui::Separator(); |
| 10819 | if (ImGui::MenuItem("Close", NULL, false, p_open != NULL)) |
| 10820 | *p_open = false; |
| 10821 | ImGui::EndMenu(); |
| 10822 | } |
| 10823 | if (ImGui::BeginMenu("Edit")) |
| 10824 | { |
| 10825 | if (ImGui::MenuItem("Delete", "Del", false, Selection.Size > 0)) |
| 10826 | RequestDelete = true; |
| 10827 | ImGui::EndMenu(); |
| 10828 | } |
| 10829 | if (ImGui::BeginMenu("Options")) |
| 10830 | { |
| 10831 | ImGui::PushItemWidth(ImGui::GetFontSize() * 10); |
| 10832 | |
| 10833 | ImGui::SeparatorText("Contents"); |
| 10834 | ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay); |
| 10835 | ImGui::Checkbox("Allow Sorting", &AllowSorting); |
| 10836 | |
| 10837 | ImGui::SeparatorText("Selection Behavior"); |
| 10838 | ImGui::Checkbox("Allow box-selection", &AllowBoxSelect); |
| 10839 | if (ImGui::Checkbox("Allow box-selection from selected items", &AllowBoxSelectInsideSelection) && AllowBoxSelectInsideSelection) |
| 10840 | AllowDragUnselected = false; |
| 10841 | if (ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected) && AllowDragUnselected) |
| 10842 | AllowBoxSelectInsideSelection = false; |
| 10843 | |
| 10844 | ImGui::SeparatorText("Layout"); |
| 10845 | ImGui::SliderFloat("Icon Size", &IconSize, 16.0f, 128.0f, "%.0f"); |
| 10846 | ImGui::SameLine(); HelpMarker("Use Ctrl+Wheel to zoom"); |
| 10847 | ImGui::SliderInt("Icon Spacing", &IconSpacing, 0, 32); |
| 10848 | ImGui::SliderInt("Icon Hit Spacing", &IconHitSpacing, 0, 32); |
| 10849 | ImGui::Checkbox("Stretch Spacing", &StretchSpacing); |
| 10850 | ImGui::Checkbox("Use ScrollX", &UseScrollX); |
| 10851 | ImGui::PopItemWidth(); |
| 10852 | ImGui::EndMenu(); |
| 10853 | } |
no test coverage detected