mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 10:11:00 +01:00
BeginTooltipEx() internal tweaks
This commit is contained in:
parent
105f3b14e4
commit
79ce9b74d5
11
imgui.cpp
11
imgui.cpp
@ -3412,7 +3412,7 @@ static ImRect GetVisibleRect()
|
||||
}
|
||||
|
||||
// Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first.
|
||||
static void BeginTooltipEx(bool override_previous_tooltip)
|
||||
static void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
char window_name[16];
|
||||
@ -3425,12 +3425,13 @@ static void BeginTooltipEx(bool override_previous_tooltip)
|
||||
window->HiddenFrames = 1;
|
||||
ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip%02d", ++g.TooltipOverrideCount);
|
||||
}
|
||||
ImGui::Begin(window_name, NULL, ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize;
|
||||
ImGui::Begin(window_name, NULL, flags | extra_flags);
|
||||
}
|
||||
|
||||
void ImGui::SetTooltipV(const char* fmt, va_list args)
|
||||
{
|
||||
BeginTooltipEx(true);
|
||||
BeginTooltipEx(0, true);
|
||||
TextV(fmt, args);
|
||||
EndTooltip();
|
||||
}
|
||||
@ -3445,7 +3446,7 @@ void ImGui::SetTooltip(const char* fmt, ...)
|
||||
|
||||
void ImGui::BeginTooltip()
|
||||
{
|
||||
BeginTooltipEx(false);
|
||||
BeginTooltipEx(0, false);
|
||||
}
|
||||
|
||||
void ImGui::EndTooltip()
|
||||
@ -9131,7 +9132,7 @@ void ImGui::ColorTooltip(const char* text, const float col[4], ImGuiColorEditFla
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);
|
||||
BeginTooltipEx(true);
|
||||
BeginTooltipEx(0, true);
|
||||
|
||||
const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text;
|
||||
if (text_end > text)
|
||||
|
Loading…
Reference in New Issue
Block a user