Adding first code drop
[demorecorder] / src / VolumeAndPanPopUp.vala
1 /*  Demo Recorder for MAEMO 5
2 *   Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
3 *   This program is free software; you can redistribute it and/or modify
4 *   it under the terms of the GNU General Public License version 2,
5 *   or (at your option) any later version, as published by the Free
6 *   Software Foundation
7 *
8 *   This program is distributed in the hope that it will be useful,
9 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *   GNU General Public License for more details
12 *
13 *   You should have received a copy of the GNU General Public
14 *   License along with this program; if not, write to the
15 *   Free Software Foundation, Inc.,
16 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 */
18 namespace IdWorks {
19
20 public class VolumeAndPanPopUp : Hildon.Dialog {
21   
22   Gtk.HScale volume_slider;
23   Gtk.HScale panorama_slider;
24
25   public signal void volume_updated(double volume);
26   public signal void panorama_updated(double panorama);
27   
28   public VolumeAndPanPopUp(string title, Gtk.Widget parent) {
29     this.set_title(title);
30     this.set_parent(parent);
31     
32     this.set_default_response(Gtk.ResponseType.ACCEPT);
33     this.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT);
34     
35     Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
36     
37     Gtk.HBox volume_bar = new Gtk.HBox(false, 2);
38     Gtk.Label volume_label = new Gtk.Label("Volume");
39     volume_bar.pack_start(volume_label, false, false , 2);
40     volume_slider = new Gtk.HScale.with_range(0.0, 10.0, 0.05);
41     volume_slider.set_value_pos(Gtk.PositionType.LEFT);
42     volume_slider.value_changed.connect((s) => {volume_updated(s.get_value());});
43     volume_bar.pack_start(volume_slider, true, true , 2);
44     
45     Gtk.HBox panorama_bar = new Gtk.HBox(false, 2);
46     Gtk.Label panorama_label = new Gtk.Label("Pan");
47     panorama_bar.pack_start(panorama_label, false, false , 2);
48     panorama_slider = new Gtk.HScale.with_range(-1.0, 1.0, 0.05);
49     panorama_slider.set_value_pos(Gtk.PositionType.LEFT);
50     panorama_slider.value_changed.connect((s) => {panorama_updated(s.get_value());});
51     panorama_bar.pack_start(panorama_slider, true, true , 2);
52     
53     control_area.pack_start(volume_bar, true, true , 2);
54     control_area.pack_start(panorama_bar, true, true , 2);
55     this.show_all();
56   }
57   
58   public void set_volume(double volume) {
59     volume_slider.set_value(volume);
60   }
61   
62   public void set_panorama(double panorama) {
63     panorama_slider.set_value(panorama);
64   }
65
66 }
67
68 }