summaryrefslogtreecommitdiff
path: root/lib/astal/gtk3/src/widget/scrollable.vala
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-10-14 16:45:03 +0000
committerAylur <[email protected]>2024-10-14 16:45:03 +0000
commit9fab13452a26ed55c01047d4225f699f43bba20d (patch)
tree8dc3097994e8664572c3a94a62257604bdaa1f8d /lib/astal/gtk3/src/widget/scrollable.vala
parent6a8c41cd1d5e218d0dacffb836fdd7d4ec6333dd (diff)
feat: Astal3
Diffstat (limited to 'lib/astal/gtk3/src/widget/scrollable.vala')
-rw-r--r--lib/astal/gtk3/src/widget/scrollable.vala40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/astal/gtk3/src/widget/scrollable.vala b/lib/astal/gtk3/src/widget/scrollable.vala
new file mode 100644
index 0000000..57afb6e
--- /dev/null
+++ b/lib/astal/gtk3/src/widget/scrollable.vala
@@ -0,0 +1,40 @@
+public class Astal.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;
+ }
+}