-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscrollablePopupMenu.js
53 lines (40 loc) · 1.56 KB
/
scrollablePopupMenu.js
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
49
50
51
52
53
const BoxPointer = imports.ui.boxpointer;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const PopupMenu = imports.ui.popupMenu;
const St = imports.gi.St;
const ScrollablePopupMenu = new Lang.Class({
Name: 'ScrollablePopupMenu',
Extends: PopupMenu.PopupMenu,
_init: function(sourceActor, arrowAlignment, arrowSide) {
PopupMenu.PopupMenuBase.prototype._init.call(this, sourceActor, 'popup-menu-content');
this._arrowAlignment = arrowAlignment;
this._arrowSide = arrowSide;
this._boxPointer = new BoxPointer.BoxPointer(arrowSide, {
x_fill: true,
y_fill: true,
x_align: St.Align.START
});
this.actor = this._boxPointer.actor;
this.scroller = new St.ScrollView({
hscrollbar_policy: Gtk.PolicyType.NEVER,
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC
});
this.boxlayout = new St.BoxLayout({
vertical: true
});
this.scroller.add_actor(this.box);
this.boxlayout.add(this.scroller);
this.bottomSection = new St.BoxLayout({
vertical: true,
style_class: 'bottomSection'
});
this.bottomSection.set_style('padding-bottom: 12px');
this.boxlayout.add(this.bottomSection);
this.actor._delegate = this;
this.actor.style_class = 'popup-menu-boxpointer';
this._boxPointer.bin.set_child(this.boxlayout);
this.actor.add_style_class_name('popup-menu');
this.box.set_style('padding-bottom: 0; padding-left:15px;');
}
});