summaryrefslogtreecommitdiff
path: root/wikipedia/widgets/BoxWithBg.js
blob: 6d38bd3f3e0caaff1aed3faffff20810f53af9f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;

const BoxWithBg = new Lang.Class({
    Name: "BoxWithBg",
    Extends: Gtk.Box,

    vfunc_draw: function(cr) {
        let width = this.get_allocated_width();
        let height = this.get_allocated_height();
        let context = this.get_style_context();
        Gtk.render_background(context, cr, 0, 0, width, height);
        Gtk.render_frame(context, cr, 0, 0, width, height);

        let ret = this.parent(cr);
        cr.$dispose();
        return ret;
    }
});