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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
/*
* Fader.cpp
*
* Created on: 21 Aug 2016
* Author: jeremy
*/
#include "Fader.h"
namespace Widgets
{
Fader::Fader(const std::string& name, int instrumentId, int vol)
: instrument(instrumentId), volume(vol), label(name+" "), volScale(Gtk::Orientation::ORIENTATION_HORIZONTAL)
{
this->set_halign(Gtk::Align::ALIGN_FILL);
this->set_hexpand();
// Set title
label.set_halign(Gtk::Align::ALIGN_START);
label.set_justify(Gtk::Justification::JUSTIFY_LEFT);
label.set_xalign(0.f);
label.set_size_request(100, -1);
label.show();
this->attach(label, 0, 0, 1, 1);
// Set scale parameters
volScale.set_range(0, 100);
volScale.set_digits(0);
volScale.set_value_pos(Gtk::PositionType::POS_RIGHT);
volScale.set_halign(Gtk::Align::ALIGN_FILL);
volScale.set_hexpand();
volScale.set_size_request(-1, 24);
volScale.set_value(vol);
volScale.show();
this->attach_next_to(volScale, label, Gtk::PositionType::POS_RIGHT, 1, 1);
this->show();
return;
}
} /* namespace Gui */
|