Merge branch 'master' into docking

# Conflicts:
#	docs/CHANGELOG.txt
This commit is contained in:
ocornut
2021-08-20 18:14:58 +02:00
13 changed files with 137 additions and 81 deletions

View File

@ -1,4 +1,4 @@
// dear imgui, v1.84 WIP
// dear imgui, v1.84
// (widgets code)
/*
@ -3445,7 +3445,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
style.FramePadding.x = style.FramePadding.y;
ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;
if (flags & ImGuiInputTextFlags_ReadOnly)
PushDisabled(true);
BeginDisabled(true);
SameLine(0, style.ItemInnerSpacing.x);
if (ButtonEx("-", ImVec2(button_size, button_size), button_flags))
{
@ -3459,7 +3459,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
value_changed = true;
}
if (flags & ImGuiInputTextFlags_ReadOnly)
PopDisabled();
EndDisabled();
const char* label_end = FindRenderedTextEnd(label);
if (label != label_end)
@ -6172,7 +6172,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
const bool disabled_global = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
if (disabled_item && !disabled_global) // Only testing this as an optimization
PushDisabled(true);
BeginDisabled(true);
// FIXME: We can standardize the behavior of those two, we could also keep the fast path of override ClipRect + full push on render only,
// which would be advantageous since most selectable are not selected.
@ -6245,10 +6245,10 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
CloseCurrentPopup();
if (disabled_item && !disabled_global)
PopDisabled();
EndDisabled();
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags);
return pressed;
return pressed; //-V1020
}
bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)
@ -6841,7 +6841,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
ImVec2 popup_pos, pos = window->DC.CursorPos;
PushID(label);
if (!enabled)
PushDisabled();
BeginDisabled();
const ImGuiMenuColumns* offsets = &window->DC.MenuColumns;
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
{
@ -6874,7 +6874,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
RenderArrow(window->DrawList, pos + ImVec2(offsets->OffsetMark + extra_w + g.FontSize * 0.30f, 0.0f), GetColorU32(ImGuiCol_Text), ImGuiDir_Right);
}
if (!enabled)
PopDisabled();
EndDisabled();
const bool hovered = (g.HoveredId == id) && enabled;
if (menuset_is_open)
@ -7007,7 +7007,7 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
bool pressed;
PushID(label);
if (!enabled)
PushDisabled(true);
BeginDisabled(true);
const ImGuiSelectableFlags flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_SetNavIdOnHover;
const ImGuiMenuColumns* offsets = &window->DC.MenuColumns;
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
@ -7047,7 +7047,7 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
}
IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));
if (!enabled)
PopDisabled();
EndDisabled();
PopID();
return pressed;