From 2146a4f2684e46752c9e8840e1a8a9ed90fd739b Mon Sep 17 00:00:00 2001 From: david-swift Date: Sun, 17 Mar 2024 21:30:53 +0100 Subject: [PATCH] Set whether a label is ellipsized --- Sources/Adwaita/View/Text.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/Adwaita/View/Text.swift b/Sources/Adwaita/View/Text.swift index f723212..e348dda 100644 --- a/Sources/Adwaita/View/Text.swift +++ b/Sources/Adwaita/View/Text.swift @@ -5,6 +5,8 @@ // Created by david-swift on 23.08.23. // +import CAdw + /// A text widget. public typealias Text = Label @@ -16,4 +18,11 @@ extension 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) } + } + }