mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Added UI helper function for tooltips
This commit is contained in:
@@ -174,5 +174,21 @@ namespace Nuake {
|
||||
draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), ImGui::GetColorU32(*v ? colors[ImGuiCol_Button] : ImVec4(0.85f, 0.85f, 0.85f, 1.0f)), height * 0.50f);
|
||||
draw_list->AddCircleFilled(ImVec2(p.x + radius + (*v ? 1 : 0) * (width - radius * 2.0f), p.y + radius), radius - 1.5f, IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
void Tooltip(const std::string& message)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal))
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(450.0f);
|
||||
ImGui::TextUnformatted(message.c_str());
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,5 +31,7 @@ namespace Nuake
|
||||
bool CheckBox(const std::string& name, bool& value);
|
||||
|
||||
void ToggleButton(const char* str_id, bool* v);
|
||||
|
||||
void Tooltip(const std::string& message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user