MultiSelect: simplify clearing ImGuiMultiSelectTempData.
This commit is contained in:
+2
-2
@@ -1716,11 +1716,11 @@ struct ImGuiOldColumns
|
|||||||
// Temporary storage for multi-select
|
// Temporary storage for multi-select
|
||||||
struct IMGUI_API ImGuiMultiSelectTempData
|
struct IMGUI_API ImGuiMultiSelectTempData
|
||||||
{
|
{
|
||||||
|
ImGuiMultiSelectIO IO; // MUST BE FIRST FIELD. Requests are set and returned by BeginMultiSelect()/EndMultiSelect() + written to by user during the loop.
|
||||||
ImGuiMultiSelectState* Storage;
|
ImGuiMultiSelectState* Storage;
|
||||||
ImGuiID FocusScopeId; // Copied from g.CurrentFocusScopeId (unless another selection scope was pushed manually)
|
ImGuiID FocusScopeId; // Copied from g.CurrentFocusScopeId (unless another selection scope was pushed manually)
|
||||||
ImGuiMultiSelectFlags Flags;
|
ImGuiMultiSelectFlags Flags;
|
||||||
ImGuiKeyChord KeyMods;
|
ImGuiKeyChord KeyMods;
|
||||||
ImGuiMultiSelectIO IO; // Requests are set and returned by BeginMultiSelect()/EndMultiSelect() + written to by user during the loop.
|
|
||||||
bool LoopRequestClear;
|
bool LoopRequestClear;
|
||||||
bool LoopRequestSelectAll;
|
bool LoopRequestSelectAll;
|
||||||
bool IsEndIO; // Set when switching IO from BeginMultiSelect() to EndMultiSelect() state.
|
bool IsEndIO; // Set when switching IO from BeginMultiSelect() to EndMultiSelect() state.
|
||||||
@@ -1732,7 +1732,7 @@ struct IMGUI_API ImGuiMultiSelectTempData
|
|||||||
//ImRect Rect; // Extent of selection scope between BeginMultiSelect() / EndMultiSelect(), used by ImGuiMultiSelectFlags_ClearOnClickRectVoid.
|
//ImRect Rect; // Extent of selection scope between BeginMultiSelect() / EndMultiSelect(), used by ImGuiMultiSelectFlags_ClearOnClickRectVoid.
|
||||||
|
|
||||||
ImGuiMultiSelectTempData() { Clear(); }
|
ImGuiMultiSelectTempData() { Clear(); }
|
||||||
void Clear() { Storage = NULL; FocusScopeId = 0; Flags = 0; KeyMods = 0; IO.Clear(); IsEndIO = LoopRequestClear = LoopRequestSelectAll = IsFocused = IsSetRange = NavIdPassedBy = RangeSrcPassedBy = RangeDstPassedBy = false; }
|
void Clear() { size_t io_sz = sizeof(IO); IO.Clear(); memset((void*)(&IO + 1), 0, sizeof(*this) - io_sz); } // Zero-clear except IO
|
||||||
};
|
};
|
||||||
|
|
||||||
// Persistent storage for multi-select (as long as selection is alive)
|
// Persistent storage for multi-select (as long as selection is alive)
|
||||||
|
|||||||
@@ -7129,6 +7129,7 @@ ImGuiMultiSelectIO* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags)
|
|||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
ImGuiMultiSelectTempData* ms = &g.MultiSelectTempData[0];
|
ImGuiMultiSelectTempData* ms = &g.MultiSelectTempData[0];
|
||||||
IM_ASSERT(g.CurrentMultiSelect == NULL); // No recursion allowed yet (we could allow it if we deem it useful)
|
IM_ASSERT(g.CurrentMultiSelect == NULL); // No recursion allowed yet (we could allow it if we deem it useful)
|
||||||
|
IM_STATIC_ASSERT(offsetof(ImGuiMultiSelectTempData, IO) == 0); // Clear() relies on that.
|
||||||
g.CurrentMultiSelect = ms;
|
g.CurrentMultiSelect = ms;
|
||||||
|
|
||||||
// FIXME: BeginFocusScope()
|
// FIXME: BeginFocusScope()
|
||||||
|
|||||||
Reference in New Issue
Block a user