Tooltips.swift 913 B

123456789101112131415161718192021222324
  1. extension BackendFeatures {
  2. /// Backend methods for tooltips.
  3. ///
  4. /// These are used by ``View/help(_:)``.
  5. @MainActor
  6. public protocol Tooltips: Core {
  7. /// Create a container capable of showing a textual tooltip.
  8. ///
  9. /// If no container is necessary, this method is allowed to return `child`
  10. /// unmodified.
  11. ///
  12. /// - Parameters:
  13. /// - child: The widget being wrapped to show a tooltip over.
  14. func createTooltipContainer(wrapping child: Widget) -> Widget
  15. /// Update the tooltip shown by a widget.
  16. ///
  17. /// - Parameters:
  18. /// - widget: The widget to update the tooltip for. Will always have been
  19. /// created by ``createTooltipContainer(wrapping:)``.
  20. /// - tooltip: The text to be shown on hover.
  21. func updateTooltipContainer(_ widget: Widget, tooltip: String)
  22. }
  23. }