void JointVelocityControlWidget::init(ref<BasicEnvironment> env, ref<Robot> robot, Int index, ref<ControlInterface> interface) { velInterface = interface; // Joint velocity controls Gtk::VBox* jointControlBox = new Gtk::VBox(false,5); Int dof = velInterface->inputSize(); velAdjustments.clear(); for(Int j=0; j<dof; j++) { Gtk::HBox* hbox = new Gtk::HBox(); Gtk::Label* label = new Gtk::Label(base::intToString(j)+":"); hbox->pack_start(*manage(label), Gtk::PACK_SHRINK,5); Gtk::Adjustment* adj = new Gtk::Adjustment(0,-3,3,0.01,0.1); velAdjustments.push_back(adj); Gtk::HScale* scale = new Gtk::HScale(*manage(adj)); scale->set_draw_value(true); scale->set_digits(2); scale->set_value_pos(Gtk::POS_LEFT); scale->set_update_policy(Gtk::UPDATE_CONTINUOUS); scale->set_size_request(100,-1); hbox->pack_end(*manage(scale)); jointControlBox->pack_start(*manage(hbox),false,false); adj->signal_value_changed().connect( SigC::bind<Int>( SigC::slot(*this, &JointVelocityControlWidget::jointVelScaleChanged ), j) ); } pack_start(*manage(jointControlBox)); }
void PrefPage::appendSlider(const std::string& name, const std::string& registryKey, bool drawValue, double value, double lower, double upper, double step_increment, double page_increment, double page_size) { // Create a new adjustment with the boundaries <lower> and <upper> and all the increments Gtk::Adjustment* adj = Gtk::manage(new Gtk::Adjustment(value, lower, upper, step_increment, page_increment, page_size)); // Connect the registry key to this adjustment registry::bindPropertyToBufferedKey(adj->property_value(), registryKey, _registryBuffer, _resetValuesSignal); // scale Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0)); alignment->show(); Gtk::HScale* scale = Gtk::manage(new Gtk::HScale(*adj)); scale->set_value_pos(Gtk::POS_LEFT); scale->show(); alignment->add(*scale); scale->set_draw_value(drawValue); scale->set_digits((step_increment < 1.0f) ? 2 : 0); appendNamedWidget(name, *alignment); }