1
/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
3
* Copyright (C) 2012 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Authors: Michael Terry <michael.terry@canonical.com>
20
public class FlatButton : Gtk.Button
22
private bool did_press;
26
UnityGreeter.add_style_class (this);
29
var style = new Gtk.CssProvider ();
30
style.load_from_data ("* {-GtkButton-child-displacement-x: 0px;
31
-GtkButton-child-displacement-y: 0px;
32
-GtkWidget-focus-line-width: 1px;
34
get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
38
debug ("Internal error loading session chooser style: %s", e.message);
42
public override bool draw (Cairo.Context c)
44
// Make sure we don't react to mouse hovers
45
unset_state_flags (Gtk.StateFlags.PRELIGHT);
49
public override void pressed ()
51
// Do nothing. The normal handler sets priv->button_down which
52
// internally causes draw() to draw a special border and background
53
// that we don't want.
57
public override void released ()
61
base.pressed (); // fake an insta-click