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

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)
}
}
}
}