Skip to content

Commit

Permalink
Renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit(…
Browse files Browse the repository at this point in the history
…) for consistency with new IsItemEdited() API. Kept redirection function (will obsolete fast as IsItemDeactivatedAfterChange() is very recent). (#820, #956, #1875, #2034)
  • Loading branch information
ocornut committed Aug 23, 2018
1 parent e28b107 commit 0810d57
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Breaking Changes:
- InputText: Renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency.
Kept redirection types (will obsolete).
- InputText: Removed ImGuiTextEditCallbackData::ReadOnly since it is a duplication of (ImGuiTextEditCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).
- Renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API.
Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent).
- Renamed io.OptCursorBlink to io.ConfigCursorBlink, io.OptMacOSXBehaviors to io.ConfigMacOSXBehaviors for consistency. (#1427, #473)

Other Changes:
Expand Down
5 changes: 3 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
You can read releases logs https://github.com/ocornut/imgui/releases for more details.

- 2018/08/22 (1.63) - renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API. Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent).
- 2018/08/21 (1.63) - renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency. Kept redirection types (will obsolete).
- 2018/08/21 (1.63) - removed ImGuiInputTextCallbackData::ReadOnly since it is a duplication of (ImGuiInputTextCallbackData::Flags & ImGuiInputTextFlags_ReadOnly).
- 2018/08/01 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.ConfigResizeWindowsFromEdges to enable the feature.
Expand Down Expand Up @@ -2339,7 +2340,7 @@ void ImGui::KeepAliveID(ImGuiID id)

void ImGui::MarkItemValueChanged(ImGuiID id)
{
// This marking is solely to be able to provide info for IsItemDeactivatedAfterChange().
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.
(void)id; // Avoid unused variable warnings when asserts are compiled out.
ImGuiContext& g = *GImGui;
Expand Down Expand Up @@ -5205,7 +5206,7 @@ bool ImGui::IsItemDeactivated()
return (g.ActiveIdPreviousFrame == window->DC.LastItemId && g.ActiveIdPreviousFrame != 0 && g.ActiveId != window->DC.LastItemId);
}

bool ImGui::IsItemDeactivatedAfterChange()
bool ImGui::IsItemDeactivatedAfterEdit()
{
ImGuiContext& g = *GImGui;
return IsItemDeactivated() && (g.ActiveIdPreviousFrameValueChanged || (g.ActiveId == 0 && g.ActiveIdValueChanged));
Expand Down
4 changes: 3 additions & 1 deletion imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ namespace ImGui
IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling)
IMGUI_API bool IsItemEdited(); // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets.
IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.
IMGUI_API bool IsItemDeactivatedAfterChange(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
IMGUI_API bool IsAnyItemHovered();
IMGUI_API bool IsAnyItemActive();
IMGUI_API bool IsAnyItemFocused();
Expand Down Expand Up @@ -1199,6 +1199,8 @@ struct ImGuiIO
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
namespace ImGui
{
// OBSOLETED in 1.63 (from Aug 2018)
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
// OBSOLETED in 1.61 (from Apr 2018)
IMGUI_API bool InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'!
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags = 0);
Expand Down
4 changes: 2 additions & 2 deletions imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
"IsItemActive() = %d\n"
"IsItemEdited() = %d\n"
"IsItemDeactivated() = %d\n"
"IsItemDeactivatedAfterChange() = %d\n"
"IsItemDeactivatedEdit() = %d\n"
"IsItemVisible() = %d\n",
ret,
ImGui::IsItemFocused(),
Expand All @@ -1318,7 +1318,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
ImGui::IsItemActive(),
ImGui::IsItemEdited(),
ImGui::IsItemDeactivated(),
ImGui::IsItemDeactivatedAfterChange(),
ImGui::IsItemDeactivatedAfterEdit(),
ImGui::IsItemVisible()
);

Expand Down

0 comments on commit 0810d57

Please sign in to comment.