blob: 57a440c3b1371a56c8cefafdf000ebb26a927324 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
* Subclass of [[email protected]] which has its policy default to
* [[email protected]].
*
* Its css selector is `scrollable`.
* Its child getter returns the child of the inner
* [[email protected]], instead of the viewport.
*/
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;
}
}
|