|
@@ -828,13 +828,18 @@ static void ShowDemoWindowWidgets()
|
|
|
|
|
|
ImGui::SeparatorText("Custom");
|
|
|
|
|
|
+ HelpMarker(
|
|
|
+ "Passing ImGuiHoveredFlags_ForTooltip to IsItemHovered() is the preferred way to standardize"
|
|
|
+ "tooltip activation details across your application. You may however decide to use custom"
|
|
|
+ "flags for a specific tooltip instance.");
|
|
|
+
|
|
|
// The following examples are passed for documentation purpose but may not be useful to most users.
|
|
|
// Passing ImGuiHoveredFlags_Tooltip to IsItemHovered() will pull ImGuiHoveredFlags flags values from
|
|
|
// 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on whether mouse or gamepad/keyboard is being used.
|
|
|
// With default settings, ImGuiHoveredFlags_Tooltip is equivalent to ImGuiHoveredFlags_DelayShort + ImGuiHoveredFlags_Stationary.
|
|
|
ImGui::Button("Manual", sz);
|
|
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip))
|
|
|
- ImGui::SetTooltip("I am a manually emitted tooltip");
|
|
|
+ ImGui::SetTooltip("I am a manually emitted tooltip.");
|
|
|
|
|
|
ImGui::Button("DelayNone", sz);
|
|
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNone))
|
|
@@ -846,12 +851,21 @@ static void ShowDemoWindowWidgets()
|
|
|
|
|
|
ImGui::Button("DelayLong", sz);
|
|
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_NoSharedDelay))
|
|
|
- ImGui::SetTooltip("I am a tooltip with a long delay (%0.2f sec)", ImGui::GetStyle().HoverDelayNormal);
|
|
|
+ ImGui::SetTooltip("I am a tooltip with a long delay (%0.2f sec).", ImGui::GetStyle().HoverDelayNormal);
|
|
|
|
|
|
ImGui::Button("Stationary", sz);
|
|
|
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
|
|
ImGui::SetTooltip("I am a tooltip requiring mouse to be stationary before activating.");
|
|
|
|
|
|
+ // Using ImGuiHoveredFlags_ForTooltip will pull flags from 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav',
|
|
|
+ // which default value include the ImGuiHoveredFlags_AllowWhenDisabled flag.
|
|
|
+ // As a result, Set
|
|
|
+ ImGui::BeginDisabled();
|
|
|
+ ImGui::Button("Disabled item", sz);
|
|
|
+ ImGui::EndDisabled();
|
|
|
+ if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip))
|
|
|
+ ImGui::SetTooltip("I am a a tooltip for a disabled item.");
|
|
|
+
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|