Set whether a label is ellipsized

This commit is contained in:
david-swift 2024-03-17 21:30:53 +01:00
parent 8792437357
commit 2146a4f268

View File

@ -5,6 +5,8 @@
// Created by david-swift on 23.08.23. // Created by david-swift on 23.08.23.
// //
import CAdw
/// A text widget. /// A text widget.
public typealias Text = Label public typealias Text = Label
@ -16,4 +18,11 @@ extension Text {
self.init(label: text) 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) -> View {
inspect { gtk_label_set_ellipsize($0.pointer, PANGO_ELLIPSIZE_END) }
}
} }