| 10892 | } |
| 10893 | |
| 10894 | void Draw(const char* title, bool* p_open) |
| 10895 | { |
| 10896 | if (IconSize <= 0.0f) |
| 10897 | IconSize = ImGui::CalcTextSize("99999").x; |
| 10898 | |
| 10899 | ImGui::SetNextWindowSize(ImVec2(IconSize * 25, IconSize * 15), ImGuiCond_FirstUseEver); |
| 10900 | if (!ImGui::Begin(title, p_open, ImGuiWindowFlags_MenuBar)) |
| 10901 | { |
| 10902 | ImGui::End(); |
| 10903 | return; |
| 10904 | } |
| 10905 | IMGUI_DEMO_MARKER("Examples/Assets Browser"); |
| 10906 | |
| 10907 | // Menu bar |
| 10908 | if (ImGui::BeginMenuBar()) |
| 10909 | { |
| 10910 | if (ImGui::BeginMenu("File")) |
| 10911 | { |
| 10912 | if (ImGui::MenuItem("Add 10000 items")) |
| 10913 | AddItems(10000); |
| 10914 | if (ImGui::MenuItem("Clear items")) |
| 10915 | ClearItems(); |
| 10916 | ImGui::Separator(); |
| 10917 | if (ImGui::MenuItem("Close", NULL, false, p_open != NULL)) |
| 10918 | *p_open = false; |
| 10919 | ImGui::EndMenu(); |
| 10920 | } |
| 10921 | if (ImGui::BeginMenu("Edit")) |
| 10922 | { |
| 10923 | if (ImGui::MenuItem("Delete", "Del", false, Selection.Size > 0)) |
| 10924 | RequestDelete = true; |
| 10925 | ImGui::EndMenu(); |
| 10926 | } |
| 10927 | if (ImGui::BeginMenu("Options")) |
| 10928 | { |
| 10929 | ImGui::PushItemWidth(ImGui::GetFontSize() * 10); |
| 10930 | |
| 10931 | ImGui::SeparatorText("Contents"); |
| 10932 | ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay); |
| 10933 | ImGui::Checkbox("Allow Sorting", &AllowSorting); |
| 10934 | |
| 10935 | ImGui::SeparatorText("Selection Behavior"); |
| 10936 | ImGui::Checkbox("Allow box-selection", &AllowBoxSelect); |
| 10937 | if (ImGui::Checkbox("Allow box-selection from selected items", &AllowBoxSelectInsideSelection) && AllowBoxSelectInsideSelection) |
| 10938 | AllowDragUnselected = false; |
| 10939 | if (ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected) && AllowDragUnselected) |
| 10940 | AllowBoxSelectInsideSelection = false; |
| 10941 | |
| 10942 | ImGui::SeparatorText("Layout"); |
| 10943 | ImGui::SliderFloat("Icon Size", &IconSize, 16.0f, 128.0f, "%.0f"); |
| 10944 | ImGui::SameLine(); HelpMarker("Use Ctrl+Wheel to zoom"); |
| 10945 | ImGui::SliderInt("Icon Spacing", &IconSpacing, 0, 32); |
| 10946 | ImGui::SliderInt("Icon Hit Spacing", &IconHitSpacing, 0, 32); |
| 10947 | ImGui::Checkbox("Stretch Spacing", &StretchSpacing); |
| 10948 | ImGui::Checkbox("Use ScrollX", &UseScrollX); |
| 10949 | ImGui::PopItemWidth(); |
| 10950 | ImGui::EndMenu(); |
| 10951 | } |
no test coverage detected