1 /* This file is part of LED Pattern Editor.
3 * Copyright (C) 2010 Philipp Zabel
5 * LED Pattern Editor is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * LED Pattern Editor is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with LED Pattern Editor. If not, see <http://www.gnu.org/licenses/>.
19 class LedPatternButton : Gtk.Button {
21 Gtk.Label value_label;
23 public LedPatternButton (LedPattern _pattern) {
26 var hbox = new Gtk.HBox (false, Hildon.MARGIN_DOUBLE);
28 var lpv = new LedPatternView (pattern as LedPatternRX51);
29 lpv.set_size_request (200, -1);
30 hbox.pack_start (lpv, false, false, 0);
32 var label_box = new Gtk.VBox (false, 0);
34 var title = new Gtk.Label (pattern.name.has_prefix ("Pattern") ?
35 pattern.name.offset (7) : pattern.name);
36 title.set_alignment (0.0f, 0.5f);
37 label_box.pack_start (title, false, false, 0);
39 value_label = new Gtk.Label ("%.2f s".printf (pattern.duration / 1000.0));
40 value_label.set_alignment (0.0f, 0.5f);
41 Hildon.helper_set_logical_color (value_label, Gtk.RcFlags.FG, Gtk.StateType.NORMAL, "SecondaryTextColor");
42 Hildon.helper_set_logical_color (value_label, Gtk.RcFlags.FG, Gtk.StateType.PRELIGHT, "SecondaryTextColor");
43 Hildon.helper_set_logical_font (value_label, "SmallSystemFont");
44 label_box.pack_start (value_label, true, true, 0);
46 hbox.pack_start (label_box, true, true, 0);
50 pattern.changed.connect (on_pattern_changed);
53 private void on_pattern_changed () {
54 value_label.set_text ("%.2f s".printf (pattern.duration / 1000.0));