tolerance-slider.cpp revision 1e595ddc34dd7090b285ed9f6fc8e125b9a264d9
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop Implementation of tolerance slider widget.
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop * Ralf Stephan <ralf@ark.in-berlin.de>
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop * Copyright (C) 2006 Authors
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop * Released under GNU GPL. Read the file 'COPYING' for more information
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop//===================================================
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop//---------------------------------------------------
727eeb2592befe925906eb7605e9ed770697162bDiederik van Lierop//====================================================
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van LieropToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr)
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop // hbox = label + slider
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop // snap distance |-------X---| 37
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop // vbox = checkbutton
45d2569e428fc3733725b5e64e313e48c2a9d989Diederik van Lierop Gtk::Label *theLabel1 = manage (new Gtk::Label (label1));
727eeb2592befe925906eb7605e9ed770697162bDiederik van Lierop // align the label with the checkbox text above by indenting 22 px.
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop _hscale = manage (new Gtk::HScale (1.0, 51, 1.0));
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop theLabel1->set_mnemonic_widget (*_hscale);
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop _hscale->set_value_pos (Gtk::POS_RIGHT);
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop Gtk::Label *theLabel2 = manage (new Gtk::Label (label2));
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop _button = manage (new Gtk::CheckButton);
72cd517ebd6730a0b8b1b71bdb267ffe9f1d94ffDiederik van Lierop // Here we need some extra pixels to get the vertical spacing right. Why?
f200d31b8a03050faa7243929bbd5698db488399Diederik van Lierop _vbox->pack_end(*_hbox, true, true, 3); // add 3 px.
_scale_changed_connection = _hscale->signal_value_changed().connect (sigc::mem_fun (*this, &ToleranceSlider::on_scale_changed));
_btn_toggled_connection = _button->signal_toggled().connect (sigc::mem_fun (*this, &ToleranceSlider::on_toggled));
if (!dt)