Gtk::Widget* PrefPage::appendEntry(const std::string& name, const std::string& registryKey) { Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0)); alignment->show(); Gtk::Entry* entry = Gtk::manage(new Gtk::Entry); entry->set_width_chars(static_cast<gint>(std::max(GlobalRegistry().get(registryKey).size(), std::size_t(30)))); alignment->add(*entry); // Connect the registry key to the newly created input field registry::bindPropertyToBufferedKey(entry->property_text(), registryKey, _registryBuffer, _resetValuesSignal); appendNamedWidget(name, *alignment); return entry; }
Gtk::Widget* PrefPage::appendSpinner(const std::string& name, const std::string& registryKey, double lower, double upper, int fraction) { // Load the initial value (maybe unnecessary, as the value is loaded upon dialog show) float value = registry::getValue<float>(registryKey); Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0)); alignment->show(); Gtk::SpinButton* spin = createSpinner(value, lower, upper, fraction); alignment->add(*spin); // Connect the registry key to the newly created input field registry::bindPropertyToBufferedKey(spin->property_value(), registryKey, _registryBuffer, _resetValuesSignal); appendNamedWidget(name, *alignment); return spin; }
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); }
void ErrorPopup::show_msg() { dialog = new Gtk::MessageDialog(msg, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); dialog->set_keep_above(true); //Gtk::VBox *ma = dialog->get_message_area(); // not in Gtkmm 0.20 //FIXME: no comment :-) Gtk::VBox *ma = dynamic_cast<Gtk::VBox*>( *(++dynamic_cast<Gtk::HBox*>( *dialog->get_vbox()->get_children().begin())->get_children().begin())); // add an alignment parent to the label widget inside the message area // should better define our own dialog instead of hacking MessageDialog... Gtk::Alignment *align = new Gtk::Alignment(); align->show(); dynamic_cast<Gtk::Label*>(*ma->get_children().begin())->reparent(*align); ma->pack_start(*manage(align)); align->set_padding(50,20,0,10); Gtk::VBox *vbox = dynamic_cast<Gtk::VBox *>(dialog->get_child()); vbox->set_redraw_on_allocate(true); vbox->signal_expose_event().connect( sigc::group(&gx_cairo::error_box_expose,GTK_WIDGET(vbox->gobj()),sigc::_1,(void*)0),false); dialog->set_title(_("GUITARIX ERROR")); dialog->signal_response().connect( sigc::mem_fun(*this, &ErrorPopup::on_response)); dialog->show(); }