mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08:00
Internals: rename ImGuiLastItemData::InFlags -> ItemFlags. ImGuiNextItemData::Flags -> HasFlags to avoid mistakes.
This commit is contained in:
parent
706438a43c
commit
e6b5cafe65
42
imgui.cpp
42
imgui.cpp
@ -3702,7 +3702,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl
|
||||
return;
|
||||
if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw))
|
||||
return;
|
||||
if (id == g.LastItemData.ID && (g.LastItemData.InFlags & ImGuiItemFlags_NoNav))
|
||||
if (id == g.LastItemData.ID && (g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
|
||||
return;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (window->DC.NavHideHighlightOneFrame)
|
||||
@ -4448,7 +4448,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
{
|
||||
if (!IsItemFocused())
|
||||
return false;
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
||||
if ((g.LastItemData.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
||||
return false;
|
||||
|
||||
if (flags & ImGuiHoveredFlags_ForTooltip)
|
||||
@ -4483,11 +4483,11 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
|
||||
// Test if interactions on this window are blocked by an active popup or modal.
|
||||
// The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.
|
||||
if (!IsWindowContentHoverable(window, flags) && !(g.LastItemData.InFlags & ImGuiItemFlags_NoWindowHoverableCheck))
|
||||
if (!IsWindowContentHoverable(window, flags) && !(g.LastItemData.ItemFlags & ImGuiItemFlags_NoWindowHoverableCheck))
|
||||
return false;
|
||||
|
||||
// Test if the item is disabled
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
||||
if ((g.LastItemData.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
|
||||
return false;
|
||||
|
||||
// Special handling for calling after Begin() which represent the title bar or tab.
|
||||
@ -4497,7 +4497,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
return false;
|
||||
|
||||
// Test if using AllowOverlap and overlapped
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap) && id != 0)
|
||||
if ((g.LastItemData.ItemFlags & ImGuiItemFlags_AllowOverlap) && id != 0)
|
||||
if ((flags & ImGuiHoveredFlags_AllowWhenOverlappedByItem) == 0)
|
||||
if (g.HoveredIdPreviousFrame != g.LastItemData.ID)
|
||||
return false;
|
||||
@ -4640,7 +4640,7 @@ void ImGui::SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemS
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.LastItemData.ID = item_id;
|
||||
g.LastItemData.InFlags = in_flags;
|
||||
g.LastItemData.ItemFlags = in_flags;
|
||||
g.LastItemData.StatusFlags = item_flags;
|
||||
g.LastItemData.Rect = g.LastItemData.NavRect = item_rect;
|
||||
}
|
||||
@ -10280,7 +10280,7 @@ bool ImGui::IsKeyChordPressed(ImGuiKeyChord key_chord, ImGuiInputFlags flags, Im
|
||||
void ImGui::SetNextItemShortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasShortcut;
|
||||
g.NextItemData.HasFlags |= ImGuiNextItemDataFlags_HasShortcut;
|
||||
g.NextItemData.Shortcut = key_chord;
|
||||
g.NextItemData.ShortcutFlags = flags;
|
||||
}
|
||||
@ -10292,7 +10292,7 @@ void ImGui::ItemHandleShortcut(ImGuiID id)
|
||||
ImGuiInputFlags flags = g.NextItemData.ShortcutFlags;
|
||||
IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetNextItemShortcut) == 0); // Passing flags not supported by SetNextItemShortcut()!
|
||||
|
||||
if (g.LastItemData.InFlags & ImGuiItemFlags_Disabled)
|
||||
if (g.LastItemData.ItemFlags & ImGuiItemFlags_Disabled)
|
||||
return;
|
||||
if (flags & ImGuiInputFlags_Tooltip)
|
||||
{
|
||||
@ -10784,7 +10784,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
g.LastItemData.ID = id;
|
||||
g.LastItemData.Rect = bb;
|
||||
g.LastItemData.NavRect = nav_bb_arg ? *nav_bb_arg : bb;
|
||||
g.LastItemData.InFlags = g.CurrentItemFlags | g.NextItemData.ItemFlags | extra_flags;
|
||||
g.LastItemData.ItemFlags = g.CurrentItemFlags | g.NextItemData.ItemFlags | extra_flags;
|
||||
g.LastItemData.StatusFlags = ImGuiItemStatusFlags_None;
|
||||
// Note: we don't copy 'g.NextItemData.SelectionUserData' to an hypothetical g.LastItemData.SelectionUserData: since the former is not cleared.
|
||||
|
||||
@ -10802,7 +10802,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
// to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).
|
||||
// We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.
|
||||
// If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.
|
||||
if (!(g.LastItemData.InFlags & ImGuiItemFlags_NoNav))
|
||||
if (!(g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
|
||||
{
|
||||
// FIMXE-NAV: investigate changing the window tests into a simple 'if (g.NavFocusScopeId == g.CurrentFocusScopeId)' test.
|
||||
window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent);
|
||||
@ -10812,12 +10812,12 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
NavProcessItem();
|
||||
}
|
||||
|
||||
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasShortcut)
|
||||
if (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasShortcut)
|
||||
ItemHandleShortcut(id);
|
||||
}
|
||||
|
||||
// Lightweight clear of SetNextItemXXX data.
|
||||
g.NextItemData.Flags = ImGuiNextItemDataFlags_None;
|
||||
g.NextItemData.HasFlags = ImGuiNextItemDataFlags_None;
|
||||
g.NextItemData.ItemFlags = ImGuiItemFlags_None;
|
||||
|
||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||
@ -11046,7 +11046,7 @@ void ImGui::Unindent(float indent_w)
|
||||
void ImGui::SetNextItemWidth(float item_width)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasWidth;
|
||||
g.NextItemData.HasFlags |= ImGuiNextItemDataFlags_HasWidth;
|
||||
g.NextItemData.Width = item_width;
|
||||
}
|
||||
|
||||
@ -11057,7 +11057,7 @@ void ImGui::PushItemWidth(float item_width)
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width
|
||||
window->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width);
|
||||
g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
|
||||
g.NextItemData.HasFlags &= ~ImGuiNextItemDataFlags_HasWidth;
|
||||
}
|
||||
|
||||
void ImGui::PushMultiItemsWidths(int components, float w_full)
|
||||
@ -11076,7 +11076,7 @@ void ImGui::PushMultiItemsWidths(int components, float w_full)
|
||||
prev_split = next_split;
|
||||
}
|
||||
window->DC.ItemWidth = ImMax(prev_split, 1.0f);
|
||||
g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
|
||||
g.NextItemData.HasFlags &= ~ImGuiNextItemDataFlags_HasWidth;
|
||||
}
|
||||
|
||||
void ImGui::PopItemWidth()
|
||||
@ -11099,7 +11099,7 @@ float ImGui::CalcItemWidth()
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
float w;
|
||||
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)
|
||||
if (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasWidth)
|
||||
w = g.NextItemData.Width;
|
||||
else
|
||||
w = window->DC.ItemWidth;
|
||||
@ -12444,7 +12444,7 @@ static void ImGui::NavApplyItemToResult(ImGuiNavItemData* result)
|
||||
result->Window = window;
|
||||
result->ID = g.LastItemData.ID;
|
||||
result->FocusScopeId = g.CurrentFocusScopeId;
|
||||
result->InFlags = g.LastItemData.InFlags;
|
||||
result->InFlags = g.LastItemData.ItemFlags;
|
||||
result->RectRel = WindowRectAbsToRel(window, g.LastItemData.NavRect);
|
||||
if (result->InFlags & ImGuiItemFlags_HasSelectionUserData)
|
||||
{
|
||||
@ -12469,7 +12469,7 @@ static void ImGui::NavProcessItem()
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
const ImGuiID id = g.LastItemData.ID;
|
||||
const ImGuiItemFlags item_flags = g.LastItemData.InFlags;
|
||||
const ImGuiItemFlags item_flags = g.LastItemData.ItemFlags;
|
||||
|
||||
// When inside a container that isn't scrollable with Left<>Right, clip NavRect accordingly (#2221)
|
||||
if (window->DC.NavIsScrollPushableX == false)
|
||||
@ -12531,7 +12531,7 @@ static void ImGui::NavProcessItem()
|
||||
SetNavFocusScope(g.CurrentFocusScopeId); // Will set g.NavFocusScopeId AND store g.NavFocusScopePath
|
||||
g.NavFocusScopeId = g.CurrentFocusScopeId;
|
||||
g.NavIdIsAlive = true;
|
||||
if (g.LastItemData.InFlags & ImGuiItemFlags_HasSelectionUserData)
|
||||
if (g.LastItemData.ItemFlags & ImGuiItemFlags_HasSelectionUserData)
|
||||
{
|
||||
IM_ASSERT(g.NextItemData.SelectionUserData != ImGuiSelectionUserData_Invalid);
|
||||
g.NavLastValidSelectionUserData = g.NextItemData.SelectionUserData; // INTENTIONAL: At this point this field is not cleared in NextItemData. Avoid unnecessary copy to LastItemData.
|
||||
@ -12652,7 +12652,7 @@ void ImGui::NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGu
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NavMoveScoringItems = false;
|
||||
g.LastItemData.ID = tree_node_data->ID;
|
||||
g.LastItemData.InFlags = tree_node_data->InFlags & ~ImGuiItemFlags_HasSelectionUserData; // Losing SelectionUserData, recovered next-frame (cheaper).
|
||||
g.LastItemData.ItemFlags = tree_node_data->InFlags & ~ImGuiItemFlags_HasSelectionUserData; // Losing SelectionUserData, recovered next-frame (cheaper).
|
||||
g.LastItemData.NavRect = tree_node_data->NavRect;
|
||||
NavApplyItemToResult(result); // Result this instead of implementing a NavApplyPastTreeNodeToResult()
|
||||
NavClearPreferredPosForAxis(ImGuiAxis_Y);
|
||||
@ -13916,7 +13916,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
// Rely on keeping other window->LastItemXXX fields intact.
|
||||
source_id = g.LastItemData.ID = window->GetIDFromRectangle(g.LastItemData.Rect);
|
||||
KeepAliveID(source_id);
|
||||
bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id, g.LastItemData.InFlags);
|
||||
bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id, g.LastItemData.ItemFlags);
|
||||
if (is_hovered && g.IO.MouseClicked[mouse_button])
|
||||
{
|
||||
SetActiveID(source_id, window);
|
||||
|
@ -1209,7 +1209,7 @@ enum ImGuiNextItemDataFlags_
|
||||
|
||||
struct ImGuiNextItemData
|
||||
{
|
||||
ImGuiNextItemDataFlags Flags;
|
||||
ImGuiNextItemDataFlags HasFlags; // Called HasFlags instead of Flags to avoid mistaking this
|
||||
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()
|
||||
ImGuiID FocusScopeId; // Set by SetNextItemSelectionUserData()
|
||||
@ -1223,14 +1223,14 @@ struct ImGuiNextItemData
|
||||
ImGuiID StorageId; // Set by SetNextItemStorageID()
|
||||
|
||||
ImGuiNextItemData() { memset(this, 0, sizeof(*this)); SelectionUserData = -1; }
|
||||
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!
|
||||
inline void ClearFlags() { HasFlags = ImGuiNextItemDataFlags_None; ItemFlags = ImGuiItemFlags_None; } // Also cleared manually by ItemAdd()!
|
||||
};
|
||||
|
||||
// Status storage for the last submitted item
|
||||
struct ImGuiLastItemData
|
||||
{
|
||||
ImGuiID ID;
|
||||
ImGuiItemFlags InFlags; // See ImGuiItemFlags_
|
||||
ImGuiItemFlags ItemFlags; // See ImGuiItemFlags_
|
||||
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
||||
ImRect Rect; // Full rectangle
|
||||
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
||||
@ -3025,7 +3025,7 @@ namespace ImGui
|
||||
|
||||
// Basic Accessors
|
||||
inline ImGuiItemStatusFlags GetItemStatusFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; }
|
||||
inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; }
|
||||
inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.ItemFlags; }
|
||||
inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; }
|
||||
inline ImGuiID GetFocusID() { ImGuiContext& g = *GImGui; return g.NavId; }
|
||||
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
|
||||
|
@ -505,7 +505,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
|
||||
// Default behavior inherited from item flags
|
||||
// Note that _both_ ButtonFlags and ItemFlags are valid sources, so copy one into the item_flags and only check that.
|
||||
ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags);
|
||||
ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.ItemFlags : g.CurrentItemFlags);
|
||||
if (flags & ImGuiButtonFlags_AllowOverlap)
|
||||
item_flags |= ImGuiItemFlags_AllowOverlap;
|
||||
|
||||
@ -1150,7 +1150,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||
const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
|
||||
ItemSize(total_bb, style.FramePadding.y);
|
||||
const bool is_visible = ItemAdd(total_bb, id);
|
||||
const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
const bool is_multi_select = (g.LastItemData.ItemFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
if (!is_visible)
|
||||
if (!is_multi_select || !g.BoxSelectState.UnclipMode || !g.BoxSelectState.UnclipRect.Overlaps(total_bb)) // Extra layer of "no logic clip" for box-select support
|
||||
{
|
||||
@ -1180,7 +1180,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||
}
|
||||
|
||||
const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
|
||||
const bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0;
|
||||
const bool mixed_value = (g.LastItemData.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
|
||||
if (is_visible)
|
||||
{
|
||||
RenderNavHighlight(total_bb, id);
|
||||
@ -2562,7 +2562,7 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v
|
||||
}
|
||||
if (g.ActiveId != id)
|
||||
return false;
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
if ((g.LastItemData.ItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
return false;
|
||||
|
||||
switch (data_type)
|
||||
@ -2609,7 +2609,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
||||
if (format == NULL)
|
||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||
if (!temp_input_is_active)
|
||||
{
|
||||
@ -3104,7 +3104,7 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
||||
}
|
||||
|
||||
if (set_new_value)
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
if ((g.LastItemData.ItemFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
set_new_value = false;
|
||||
|
||||
if (set_new_value)
|
||||
@ -3209,7 +3209,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
||||
if (format == NULL)
|
||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||
if (!temp_input_is_active)
|
||||
{
|
||||
@ -3375,7 +3375,7 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d
|
||||
if (format == NULL)
|
||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||
if (clicked || g.NavActivateId == id)
|
||||
{
|
||||
@ -3583,7 +3583,7 @@ bool ImGui::TempInputText(const ImRect& bb, ImGuiID id, const char* label, char*
|
||||
ClearActiveID();
|
||||
|
||||
g.CurrentWindow->DC.CursorPos = bb.Min;
|
||||
g.LastItemData.InFlags |= ImGuiItemFlags_AllowDuplicateId;
|
||||
g.LastItemData.ItemFlags |= ImGuiItemFlags_AllowDuplicateId;
|
||||
bool value_changed = InputTextEx(label, NULL, buf, buf_size, bb.GetSize(), flags | ImGuiInputTextFlags_MergedItem);
|
||||
if (init)
|
||||
{
|
||||
@ -3640,7 +3640,7 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
||||
void ImGui::SetNextItemRefVal(ImGuiDataType data_type, void* p_data)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasRefVal;
|
||||
g.NextItemData.HasFlags |= ImGuiNextItemDataFlags_HasRefVal;
|
||||
memcpy(&g.NextItemData.RefVal, p_data, DataTypeGetInfo(data_type)->Size);
|
||||
}
|
||||
|
||||
@ -3658,7 +3658,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
||||
if (format == NULL)
|
||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||
|
||||
void* p_data_default = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasRefVal) ? &g.NextItemData.RefVal : &g.DataTypeZeroValue;
|
||||
void* p_data_default = (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasRefVal) ? &g.NextItemData.RefVal : &g.DataTypeZeroValue;
|
||||
|
||||
char buf[64];
|
||||
if ((flags & ImGuiInputTextFlags_DisplayEmptyRefVal) && DataTypeCompare(data_type, p_data, p_data_default) == 0)
|
||||
@ -4465,7 +4465,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
}
|
||||
|
||||
// Ensure mouse cursor is set even after switching to keyboard/gamepad mode. May generalize further? (#6417)
|
||||
bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags | ImGuiItemFlags_NoNavDisableMouseHover);
|
||||
bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags | ImGuiItemFlags_NoNavDisableMouseHover);
|
||||
if (hovered)
|
||||
SetMouseCursor(ImGuiMouseCursor_TextInput);
|
||||
if (hovered && g.NavDisableMouseHover)
|
||||
@ -4474,7 +4474,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
// We are only allowed to access the state if we are already the active widget.
|
||||
ImGuiInputTextState* state = GetInputTextState(id);
|
||||
|
||||
if (g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly)
|
||||
if (g.LastItemData.ItemFlags & ImGuiItemFlags_ReadOnly)
|
||||
flags |= ImGuiInputTextFlags_ReadOnly;
|
||||
const bool is_readonly = (flags & ImGuiInputTextFlags_ReadOnly) != 0;
|
||||
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
|
||||
@ -5300,7 +5300,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
if (g.LastItemData.ID == 0 || g.LastItemData.ID != GetWindowScrollbarID(draw_window, ImGuiAxis_Y))
|
||||
{
|
||||
g.LastItemData.ID = id;
|
||||
g.LastItemData.InFlags = item_data_backup.InFlags;
|
||||
g.LastItemData.ItemFlags = item_data_backup.ItemFlags;
|
||||
g.LastItemData.StatusFlags = item_data_backup.StatusFlags;
|
||||
}
|
||||
}
|
||||
@ -5629,7 +5629,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
|
||||
// Drag and Drop Target
|
||||
// NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test.
|
||||
if ((g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) && !(g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropTarget())
|
||||
if ((g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) && !(g.LastItemData.ItemFlags & ImGuiItemFlags_ReadOnly) && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropTarget())
|
||||
{
|
||||
bool accepted_drag_drop = false;
|
||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
||||
@ -6411,7 +6411,7 @@ bool ImGui::TreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags)
|
||||
ImGuiStorage* storage = window->DC.StateStorage;
|
||||
|
||||
bool is_open;
|
||||
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasOpen)
|
||||
if (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasOpen)
|
||||
{
|
||||
if (g.NextItemData.OpenCond & ImGuiCond_Always)
|
||||
{
|
||||
@ -6457,7 +6457,7 @@ static void TreeNodeStoreStackData(ImGuiTreeNodeFlags flags)
|
||||
ImGuiTreeNodeStackData* tree_node_data = &g.TreeNodeStack.back();
|
||||
tree_node_data->ID = g.LastItemData.ID;
|
||||
tree_node_data->TreeFlags = flags;
|
||||
tree_node_data->InFlags = g.LastItemData.InFlags;
|
||||
tree_node_data->InFlags = g.LastItemData.ItemFlags;
|
||||
tree_node_data->NavRect = g.LastItemData.NavRect;
|
||||
window->DC.TreeHasStackDataDepthMask |= (1 << window->DC.TreeDepth);
|
||||
}
|
||||
@ -6506,7 +6506,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0f ? style.ItemSpacing.x * 2.0f : 0.0f);
|
||||
|
||||
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
||||
ImGuiID storage_id = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasStorageID) ? g.NextItemData.StorageId : id;
|
||||
ImGuiID storage_id = (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasStorageID) ? g.NextItemData.StorageId : id;
|
||||
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
||||
|
||||
bool is_visible;
|
||||
@ -6559,7 +6559,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
}
|
||||
|
||||
ImGuiButtonFlags button_flags = ImGuiTreeNodeFlags_None;
|
||||
if ((flags & ImGuiTreeNodeFlags_AllowOverlap) || (g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap))
|
||||
if ((flags & ImGuiTreeNodeFlags_AllowOverlap) || (g.LastItemData.ItemFlags & ImGuiItemFlags_AllowOverlap))
|
||||
button_flags |= ImGuiButtonFlags_AllowOverlap;
|
||||
if (!is_leaf)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
|
||||
@ -6571,7 +6571,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + style.TouchExtraPadding.x;
|
||||
const bool is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2);
|
||||
|
||||
const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
const bool is_multi_select = (g.LastItemData.ItemFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
if (is_multi_select) // We absolutely need to distinguish open vs select so _OpenOnArrow comes by default
|
||||
flags |= (flags & ImGuiTreeNodeFlags_OpenOnMask_) == 0 ? ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick : ImGuiTreeNodeFlags_OpenOnArrow;
|
||||
|
||||
@ -6788,7 +6788,7 @@ void ImGui::SetNextItemOpen(bool is_open, ImGuiCond cond)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.CurrentWindow->SkipItems)
|
||||
return;
|
||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasOpen;
|
||||
g.NextItemData.HasFlags |= ImGuiNextItemDataFlags_HasOpen;
|
||||
g.NextItemData.OpenVal = is_open;
|
||||
g.NextItemData.OpenCond = (ImU8)(cond ? cond : ImGuiCond_Always);
|
||||
}
|
||||
@ -6799,7 +6799,7 @@ void ImGui::SetNextItemStorageID(ImGuiID storage_id)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.CurrentWindow->SkipItems)
|
||||
return;
|
||||
g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasStorageID;
|
||||
g.NextItemData.HasFlags |= ImGuiNextItemDataFlags_HasStorageID;
|
||||
g.NextItemData.StorageId = storage_id;
|
||||
}
|
||||
|
||||
@ -6925,7 +6925,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
is_visible = ItemAdd(bb, id, NULL, extra_item_flags);
|
||||
}
|
||||
|
||||
const bool is_multi_select = (g.LastItemData.InFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
const bool is_multi_select = (g.LastItemData.ItemFlags & ImGuiItemFlags_IsMultiSelect) != 0;
|
||||
if (!is_visible)
|
||||
if (!is_multi_select || !g.BoxSelectState.UnclipMode || !g.BoxSelectState.UnclipRect.Overlaps(bb)) // Extra layer of "no logic clip" for box-select support (would be more overhead to add to ItemAdd)
|
||||
return false;
|
||||
@ -6953,7 +6953,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
if (flags & ImGuiSelectableFlags_SelectOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; }
|
||||
if (flags & ImGuiSelectableFlags_SelectOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; }
|
||||
if (flags & ImGuiSelectableFlags_AllowDoubleClick) { button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; }
|
||||
if ((flags & ImGuiSelectableFlags_AllowOverlap) || (g.LastItemData.InFlags & ImGuiItemFlags_AllowOverlap)) { button_flags |= ImGuiButtonFlags_AllowOverlap; }
|
||||
if ((flags & ImGuiSelectableFlags_AllowOverlap) || (g.LastItemData.ItemFlags & ImGuiItemFlags_AllowOverlap)) { button_flags |= ImGuiButtonFlags_AllowOverlap; }
|
||||
|
||||
// Multi-selection support (header)
|
||||
const bool was_selected = selected;
|
||||
@ -7035,7 +7035,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb);
|
||||
|
||||
// Automatically close popups
|
||||
if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.InFlags & ImGuiItemFlags_AutoClosePopups))
|
||||
if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
|
||||
CloseCurrentPopup();
|
||||
|
||||
if (disabled_item && !disabled_global)
|
||||
@ -9960,7 +9960,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
// Calculate tab contents size
|
||||
ImVec2 size = TabItemCalcSize(label, (p_open != NULL) || (flags & ImGuiTabItemFlags_UnsavedDocument));
|
||||
tab->RequestedWidth = -1.0f;
|
||||
if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth)
|
||||
if (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasWidth)
|
||||
size.x = tab->RequestedWidth = g.NextItemData.Width;
|
||||
if (tab_is_new)
|
||||
tab->Width = ImMax(1.0f, size.x);
|
||||
|
Loading…
Reference in New Issue
Block a user