| 8011 | } |
| 8012 | |
| 8013 | void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags) |
| 8014 | { |
| 8015 | ImGuiContext& g = *GImGui; |
| 8016 | |
| 8017 | if (g.DragDropWithinSource || g.DragDropWithinTarget) |
| 8018 | { |
| 8019 | // 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) |
| 8020 | // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor. |
| 8021 | // 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. |
| 8022 | //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; |
| 8023 | ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale); |
| 8024 | SetNextWindowPos(tooltip_pos); |
| 8025 | SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f); |
| 8026 | //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :( |
| 8027 | tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip; |
| 8028 | } |
| 8029 | |
| 8030 | char window_name[16]; |
| 8031 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount); |
| 8032 | if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip) |
| 8033 | if (ImGuiWindow* window = FindWindowByName(window_name)) |
| 8034 | if (window->Active) |
| 8035 | { |
| 8036 | // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. |
| 8037 | window->Hidden = true; |
| 8038 | window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary? |
| 8039 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); |
| 8040 | } |
| 8041 | ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; |
| 8042 | Begin(window_name, NULL, flags | extra_flags); |
| 8043 | } |
| 8044 | |
| 8045 | void ImGui::EndTooltip() |
| 8046 | { |
nothing calls this directly
no test coverage detected