|
@@ -387,6 +387,7 @@ CODE
|
|
|
When you are not sure about an 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.
|
|
|
|
|
|
+ - 2023/03/09 (1.89.4) - tooltips: Added 'bool' return value to BeginTooltip() for API consistency. Please only submit contents and call EndTooltip() if BeginTooltip() returns true. In reality the function will _currently_ always return true, but further changes down the line may change this, best to clarify API sooner.
|
|
|
- 2023/02/15 (1.89.4) - moved the optional "courtesy maths operators" implementation from imgui_internal.h in imgui.h.
|
|
|
Even though we encourage using your own maths types and operators by setting up IM_VEC2_CLASS_EXTRA,
|
|
|
it has been frequently requested by people to use our own. We had an opt-in define which was
|
|
@@ -7281,6 +7282,12 @@ void ImGui::SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const I
|
|
|
window->HitTestHoleOffset = ImVec2ih(pos - window->Pos);
|
|
|
}
|
|
|
|
|
|
+void ImGui::SetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window)
|
|
|
+{
|
|
|
+ window->Hidden = window->SkipItems = true;
|
|
|
+ window->HiddenFramesCanSkipItems = 1;
|
|
|
+}
|
|
|
+
|
|
|
void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond)
|
|
|
{
|
|
|
SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond);
|
|
@@ -9875,12 +9882,12 @@ void ImGui::SetScrollHereY(float center_y_ratio)
|
|
|
// [SECTION] TOOLTIPS
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-void ImGui::BeginTooltip()
|
|
|
+bool ImGui::BeginTooltip()
|
|
|
{
|
|
|
- BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None);
|
|
|
+ return BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None);
|
|
|
}
|
|
|
|
|
|
-void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags)
|
|
|
+bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
@@ -9904,12 +9911,17 @@ void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext
|
|
|
if (window->Active)
|
|
|
{
|
|
|
// Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
|
|
|
- window->Hidden = true;
|
|
|
- window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary?
|
|
|
+ SetWindowHiddendAndSkipItemsForCurrentFrame(window);
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
|
|
|
}
|
|
|
ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
|
|
|
Begin(window_name, NULL, flags | extra_window_flags);
|
|
|
+ // 2023-03-09: Added bool return value to the API, but currently always returning true.
|
|
|
+ // If this ever returns false we need to update BeginDragDropSource() accordingly.
|
|
|
+ //if (!ret)
|
|
|
+ // End();
|
|
|
+ //return ret;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
void ImGui::EndTooltip()
|
|
@@ -12030,13 +12042,12 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|
|
{
|
|
|
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
|
|
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
|
|
- BeginTooltip();
|
|
|
+ bool ret = BeginTooltip();
|
|
|
+ IM_ASSERT(ret); // FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", NULL, ImGuiWindowFlags_NoSavedSettings) + SetWindowHiddendAndSkipItemsForCurrentFrame().
|
|
|
+ IM_UNUSED(ret);
|
|
|
+
|
|
|
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
|
|
- {
|
|
|
- ImGuiWindow* tooltip_window = g.CurrentWindow;
|
|
|
- tooltip_window->Hidden = tooltip_window->SkipItems = true;
|
|
|
- tooltip_window->HiddenFramesCanSkipItems = 1;
|
|
|
- }
|
|
|
+ SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow);
|
|
|
}
|
|
|
|
|
|
if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern))
|
|
@@ -13228,9 +13239,8 @@ void ImGui::DebugTextEncoding(const char* str)
|
|
|
static void MetricsHelpMarker(const char* desc)
|
|
|
{
|
|
|
ImGui::TextDisabled("(?)");
|
|
|
- if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort))
|
|
|
+ if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort) && ImGui::BeginTooltip())
|
|
|
{
|
|
|
- ImGui::BeginTooltip();
|
|
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
|
|
ImGui::TextUnformatted(desc);
|
|
|
ImGui::PopTextWrapPos();
|
|
@@ -13994,9 +14004,8 @@ void ImGui::DebugNodeFont(ImFont* font)
|
|
|
if (!glyph)
|
|
|
continue;
|
|
|
font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n));
|
|
|
- if (IsMouseHoveringRect(cell_p1, cell_p2))
|
|
|
+ if (IsMouseHoveringRect(cell_p1, cell_p2) && BeginTooltip())
|
|
|
{
|
|
|
- BeginTooltip();
|
|
|
DebugNodeFontGlyph(font, glyph);
|
|
|
EndTooltip();
|
|
|
}
|
|
@@ -14333,7 +14342,8 @@ void ImGui::UpdateDebugToolItemPicker()
|
|
|
if (change_mapping && IsMouseClicked(mouse_button))
|
|
|
g.DebugItemPickerMouseButton = (ImU8)mouse_button;
|
|
|
SetNextWindowBgAlpha(0.70f);
|
|
|
- BeginTooltip();
|
|
|
+ if (!BeginTooltip())
|
|
|
+ return;
|
|
|
Text("HoveredId: 0x%08X", hovered_id);
|
|
|
Text("Press ESC to abort picking.");
|
|
|
const char* mouse_button_names[] = { "Left", "Right", "Middle" };
|