Overlap: Internals: add NextItemData.ItemFlags to facilitate implementation of SetNextItemAllowOverlap() + potentially remove extra_flags from ItemAdd(). (#6512, #3909)

This commit is contained in:
ocornut
2023-06-26 13:46:40 +02:00
parent 07e24b4058
commit a9a5cbf431
4 changed files with 7 additions and 9 deletions

View File

@ -1163,10 +1163,8 @@ bool ImGui::CheckboxFlagsT(const char* label, T* flags, T flags_value)
if (!all_on && any_on)
{
ImGuiContext& g = *GImGui;
ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
g.CurrentItemFlags |= ImGuiItemFlags_MixedValue;
g.NextItemData.ItemFlags |= ImGuiItemFlags_MixedValue;
pressed = Checkbox(label, &all_on);
g.CurrentItemFlags = backup_item_flags;
}
else
{
@ -4959,11 +4957,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
{
// For focus requests to work on our multiline we need to ensure our child ItemAdd() call specifies the ImGuiItemFlags_Inputable (ref issue #4761)...
Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
g.CurrentItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
g.NextItemData.ItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
EndChild();
item_data_backup.StatusFlags |= (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredWindow);
g.CurrentItemFlags = backup_item_flags;
// ...and then we need to undo the group overriding last item data, which gets a bit messy as EndGroup() tries to forward scrollbar being active...
// FIXME: This quite messy/tricky, should attempt to get rid of the child window.