Add support for tooltips
This commit is contained in:
parent
cf0b4b4a5c
commit
24fc372849
@ -166,4 +166,11 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a tooltip to the widget.
|
||||
/// - Parameter tooltip: The tooltip text.
|
||||
/// - Returns: A view.
|
||||
public func tooltip(_ tooltip: String) -> View {
|
||||
inspect { gtk_widget_set_tooltip_markup($0.pointer?.cast(), tooltip) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ struct Demo: App {
|
||||
.topToolbar {
|
||||
HeaderBar {
|
||||
Toggle(icon: .default(icon: .sidebarShow), isOn: $sidebarVisible)
|
||||
.tooltip("Toggle Sidebar")
|
||||
} end: {
|
||||
if sidebarVisible {
|
||||
Text("")
|
||||
@ -148,6 +149,7 @@ struct Demo: App {
|
||||
}
|
||||
}
|
||||
.primary()
|
||||
.tooltip("Main Menu")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user