diff options
author | Aylur <[email protected]> | 2024-07-27 13:52:29 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-07-27 13:52:29 +0200 |
commit | cf2260d5a8d4163f451029b53327cbe3b6ee73ab (patch) | |
tree | d677248316abc8e482ff1faae496ca66ff7fec17 /src | |
parent | 22132efcdeb08569cc27ca5414a0bb47511872d6 (diff) |
add: Label widget
Diffstat (limited to 'src')
-rw-r--r-- | src/meson.build | 1 | ||||
-rw-r--r-- | src/widget/label.vala | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/meson.build b/src/meson.build index 0bc73a1..0dac152 100644 --- a/src/meson.build +++ b/src/meson.build @@ -33,6 +33,7 @@ sources = [ # 'widget/circularprogress.vala', # TODO: math lib -X -lm 'widget/eventbox.vala', 'widget/icon.vala', + 'widget/label.vala', 'widget/levelbar.vala', 'widget/overlay.vala', 'widget/scrollable.vala', diff --git a/src/widget/label.vala b/src/widget/label.vala new file mode 100644 index 0000000..4063b6f --- /dev/null +++ b/src/widget/label.vala @@ -0,0 +1,18 @@ +using Pango; + +public class Astal.Label : Gtk.Label { + public bool truncate { + set { ellipsize = value ? EllipsizeMode.END : EllipsizeMode.NONE; } + get { return ellipsize == EllipsizeMode.END; } + } + + public new bool justify_fill { + set { justify = value ? Gtk.Justification.FILL : Gtk.Justification.LEFT; } + get { return justify == Gtk.Justification.FILL; } + } + + construct { + notify["ellipsize"].connect(() => notify_property("truncate")); + notify["justify"].connect(() => notify_property("justify_fill")); + } +} |