david-swift 04c77831b5
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Waiting to run
Remove Core library
2025-10-30 21:36:13 +01:00

31 lines
761 B
Swift

//
// Popover+.swift
// Adwaita
//
// Created by david-swift on 10.02.24.
//
import CAdw
extension Popover {
/// Initialize either a horizontal or vertical clamp.
/// - Parameter vertical: Whether it is a vertical clamp.
public init(visible: Binding<Bool>) {
self.init()
updateFunctions.append { storage, _, _ in
storage.connectSignal(name: "closed", id: "visible") {
if visible.wrappedValue {
visible.wrappedValue = false
}
}
if visible.wrappedValue {
gtk_popover_popup(storage.opaquePointer?.cast())
} else {
gtk_popover_popdown(storage.opaquePointer?.cast())
}
}
}
}