MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / BeginTooltipEx

Method BeginTooltipEx

extern/imgui/imgui.cpp:10411–10441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10409}
10410
10411void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags)
10412{
10413 ImGuiContext& g = *GImGui;
10414
10415 if (g.DragDropWithinSource || g.DragDropWithinTarget)
10416 {
10417 // 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)
10418 // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
10419 // 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.
10420 //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
10421 ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
10422 SetNextWindowPos(tooltip_pos);
10423 SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);
10424 //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
10425 tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip;
10426 }
10427
10428 char window_name[16];
10429 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount);
10430 if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip)
10431 if (ImGuiWindow* window = FindWindowByName(window_name))
10432 if (window->Active)
10433 {
10434 // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
10435 window->Hidden = true;
10436 window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary?
10437 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
10438 }
10439 ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking;
10440 Begin(window_name, NULL, flags | extra_window_flags);
10441}
10442
10443void ImGui::EndTooltip()
10444{

Callers

nothing calls this directly

Calls 2

ImVec2Function · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected