mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-31 03:53:44 +01:00
MultiSelect: move HasSelectionData to ImGuiItemFlags to facilitate copying around in standardized fieds.
Required/motivated to simplify support for ImGuiTreeNodeFlags_NavLeftJumpsBackHere (bc3c0ce) in this branch.
This commit is contained in:
parent
e82b49d2d4
commit
c9eb3714e8
@ -1211,15 +1211,14 @@ enum ImGuiNextItemDataFlags_
|
|||||||
ImGuiNextItemDataFlags_HasOpen = 1 << 1,
|
ImGuiNextItemDataFlags_HasOpen = 1 << 1,
|
||||||
ImGuiNextItemDataFlags_HasShortcut = 1 << 2,
|
ImGuiNextItemDataFlags_HasShortcut = 1 << 2,
|
||||||
ImGuiNextItemDataFlags_HasRefVal = 1 << 3,
|
ImGuiNextItemDataFlags_HasRefVal = 1 << 3,
|
||||||
ImGuiNextItemDataFlags_HasSelectionData = 1 << 4,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiNextItemData
|
struct ImGuiNextItemData
|
||||||
{
|
{
|
||||||
ImGuiNextItemDataFlags Flags;
|
ImGuiNextItemDataFlags Flags;
|
||||||
ImGuiItemFlags ItemFlags; // Currently only tested/used for ImGuiItemFlags_AllowOverlap.
|
ImGuiItemFlags ItemFlags; // Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData.
|
||||||
// Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem()
|
// Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem()
|
||||||
ImGuiID FocusScopeId; // Set by SetNextItemSelectionUserData() (!= 0 signify value has been set)
|
ImGuiID FocusScopeId; // Set by SetNextItemSelectionUserData()
|
||||||
ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
|
ImGuiSelectionUserData SelectionUserData; // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
|
||||||
float Width; // Set by SetNextItemWidth()
|
float Width; // Set by SetNextItemWidth()
|
||||||
ImGuiKeyChord Shortcut; // Set by SetNextItemShortcut()
|
ImGuiKeyChord Shortcut; // Set by SetNextItemShortcut()
|
||||||
|
@ -6390,8 +6390,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
||||||
|
const bool is_multi_select = (g.NextItemData.ItemFlags & ImGuiItemFlags_IsMultiSelect) != 0; // Before ItemAdd()
|
||||||
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
||||||
const bool is_multi_select = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasSelectionData) != 0; // Before ItemAdd()
|
|
||||||
bool item_add = ItemAdd(interact_bb, id);
|
bool item_add = ItemAdd(interact_bb, id);
|
||||||
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;
|
||||||
g.LastItemData.DisplayRect = frame_bb;
|
g.LastItemData.DisplayRect = frame_bb;
|
||||||
@ -6780,7 +6780,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool disabled_item = (flags & ImGuiSelectableFlags_Disabled) != 0;
|
const bool disabled_item = (flags & ImGuiSelectableFlags_Disabled) != 0;
|
||||||
const bool is_multi_select = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasSelectionData) != 0; // Before ItemAdd()
|
const bool is_multi_select = (g.NextItemData.ItemFlags & ImGuiItemFlags_IsMultiSelect) != 0; // Before ItemAdd()
|
||||||
const bool item_add = ItemAdd(bb, id, NULL, disabled_item ? (ImGuiItemFlags)ImGuiItemFlags_Disabled : ImGuiItemFlags_None);
|
const bool item_add = ItemAdd(bb, id, NULL, disabled_item ? (ImGuiItemFlags)ImGuiItemFlags_Disabled : ImGuiItemFlags_None);
|
||||||
|
|
||||||
if (span_all_columns)
|
if (span_all_columns)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user