david-swift 6229b85f46
All checks were successful
Deploy Docs / publish (push) Successful in 21m49s
SwiftLint / SwiftLint (push) Successful in 5s
Fix memory leaks
2024-10-31 23:00:50 +01:00

33 lines
700 B
Swift

//
// Text.swift
// Adwaita
//
// Created by david-swift on 23.08.23.
//
import CAdw
/// A text widget.
public typealias Text = Label
extension Text {
/// Initialize a text widget.
/// - Parameter text: The content.
public init(_ text: String) {
self.init(label: text)
}
/// Set whether the text should ellipsize at the end.
/// - Parameter ellipsize: Whether it should ellipsize.
/// - Returns: The text widget.
public func ellipsize(_ ellipsize: Bool = true) -> AnyView {
inspect { storage, update in
if update {
gtk_label_set_ellipsize(storage.opaquePointer, PANGO_ELLIPSIZE_END)
}
}
}
}