Debian Codegraph @

Source/Widgets/Fader.cpp

raw
1 /*
2 * Fader.cpp
3 *
4 * Created on: 21 Aug 2016
5 * Author: jeremy
6 */
7
8 #include "Fader.h"
9
10 namespace Widgets
11 {
12
13 Fader::Fader(const std::string& name, int instrumentId, int vol)
14 : instrument(instrumentId), volume(vol), label(name+" "), volScale(Gtk::Orientation::ORIENTATION_HORIZONTAL)
15 {
16
17 this->set_halign(Gtk::Align::ALIGN_FILL);
18 this->set_hexpand();
19
20 // Set title
21 label.set_halign(Gtk::Align::ALIGN_START);
22 label.set_justify(Gtk::Justification::JUSTIFY_LEFT);
23 label.set_xalign(0.f);
24 label.set_size_request(100, -1);
25 label.show();
26 this->attach(label, 0, 0, 1, 1);
27
28 // Set scale parameters
29 volScale.set_range(0, 100);
30 volScale.set_digits(0);
31 volScale.set_value_pos(Gtk::PositionType::POS_RIGHT);
32 volScale.set_halign(Gtk::Align::ALIGN_FILL);
33 volScale.set_hexpand();
34 volScale.set_size_request(-1, 24);
35
36 volScale.set_value(vol);
37
38 volScale.show();
39 this->attach_next_to(volScale, label, Gtk::PositionType::POS_RIGHT, 1, 1);
40
41 this->show();
42
43 return;
44 }
45
46
47 } /* namespace Gui */