1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

TextLinkOpenURL(): added bool return value on click. (#8645, #8451, #7660)

This commit is contained in:
ocornut 2025-05-20 17:31:58 +02:00
parent 415dddf0fa
commit 1ffa7a40ac
3 changed files with 7 additions and 5 deletions

View file

@ -1529,14 +1529,14 @@ bool ImGui::TextLink(const char* label)
return pressed;
}
void ImGui::TextLinkOpenURL(const char* label, const char* url)
bool ImGui::TextLinkOpenURL(const char* label, const char* url)
{
ImGuiContext& g = *GImGui;
if (url == NULL)
url = label;
if (TextLink(label))
if (g.PlatformIO.Platform_OpenInShellFn != NULL)
g.PlatformIO.Platform_OpenInShellFn(&g, url);
bool pressed = TextLink(label);
if (pressed && g.PlatformIO.Platform_OpenInShellFn != NULL)
g.PlatformIO.Platform_OpenInShellFn(&g, url);
SetItemTooltip(LocalizeGetMsg(ImGuiLocKey_OpenLink_s), url); // It is more reassuring for user to _always_ display URL when we same as label
if (BeginPopupContextItem())
{
@ -1544,6 +1544,7 @@ void ImGui::TextLinkOpenURL(const char* label, const char* url)
SetClipboardText(url);
EndPopup();
}
return pressed;
}
//-------------------------------------------------------------------------