| 10137 | } |
| 10138 | |
| 10139 | bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) |
| 10140 | { |
| 10141 | ImGuiContext& g = *GImGui; |
| 10142 | |
| 10143 | if (g.DragDropWithinSource || g.DragDropWithinTarget) |
| 10144 | { |
| 10145 | // Drag and Drop tooltips are positioning differently than other tooltips: |
| 10146 | // - offset visibility to increase visibility around mouse. |
| 10147 | // - never clamp within outer viewport boundary. |
| 10148 | // We call SetNextWindowPos() to enforce position and disable clamping. |
| 10149 | // See FindBestWindowPosForPopup() for positionning logic of other tooltips (not drag and drop ones). |
| 10150 | //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; |
| 10151 | ImVec2 tooltip_pos = g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET * g.Style.MouseCursorScale; |
| 10152 | SetNextWindowPos(tooltip_pos); |
| 10153 | SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f); |
| 10154 | //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :( |
| 10155 | tooltip_flags |= ImGuiTooltipFlags_OverridePrevious; |
| 10156 | } |
| 10157 | |
| 10158 | char window_name[16]; |
| 10159 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount); |
| 10160 | if (tooltip_flags & ImGuiTooltipFlags_OverridePrevious) |
| 10161 | if (ImGuiWindow* window = FindWindowByName(window_name)) |
| 10162 | if (window->Active) |
| 10163 | { |
| 10164 | // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. |
| 10165 | SetWindowHiddendAndSkipItemsForCurrentFrame(window); |
| 10166 | ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); |
| 10167 | } |
| 10168 | ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; |
| 10169 | Begin(window_name, NULL, flags | extra_window_flags); |
| 10170 | // 2023-03-09: Added bool return value to the API, but currently always returning true. |
| 10171 | // If this ever returns false we need to update BeginDragDropSource() accordingly. |
| 10172 | //if (!ret) |
| 10173 | // End(); |
| 10174 | //return ret; |
| 10175 | return true; |
| 10176 | } |
| 10177 | |
| 10178 | void ImGui::EndTooltip() |
| 10179 | { |
nothing calls this directly
no test coverage detected