From 0738194780ce52b9047c430b9498487417b2cd07 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sun, 1 Sep 2024 02:06:50 +0200 Subject: move libastal to /core starting point of the monorepo --- core/src/widget/scrollable.vala | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 core/src/widget/scrollable.vala (limited to 'core/src/widget/scrollable.vala') diff --git a/core/src/widget/scrollable.vala b/core/src/widget/scrollable.vala new file mode 100644 index 0000000..1a0e081 --- /dev/null +++ b/core/src/widget/scrollable.vala @@ -0,0 +1,42 @@ +namespace Astal { +public class Scrollable : Gtk.ScrolledWindow { + private Gtk.PolicyType _hscroll = Gtk.PolicyType.AUTOMATIC; + private Gtk.PolicyType _vscroll = Gtk.PolicyType.AUTOMATIC; + + public Gtk.PolicyType hscroll { + get { return _hscroll; } + set { + _hscroll = value; + set_policy(value, vscroll); + } + } + + public Gtk.PolicyType vscroll { + get { return _vscroll; } + set { + _vscroll = value; + set_policy(hscroll, value); + } + } + + static construct { + set_css_name("scrollable"); + } + + construct { + if (hadjustment != null) + hadjustment = new Gtk.Adjustment(0,0,0,0,0,0); + + if (vadjustment != null) + vadjustment = new Gtk.Adjustment(0,0,0,0,0,0); + } + + public new Gtk.Widget get_child() { + var ch = base.get_child(); + if (ch is Gtk.Viewport) { + return ch.get_child(); + } + return ch; + } +} +} -- cgit v1.2.3