Skip to content

Commit

Permalink
Set whether a label is ellipsized
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Mar 17, 2024
1 parent 8792437 commit 2146a4f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/Adwaita/View/Text.swift
Expand Up @@ -5,6 +5,8 @@
// Created by david-swift on 23.08.23.
//

import CAdw

/// A text widget.
public typealias Text = Label

Expand All @@ -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) }
}

}

0 comments on commit 2146a4f

Please sign in to comment.