| 8427 | } |
| 8428 | |
| 8429 | void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) |
| 8430 | { |
| 8431 | ImGuiContext& g = *GImGui; |
| 8432 | |
| 8433 | if (g.DragDropWithinSource || g.DragDropWithinTarget) |
| 8434 | { |
| 8435 | // 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) |
| 8436 | // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor. |
| 8437 | // 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. |
| 8438 | //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; |
| 8439 | ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale); |
| 8440 | SetNextWindowPos(tooltip_pos); |
| 8441 | SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f); |
| 8442 | //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :( |
| 8443 | tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip; |
| 8444 | } |
| 8445 | |
| 8446 | char window_name[16]; |
| 8447 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount); |
| 8448 | if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip) |
| 8449 | if (ImGuiWindow* window = FindWindowByName(window_name)) |
| 8450 | if (window->Active) |
| 8451 | { |
| 8452 | // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. |
| 8453 | window->Hidden = true; |
| 8454 | window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary? |
| 8455 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); |
| 8456 | } |
| 8457 | ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; |
| 8458 | Begin(window_name, NULL, flags | extra_window_flags); |
| 8459 | } |
| 8460 | |
| 8461 | void ImGui::EndTooltip() |
| 8462 | { |
nothing calls this directly
no test coverage detected