60 lines
3.2 KiB
Swift
60 lines
3.2 KiB
Swift
// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
|
|
|
|
import Adw
|
|
import Gtk
|
|
import Gio
|
|
import Gdk
|
|
|
|
// PorticoGen: generateModifierExtension | source: Gtk.ApplicationWindow
|
|
/// Modifiers for `Gtk.ApplicationWindow`, available on every Portico view whose
|
|
/// backing widget is `Gtk.ApplicationWindow` or one of its subclasses.
|
|
extension WidgetView where Target: Gtk.ApplicationWindow {
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ApplicationWindow.setShowMenubar(showMenubar:)
|
|
/// Sets whether the window will display a menubar for the app menu
|
|
/// and menubar as needed.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter showMenubar: If this property is true, the window will display a menubar unless it is shown by the desktop shell.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showMenubar(_ showMenubar: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setShowMenubar(showMenubar: showMenubar)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ApplicationWindow.setShowMenubar(showMenubar:), GObject.Object.connectNotify(detail:_:), Gtk.ApplicationWindow.getShowMenubar()
|
|
/// Sets whether the window will display a menubar for the app menu
|
|
/// and menubar as needed.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showMenubar(_ showMenubar: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, showMenubar, registry: ctx.registry, notifyDetail: "show-menubar",
|
|
read: { [w] in w.getShowMenubar() },
|
|
write: { [w] v in w.setShowMenubar(showMenubar: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ApplicationWindow.setShowMenubar(showMenubar:)
|
|
/// Sets whether the window will display a menubar for the app menu
|
|
/// and menubar as needed.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ApplicationWindow.setShowMenubar(showMenubar:)`.
|
|
///
|
|
/// - Parameter showMenubar: If this property is true, the window will display a menubar unless it is shown by the desktop shell.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showMenubar(_ showMenubar: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setShowMenubar(showMenubar: showMenubar()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
}
|