Skip to content

Commit cfe86cd

Browse files
authored
Added support for tooltip to widgets (#586)
1 parent bb79c3a commit cfe86cd

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

Sources/Overload/OvUI/include/OvUI/Widgets/AWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace OvUI::Widgets
7171
virtual void _Draw_Impl() = 0;
7272

7373
public:
74+
std::string tooltip;
7475
bool enabled = true;
7576
bool disabled = false;
7677
bool lineBreak = true;

Sources/Overload/OvUI/src/OvUI/Widgets/AWidget.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ void OvUI::Widgets::AWidget::Draw()
5656

5757
_Draw_Impl();
5858

59+
if (!tooltip.empty())
60+
{
61+
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
62+
{
63+
ImGui::SetTooltip(tooltip.c_str());
64+
}
65+
}
66+
5967
if (disabled)
6068
{
6169
ImGui::EndDisabled();

0 commit comments

Comments
 (0)