~donadigo/+junk/euclide-bazaar

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
public class Granite.Widgets.ToolArrow : Gtk.ToolItem {
    
    public signal void clicked ();
    Gtk.ToggleButton button;
    
    public ToolArrow() {
        
        Gtk.CssProvider css = new Gtk.CssProvider ();
        try {
            css.load_from_data ("* { padding-left:0; padding-right:0; }", -1);
        } catch (Error e) {
            warning (e.message);
        }
        
        var arrow = new Gtk.Arrow (Gtk.ArrowType.DOWN, Gtk.ShadowType.OUT);
        button = new Gtk.ToggleButton ();
        button.button_press_event.connect (() => { clicked (); return true; });
        button.add (arrow);
        button.get_style_context ().add_provider (css, 800);
        button.set_relief (Gtk.ReliefStyle.NONE);
        add (button);
        show_all ();
    }
    
    public new void set_state (bool v) {
        button.active = v;
    }
}