MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / BeginTooltipEx

Method BeginTooltipEx

lib/imgui/imgui.cpp:7362–7392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7360}
7361
7362void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags)
7363{
7364 ImGuiContext& g = *GImGui;
7365
7366 if (g.DragDropWithinSourceOrTarget)
7367 {
7368 // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
7369 // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
7370 // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.
7371 //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
7372 ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
7373 SetNextWindowPos(tooltip_pos);
7374 SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);
7375 //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
7376 tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip;
7377 }
7378
7379 char window_name[16];
7380 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount);
7381 if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip)
7382 if (ImGuiWindow* window = FindWindowByName(window_name))
7383 if (window->Active)
7384 {
7385 // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
7386 window->Hidden = true;
7387 window->HiddenFramesCanSkipItems = 1;
7388 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
7389 }
7390 ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoInputs|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize;
7391 Begin(window_name, NULL, flags | extra_flags);
7392}
7393
7394void ImGui::EndTooltip()
7395{

Callers

nothing calls this directly

Calls 2

ImVec2Class · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected