mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-23 05:39:33 +01:00
Demo: Assets Browser: added a way to disable sorting and hide sorting options.
This is mostly designed to showcase that on very large sets (e.g. 1 million) most of the time is likely spent on sorting.
This commit is contained in:
parent
c07864f64a
commit
f472f17054
@ -9676,6 +9676,7 @@ struct ExampleAssetsBrowser
|
|||||||
{
|
{
|
||||||
// Options
|
// Options
|
||||||
bool ShowTypeOverlay = true;
|
bool ShowTypeOverlay = true;
|
||||||
|
bool AllowSorting = true;
|
||||||
bool AllowDragUnselected = false;
|
bool AllowDragUnselected = false;
|
||||||
bool AllowBoxSelect = true;
|
bool AllowBoxSelect = true;
|
||||||
float IconSize = 32.0f;
|
float IconSize = 32.0f;
|
||||||
@ -9778,6 +9779,7 @@ struct ExampleAssetsBrowser
|
|||||||
|
|
||||||
ImGui::SeparatorText("Contents");
|
ImGui::SeparatorText("Contents");
|
||||||
ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay);
|
ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay);
|
||||||
|
ImGui::Checkbox("Allow Sorting", &AllowSorting);
|
||||||
|
|
||||||
ImGui::SeparatorText("Selection Behavior");
|
ImGui::SeparatorText("Selection Behavior");
|
||||||
ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected);
|
ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected);
|
||||||
@ -9796,6 +9798,8 @@ struct ExampleAssetsBrowser
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show a table with ONLY one header row to showcase the idea/possibility of using this to provide a sorting UI
|
// Show a table with ONLY one header row to showcase the idea/possibility of using this to provide a sorting UI
|
||||||
|
if (AllowSorting)
|
||||||
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
ImGuiTableFlags table_flags_for_sort_specs = ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders;
|
ImGuiTableFlags table_flags_for_sort_specs = ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders;
|
||||||
if (ImGui::BeginTable("for_sort_specs_only", 2, table_flags_for_sort_specs, ImVec2(0.0f, ImGui::GetFrameHeight())))
|
if (ImGui::BeginTable("for_sort_specs_only", 2, table_flags_for_sort_specs, ImVec2(0.0f, ImGui::GetFrameHeight())))
|
||||||
@ -9812,6 +9816,7 @@ struct ExampleAssetsBrowser
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui::SetNextWindowContentSize(ImVec2(0.0f, LayoutOuterPadding + LayoutLineCount * (LayoutItemSize.x + LayoutItemSpacing)));
|
ImGui::SetNextWindowContentSize(ImVec2(0.0f, LayoutOuterPadding + LayoutLineCount * (LayoutItemSize.x + LayoutItemSpacing)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user