c_PreferencesDlg::c_PreferencesDlg() { set_title(_("Preferences")); InitControls(); signal_response().connect(sigc::mem_fun(*this, &c_PreferencesDlg::OnResponse)); Utils::RestorePosSize(Configuration::PreferencesDlgPosSize, *this); }
void CreateWireframeDialog::on_my_response(int response_id) { switch (response_id) { case Gtk::RESPONSE_OK: { this->create_shape(); break; } case Gtk::RESPONSE_APPLY: { std::cout << "User required to add another point." << std::endl; this->add_point(); signal_response().emission_stop(); break; } case Gtk::RESPONSE_CANCEL: { std::cout << "User cancelled the operation." << std::endl; break; } case Gtk::RESPONSE_DELETE_EVENT: { std::cout << "User shut the window." << std::endl; break; } } }
DlgDownload::DlgDownload(){ add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); signal_response().connect( sigc::hide(sigc::mem_fun(this, &DlgDownload::hide_all))); cb_w = manage(new Gtk::CheckButton("Waypoints")); cb_a = manage(new Gtk::CheckButton("Active log")); cb_o = manage(new Gtk::CheckButton("Saved tracks")); Gtk::VButtonBox * bbox = manage(new Gtk::VButtonBox); bbox->add(*cb_w); bbox->add(*cb_a); bbox->add(*cb_o); Gtk::Frame * frame = manage(new Gtk::Frame("Select data to be downloaded:")); frame->add(*bbox); Gtk::Label * l_dev = manage(new Gtk::Label("GPS device:", Gtk::ALIGN_RIGHT)); e_dev = manage(new Gtk::Entry); cb_off = manage(new Gtk::CheckButton("Turn off device after download")); Gtk::Table * table = manage(new Gtk::Table(2,3)); table->attach(*frame, 0,2, 0,1, Gtk::FILL, Gtk::SHRINK, 3,3); table->attach(*l_dev, 0,1, 1,2, Gtk::SHRINK, Gtk::SHRINK, 3,3); table->attach(*e_dev, 1,2, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 3,3); table->attach(*cb_off, 0,2, 2,3, Gtk::FILL, Gtk::SHRINK, 3,3); get_vbox()->add(*table); }
JoystickListWidget::JoystickListWidget() : Gtk::Dialog("Joystick Preferences"), label("Below is a list of available joysticks on the system. Press Refresh to " "update the list, press Properties to get a separate device dialog. The " "devices listed are only joystick devices, not evdev devices or SDL " "devices, you can view the other ones via the top tab.") //frame("Device List"), { set_has_separator(false); set_default_size(450, 310); label.set_line_wrap(); scrolled.set_border_width(5); scrolled.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scrolled.add(treeview); get_vbox()->add(scrolled); add_button(Gtk::Stock::REFRESH, 2); add_button(Gtk::Stock::PROPERTIES, 1); add_button(Gtk::Stock::CLOSE, 0); signal_response().connect(sigc::mem_fun(this, &JoystickListWidget::on_response)); // Set model device_list = Gtk::ListStore::create(DeviceListColumns::instance()); treeview.set_model(device_list); treeview.set_headers_visible(false); treeview.append_column("Icon", DeviceListColumns::instance().icon); treeview.append_column("Name", DeviceListColumns::instance().name); treeview.signal_row_activated().connect(sigc::mem_fun(this, &JoystickListWidget::on_row_activated)); on_refresh(); }
void Dialog::response(int r) { _response = r; hide(); signal_response().emit(r); std::map<int, sigc::signal<void> >::iterator iter = _signal_certain_response.find(r); if(iter!=_signal_certain_response.end()) iter->second.emit(); }
CreateWireframeDialog::CreateWireframeDialog(const Glib::ustring & title) : Dialog(title, true), m_filled(false), m_minVertices(false), m_coordBox(Gtk::manage(new CoordBox())), m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))), m_nameEntry(Gtk::manage(new Gtk::Entry())) { set_size_request(-1, 230); set_resizable(false); set_border_width(10); // Entry for the name Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox()); name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0); name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0); name_hbox->set_spacing(0); name_hbox->set_homogeneous(false); // Check box for filling Gtk::CheckButton * const filled_button = Gtk::manage(new Gtk::CheckButton("Filled shape")); filled_button->signal_toggled().connect(sigc::mem_fun(*this, &CreateWireframeDialog::on_filled_button_toggled)); filled_button->set_active(false); get_content_area()->pack_start(*name_hbox, Gtk::PACK_SHRINK, 5); get_content_area()->pack_start(*filled_button, Gtk::PACK_SHRINK, 5); Gtk::Frame * const coord_frame = Gtk::manage(new Gtk::Frame("Points")); Gtk::ScrolledWindow * const scrolled_window = Gtk::manage(new Gtk::ScrolledWindow()); scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolled_window->set_size_request(-1, 150); scrolled_window->set_border_width(5); scrolled_window->add(*m_coordBox); m_coordBox->set_spacing(0); coord_frame->add(*scrolled_window); get_content_area()->pack_start(*coord_frame, Gtk::PACK_SHRINK, 0); // Entries for the coordinates m_coordBox->add_coord(); m_coordBox->add_coord(); m_coordBox->add_coord(); // Add buttons (from left to right) add_button("Cancel", Gtk::RESPONSE_CANCEL); add_button("Add point", Gtk::RESPONSE_APPLY); add_button("OK", Gtk::RESPONSE_OK); signal_response().connect_notify(sigc::mem_fun(*this, &CreateWireframeDialog::on_my_response)); set_default_response(Gtk::RESPONSE_OK); show_all_children(); }
CreatePointDialog::CreatePointDialog(const Glib::ustring & title) : Dialog(title, true), m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))), m_xLabel(Gtk::manage(new Gtk::Label("x: "))), m_yLabel(Gtk::manage(new Gtk::Label("y: "))), m_zLabel(Gtk::manage(new Gtk::Label("z: "))), m_nameEntry(Gtk::manage(new Gtk::Entry())), m_xEntry(Gtk::manage(new Gtk::Entry())), m_yEntry(Gtk::manage(new Gtk::Entry())), m_zEntry(Gtk::manage(new Gtk::Entry())) { set_resizable(false); set_border_width(10); /* Entries size */ m_xEntry->set_width_chars(6); m_yEntry->set_width_chars(6); m_zEntry->set_width_chars(6); Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox()); name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0); name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0); name_hbox->set_homogeneous(false); Gtk::HBox * const coord_hbox = Gtk::manage(new Gtk::HBox()); coord_hbox->pack_start(*m_xLabel, Gtk::PACK_EXPAND_PADDING, 0); coord_hbox->pack_start(*m_xEntry, Gtk::PACK_SHRINK, 0); coord_hbox->pack_start(*m_yLabel, Gtk::PACK_EXPAND_PADDING, 0); coord_hbox->pack_start(*m_yEntry, Gtk::PACK_SHRINK, 0); coord_hbox->pack_start(*m_zLabel, Gtk::PACK_EXPAND_PADDING, 0); coord_hbox->pack_start(*m_zEntry, Gtk::PACK_SHRINK, 0); coord_hbox->set_homogeneous(false); get_content_area()->pack_start(*name_hbox); get_content_area()->pack_start(*coord_hbox); add_button("Cancel", Gtk::RESPONSE_CANCEL); add_button("OK", Gtk::RESPONSE_OK); signal_response().connect_notify(sigc::mem_fun(*this, &CreatePointDialog::on_my_response)); set_default_response(Gtk::RESPONSE_OK); show_all_children(); }
JoystickCalibrationWidget::JoystickCalibrationWidget(Joystick& joystick) : Gtk::Dialog("Calibration: " + joystick.get_name()), joystick(joystick), label("The <i>center</i> values are the minimum and the maximum values of the deadzone. " "The <i>min</i> and <i>max</i> values refer to the outer values. You have to unplug " "your joystick or reboot to reset the values to their original default.\n" "\n" "To run the calibration wizard, press the <i>Calibrate</i> button."), axis_frame("Axes"), axis_table(joystick.get_axis_count() + 1, 5), buttonbox(Gtk::BUTTONBOX_SPREAD), calibration_button("Start Calibration") { set_has_separator(false); set_border_width(5); axis_frame.set_border_width(5); axis_table.set_border_width(5); label.set_use_markup(true); label.set_line_wrap(); get_vbox()->pack_start(label, Gtk::PACK_SHRINK); calibration_button.signal_clicked().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_calibrate)); buttonbox.set_border_width(5); buttonbox.add(calibration_button); get_vbox()->pack_start(buttonbox, Gtk::PACK_SHRINK); axis_table.attach(*Gtk::manage(new Gtk::Label("Axes")), 0, 1, 0, 1); axis_table.attach(*Gtk::manage(new Gtk::Label("CenterMin")), 1, 2, 0, 1); axis_table.attach(*Gtk::manage(new Gtk::Label("CenterMax")), 2, 3, 0, 1); axis_table.attach(*Gtk::manage(new Gtk::Label("RangeMin")), 3, 4, 0, 1); axis_table.attach(*Gtk::manage(new Gtk::Label("RangeMax")), 4, 5, 0, 1); axis_table.attach(*Gtk::manage(new Gtk::Label("Invert")), 5, 6, 0, 1); axis_table.set_col_spacing(2, 8); for(int i = 0; i < joystick.get_axis_count(); ++i) { CalibrationData data; Gtk::SpinButton& center_min = *Gtk::manage(new Gtk::SpinButton(*Gtk::manage(data.center_min = new Gtk::Adjustment(0, -32768, 32767)))); Gtk::SpinButton& center_max = *Gtk::manage(new Gtk::SpinButton(*Gtk::manage(data.center_max = new Gtk::Adjustment(0, -32768, 32767)))); Gtk::SpinButton& range_min = *Gtk::manage(new Gtk::SpinButton(*Gtk::manage(data.range_min = new Gtk::Adjustment(0, -32768, 32767)))); Gtk::SpinButton& range_max = *Gtk::manage(new Gtk::SpinButton(*Gtk::manage(data.range_max = new Gtk::Adjustment(0, -32768, 32767)))); Gtk::CheckButton& invert = *(data.invert = Gtk::manage(new Gtk::CheckButton())); center_min.signal_value_changed().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_apply)); center_max.signal_value_changed().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_apply)); range_min.signal_value_changed().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_apply)); range_max.signal_value_changed().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_apply)); invert.signal_clicked().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_apply)); center_min.set_tooltip_text("The minimal value of the dead zone"); center_max.set_tooltip_text("The maximum value of the dead zone"); range_min.set_tooltip_text("The minimal position reachable"); range_max.set_tooltip_text("The maximum position reachable"); calibration_data.push_back(data); std::ostringstream str; str << i; axis_table.attach(*Gtk::manage(new Gtk::Label(str.str())), 0, 1, i+1, i+2); axis_table.attach(center_min, 1, 2, i+1, i+2); axis_table.attach(center_max, 2, 3, i+1, i+2); axis_table.attach(range_min, 3, 4, i+1, i+2); axis_table.attach(range_max, 4, 5, i+1, i+2); axis_table.attach(invert, 5, 6, i+1, i+2, Gtk::SHRINK, Gtk::SHRINK); } add_button(Gtk::Stock::REVERT_TO_SAVED, 2); add_button("Raw Events", 1); add_button(Gtk::Stock::CLOSE, 0); axis_frame.add(axis_table); get_vbox()->pack_start(axis_frame, Gtk::PACK_EXPAND_WIDGET); signal_response().connect(sigc::mem_fun(this, &JoystickCalibrationWidget::on_response)); update_with(joystick.get_calibration()); }
void file_chooser::on_response (int response_id) { if (Gtk::RESPONSE_ACCEPT != response_id) return; if (get_current_extension ().empty ()) set_current_extension (default_extension_); std::string fmt; { // check whether extension is known std::string ext (get_current_extension ()); bool found = false; Gtk::TreeModel::Children children (file_type_.get_model ()->children ()); for (Gtk::TreeModel::Children::const_iterator it = children.begin (); !found && children.end () != it; ++it) { Gtk::TreeModel::Row r = *it; extension_list l = r[column->exts]; found = count (l.begin (), l.end (), ext); if (found) fmt = r[column->text]; } if (!found) { Gtk::MessageDialog tbd (*this, _("Unsupported file format."), use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal); tbd.set_secondary_text ((format (_("The '%1%' file extension is not associated with" " a supported file format. Please select a file" " format or use one of the known file extensions.")) % ext).str ()); if (dynamic_cast< Gtk::Window * > (this)) get_group ()->add_window (tbd); tbd.run (); signal_response ().emission_stop (); response (Gtk::RESPONSE_CANCEL); return; } } if (!single_image_mode_ && requests_single_file (get_current_name ())) { // check whether single file is okay if (!supports_multi_image (get_current_name ())) { Gtk::MessageDialog tbd (*this, (format (_("The %1% format does not support multiple" " images in a single file.")) % fmt).str (), use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal); tbd.set_secondary_text ((format (_("Please save to PDF or TIFF if you want a single" " file. If you prefer the %1% image format, use" " a filename such as 'Untitled-%%3i%2%'.")) % fmt % get_current_extension ()).str ()); if (dynamic_cast< Gtk::Window * > (this)) get_group ()->add_window (tbd); tbd.run (); signal_response ().emission_stop (); response (Gtk::RESPONSE_CANCEL); return; } } if (!do_overwrite_confirmation_) return; format message; format details; if (requests_single_file (get_current_name ())) { if (!fs::exists (std::string (get_filename ()))) return; message = format (_("The name \"%1%\" already exists.\n" "OK to overwrite this name using the new settings?")); details = format (_("The file already exists in \"%1%\"." " Replacing it will overwrite its contents.")); } else { // FIXME Add meaningful checking // if (no_possible_matches ) return; message = format (_("Files matching \"%1%\" may already exist." " Do you want to replace them?")); //details = format (_("These files already exist in \"%1%\"." // " Replacing them may overwrite their contents.")); // FIXME show list of matching files in an expander with details } message % get_current_name (); if (0 < details.size ()) details % get_current_folder (); Gtk::MessageDialog tbd (*this, message.str (), use_markup, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, modal); if (0 < details.size ()) tbd.set_secondary_text (details.str ()); tbd.add_button (Gtk::Stock::NO , Gtk::RESPONSE_CANCEL); tbd.add_button (Gtk::Stock::YES, Gtk::RESPONSE_ACCEPT); tbd.set_default_response (Gtk::RESPONSE_ACCEPT); if (dynamic_cast< Gtk::Window * > (this)) get_group ()->add_window (tbd); if (Gtk::RESPONSE_ACCEPT != tbd.run ()) { signal_response ().emission_stop (); response (Gtk::RESPONSE_CANCEL); } }
void MessageDialog::EmitResponse(ResponseType response) { signal_response(*this, response); }
DlgChConf::DlgChConf(): Gtk::MessageDialog(ch_conf_text, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL){ signal_response().connect( sigc::mem_fun(this, &DlgChConf::on_result)); }
JoystickTestWidget::JoystickTestWidget(Joystick& joystick_, bool simple_ui) : Gtk::Dialog(joystick_.get_name()), joystick(joystick_), m_simple_ui(simple_ui), label("<b>" + joystick.get_name() + "</b>\nDevice: " + joystick.get_filename() , Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER), axis_frame("Axes"), button_frame("Buttons"), mapping_button("Mapping"), calibration_button("Calibration"), buttonbox(Gtk::BUTTONBOX_SPREAD), stick1_widget(128, 128), stick2_widget(128, 128), stick3_widget(128, 128), rudder_widget(128, 32), throttle_widget(32, 128), left_trigger_widget(32, 128, true), right_trigger_widget(32, 128, true) { label.set_use_markup(true); label.set_selectable(); axis_frame.set_border_width(5); axis_table.set_border_width(5); axis_table.set_spacings(5); button_frame.set_border_width(5); button_table.set_border_width(5); button_table.set_spacings(8); buttonbox.set_border_width(5); for(int i = 0; i < joystick.get_axis_count(); ++i) { std::ostringstream str; str << "Axis " << i << ": "; Gtk::Label& label = *Gtk::manage(new Gtk::Label(str.str())); Gtk::ProgressBar& progressbar = *Gtk::manage(new Gtk::ProgressBar()); progressbar.set_fraction(0.5); //Each column must have at most 10 axes int x = (i/10)*2; int y = i%10; axis_table.attach(label, x, x+1, y, y+1, Gtk::SHRINK, Gtk::FILL); axis_table.attach(progressbar, x+1, x+2, y, y+1, Gtk::FILL|Gtk::EXPAND, Gtk::EXPAND); axes.push_back(&progressbar); } for(int i = 0; i < joystick.get_button_count(); ++i) { int x = i / 10; int y = i % 10; std::ostringstream str; str << i; ButtonWidget& button = *Gtk::manage(new ButtonWidget(32, 32, str.str())); button_table.attach(button, x, x+1, y, y+1, Gtk::EXPAND, Gtk::EXPAND); buttons.push_back(&button); } alignment.set_padding(8, 8, 8, 8); alignment.add(label); get_vbox()->pack_start(alignment, Gtk::PACK_SHRINK); buttonbox.add(mapping_button); buttonbox.add(calibration_button); test_hbox.pack_start(axis_frame, Gtk::PACK_EXPAND_WIDGET); test_hbox.pack_start(button_frame, Gtk::PACK_EXPAND_WIDGET); get_vbox()->pack_start(test_hbox, Gtk::PACK_SHRINK); get_vbox()->pack_start(buttonbox, Gtk::PACK_SHRINK); stick_hbox.set_border_width(5); axis_callbacks.clear(); // Using manual loop instead of resize, as else all the signals // would be clones of each other, instead of individual signals for(int i = 0; i < (int)joystick.get_axis_count(); ++i) axis_callbacks.push_back(sigc::signal<void, double>()); switch(joystick.get_axis_count()) { case 2: // Simple stick stick_hbox.pack_start(stick1_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); break; case 6: // Flightstick { Gtk::Table& table = *Gtk::manage(new Gtk::Table(2, 2)); table.attach(stick1_widget, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); table.attach(rudder_widget, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); table.attach(throttle_widget, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); stick_hbox.pack_start(table, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick3_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); axis_callbacks[2].connect(sigc::mem_fun(rudder_widget, &RudderWidget::set_pos)); axis_callbacks[3].connect(sigc::mem_fun(throttle_widget, &ThrottleWidget::set_pos)); axis_callbacks[4].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_x_axis)); axis_callbacks[5].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_y_axis)); break; } /* // Dual Analog Gamepad // FIXME: never reached as this is the same as Flightstick, no // way to tell them apart from simple axis count stick_hbox.pack_start(stick1_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick2_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick3_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); axis_callbacks[2].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_x_axis)); axis_callbacks[3].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_y_axis)); axis_callbacks[4].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_x_axis)); axis_callbacks[5].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_y_axis)); */ case 8: // Dual Analog Gamepad + Analog Trigger stick_hbox.pack_start(stick1_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick2_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick3_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(left_trigger_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(right_trigger_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); axis_callbacks[2].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_x_axis)); axis_callbacks[3].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_y_axis)); axis_callbacks[6].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_x_axis)); axis_callbacks[7].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_y_axis)); axis_callbacks[4].connect(sigc::mem_fun(left_trigger_widget, &ThrottleWidget::set_pos)); axis_callbacks[5].connect(sigc::mem_fun(right_trigger_widget, &ThrottleWidget::set_pos)); break; case 7: // Dual Analog Gamepad DragonRise Inc. Generic USB Joystick stick_hbox.pack_start(stick1_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick2_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick3_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); axis_callbacks[3].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_x_axis)); axis_callbacks[4].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_y_axis)); axis_callbacks[5].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_x_axis)); axis_callbacks[6].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_y_axis)); break; case 27: // Playstation 3 Controller stick_hbox.pack_start(stick1_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(stick2_widget, Gtk::PACK_EXPAND_PADDING); // Not using stick3 for now, as the dpad is 4 axis on the PS3, not 2 (one for each direction) //stick_hbox.pack_start(stick3_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(left_trigger_widget, Gtk::PACK_EXPAND_PADDING); stick_hbox.pack_start(right_trigger_widget, Gtk::PACK_EXPAND_PADDING); axis_callbacks[0].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_x_axis)); axis_callbacks[1].connect(sigc::mem_fun(stick1_widget, &AxisWidget::set_y_axis)); axis_callbacks[2].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_x_axis)); axis_callbacks[3].connect(sigc::mem_fun(stick2_widget, &AxisWidget::set_y_axis)); //axis_callbacks[6].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_x_axis)); //axis_callbacks[7].connect(sigc::mem_fun(stick3_widget, &AxisWidget::set_y_axis)); axis_callbacks[12].connect(sigc::mem_fun(left_trigger_widget, &ThrottleWidget::set_pos)); axis_callbacks[13].connect(sigc::mem_fun(right_trigger_widget, &ThrottleWidget::set_pos)); break; default: std::cout << "Warning: unknown joystick, not displaying graphical representation." << std::endl; } if (!m_simple_ui) { axis_vbox.pack_start(stick_hbox, Gtk::PACK_SHRINK); } axis_vbox.add(axis_table); axis_frame.add(axis_vbox); button_frame.add(button_table); add_button(Gtk::Stock::CLOSE, 0); signal_response().connect(sigc::mem_fun(this, &JoystickTestWidget::on_response)); joystick.axis_move.connect(sigc::mem_fun(this, &JoystickTestWidget::axis_move)); joystick.button_move.connect(sigc::mem_fun(this, &JoystickTestWidget::button_move)); calibration_button.signal_clicked().connect(sigc::mem_fun(this, &JoystickTestWidget::on_calibrate)); mapping_button.signal_clicked().connect(sigc::mem_fun(this, &JoystickTestWidget::on_mapping)); }
void InputDialog::EmitResponse(ResponseType response) { signal_response(*this, response); }
preferencesDialog::preferencesDialog(int const _min_port, int const _max_port) : portrange_begin(0), beginPortRangeSpinbuttonAdj(0), portrange_end(0), endPortRangeSpinbuttonAdj(0), workPathEntry(0), outputPathEntry(0), leechModeCheckbutton(0), min_port(_max_port), max_port(_min_port), workPath(), outputPath(), leechmode(false), portrange_begin_intial_value(0), portrange_end_intial_value(0), workPath_initial_value(""), outputPath_initial_value(""), leechmode_initial_value(false), portrange_begin_signal(), portrange_end_signal(), save_btn_pressed(false) { Gtk::Label* workLabel = Gtk::manage(new class Gtk::Label("Working directory")); Gtk::Label* outputLabel = Gtk::manage(new class Gtk::Label("Output directory")); Gtk::Label* portRangeLabel = Gtk::manage(new class Gtk::Label("Port range")); Gtk::Label* leechModeLabel = Gtk::manage(new class Gtk::Label("Leech mode")); outputPathEntry = Gtk::manage(new class Gtk::Entry()); workPathEntry = Gtk::manage(new class Gtk::Entry()); leechModeCheckbutton = Gtk::manage(new class Gtk::CheckButton("enabled")); Gtk::Table* settingsTable = Gtk::manage(new class Gtk::Table(2, 2, false)); // Ports: Gtk::Table* portTable = Gtk::manage(new class Gtk::Table(2, 2, false));; Gtk::Label* beginPortLabel = Gtk::manage(new class Gtk::Label("Begin Port")); Gtk::Label* endPortLabel = Gtk::manage(new class Gtk::Label("End Port")); beginPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10)); portrange_begin = Gtk::manage(new class Gtk::SpinButton(*beginPortRangeSpinbuttonAdj, 1, 0)); endPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10)); portrange_end = Gtk::manage(new class Gtk::SpinButton(*endPortRangeSpinbuttonAdj, 1, 0)); beginPortLabel->set_alignment(0,0.5); beginPortLabel->set_padding(5,5); beginPortLabel->set_justify(Gtk::JUSTIFY_LEFT); beginPortLabel->set_line_wrap(false); beginPortLabel->set_use_markup(false); beginPortLabel->set_selectable(false); endPortLabel->set_alignment(0,0.5); endPortLabel->set_padding(5,5); endPortLabel->set_justify(Gtk::JUSTIFY_LEFT); endPortLabel->set_line_wrap(false); endPortLabel->set_use_markup(false); endPortLabel->set_selectable(false); portrange_end->set_flags(Gtk::CAN_FOCUS); portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_end->set_numeric(false); portrange_end->set_digits(0); portrange_end->set_wrap(false); portrange_end->set_flags(Gtk::CAN_FOCUS); portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_end->set_numeric(true); portrange_end->set_digits(0); portrange_end->set_wrap(false); portrange_begin->set_flags(Gtk::CAN_FOCUS); portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_begin->set_numeric(false); portrange_begin->set_digits(0); portrange_begin->set_wrap(false); portrange_begin->set_flags(Gtk::CAN_FOCUS); portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS); portrange_begin->set_numeric(true); portrange_begin->set_digits(0); portrange_begin->set_wrap(false); portTable->set_border_width(10); portTable->set_row_spacings(5); portTable->set_col_spacings(5); portTable->attach(*beginPortLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*endPortLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*portrange_end, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); portTable->attach(*portrange_begin, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); beginPortLabel->show(); endPortLabel->show(); portrange_begin->show(); portrange_end->show(); portTable->show(); Gtk::VBox *preferencesVbox = Gtk::manage(new class Gtk::VBox(false, 10)); outputLabel->set_alignment(0,0.5); outputLabel->set_padding(5,0); outputLabel->set_justify(Gtk::JUSTIFY_LEFT); outputLabel->set_line_wrap(false); outputLabel->set_use_markup(false); outputLabel->set_selectable(false); workLabel->set_alignment(0,0.5); workLabel->set_padding(5,0); workLabel->set_justify(Gtk::JUSTIFY_LEFT); workLabel->set_line_wrap(false); workLabel->set_use_markup(false); workLabel->set_selectable(false); portRangeLabel->set_alignment(0,0.5); portRangeLabel->set_padding(5,0); portRangeLabel->set_justify(Gtk::JUSTIFY_LEFT); portRangeLabel->set_line_wrap(false); portRangeLabel->set_use_markup(false); portRangeLabel->set_selectable(false); leechModeLabel->set_alignment(0,0.5); leechModeLabel->set_padding(5,0); leechModeLabel->set_justify(Gtk::JUSTIFY_LEFT); leechModeLabel->set_line_wrap(false); leechModeLabel->set_use_markup(false); leechModeLabel->set_selectable(false); Gtk::HBox* pathHbox = Gtk::manage(new class Gtk::HBox(false, 10)); Gtk::HBox* workPathHbox = Gtk::manage(new class Gtk::HBox(false, 10)); outputPathEntry->set_flags(Gtk::CAN_FOCUS); outputPathEntry->set_visibility(true); outputPathEntry->set_editable(false); outputPathEntry->set_max_length(0); outputPathEntry->set_text(""); outputPathEntry->set_has_frame(true); outputPathEntry->set_activates_default(false); workPathEntry->set_flags(Gtk::CAN_FOCUS); workPathEntry->set_visibility(true); workPathEntry->set_editable(false); workPathEntry->set_max_length(0); workPathEntry->set_text(""); workPathEntry->set_has_frame(true); workPathEntry->set_activates_default(false); Gtk::Button* pathButton = Gtk::manage(new class Gtk::Button("Change Path")); Gtk::Button* workPathButton = Gtk::manage(new class Gtk::Button("Change Path")); pathHbox->pack_start(*outputPathEntry); pathHbox->pack_start(*pathButton, Gtk::PACK_SHRINK, 0); workPathHbox->pack_start(*workPathEntry); workPathHbox->pack_start(*workPathButton, Gtk::PACK_SHRINK, 0); leechModeCheckbutton->set_flags(Gtk::CAN_FOCUS); leechModeCheckbutton->set_relief(Gtk::RELIEF_NORMAL); leechModeCheckbutton->set_mode(true); leechModeCheckbutton->set_active(false); settingsTable->set_border_width(10); settingsTable->set_row_spacings(20); settingsTable->set_col_spacings(5); // left rigth top bottom /* table1->attach(*label1, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label2, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label3, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*label4, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry1, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry2, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry3, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); table1->attach(*entry4, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); */ settingsTable->attach(*workLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*outputLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*portRangeLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*leechModeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*workPathHbox, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*pathHbox, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0); settingsTable->attach(*portTable, 1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0); settingsTable->attach(*leechModeCheckbutton, 1, 2, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0); preferencesVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0); set_title( GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Preferences" ); set_modal(true); property_window_position().set_value(Gtk::WIN_POS_CENTER); set_resizable(true); property_destroy_with_parent().set_value(false); set_has_separator(true); get_vbox()->pack_start(*preferencesVbox); set_default_size(300, 200); outputLabel->show(); workLabel->show(); portRangeLabel->show(); leechModeLabel->show(); outputPathEntry->show(); pathButton->show(); pathHbox->show(); workPathEntry->show(); workPathButton->show(); workPathHbox->show(); leechModeCheckbutton->show(); settingsTable->show(); preferencesVbox->show(); // Create buttons and connect their signals. add_button("Save", 1); add_button("Cancel", 2); signal_response().connect(sigc::mem_fun(*this, &preferencesDialog::on_dialog_button_pressed)); pathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_path_select_button_pressed)); workPathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_work_path_select_button_pressed)); get_vbox()->show(); }
void GuidelinePropertiesDialog::_setup() { set_title(_("Guideline")); add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); Gtk::VBox *mainVBox = get_vbox(); _layout_table.set_spacings(4); _layout_table.resize (3, 4); mainVBox->pack_start(_layout_table, false, false, 0); _label_name.set_label("foo0"); _layout_table.attach(_label_name, 0, 3, 0, 1, Gtk::FILL, Gtk::FILL); _label_name.set_alignment(0, 0.5); _label_descr.set_label("foo1"); _layout_table.attach(_label_descr, 0, 3, 1, 2, Gtk::FILL, Gtk::FILL); _label_descr.set_alignment(0, 0.5); // indent _layout_table.attach(*manage(new Gtk::Label(" ")), 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10); // mode radio button _layout_table.attach(_relative_toggle, 1, 3, 9, 10, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); // unitmenu /* fixme: We should allow percents here too, as percents of the canvas size */ GtkWidget *unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); sp_unit_selector_set_unit(SP_UNIT_SELECTOR(unit_selector), _desktop->namedview->doc_units); _unit_selector = Gtk::manage(Glib::wrap(unit_selector)); // position spinbuttons sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj())); sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj())); _spin_button_x.configure(_adjustment_x, 1.0 , 3); _spin_button_x.set_numeric(); _spin_button_y.configure(_adjustment_y, 1.0 , 3); _spin_button_y.set_numeric(); _layout_table.attach(_label_X, 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_x, 2, 3, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_label_Y, 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_y, 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.gobj()), "activate", GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); _layout_table.attach(_label_units, 1, 2, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(*_unit_selector, 2, 3, 6, 7, Gtk::FILL, Gtk::FILL); // angle spinbutton _spin_angle.configure(_adj_angle, 5.0 , 3); _spin_angle.set_numeric(); _spin_angle.show(); _layout_table.attach(_label_degrees, 1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_angle, 2, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); // dialog set_default_response(Gtk::RESPONSE_OK); signal_response().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_response)); // initialize dialog _oldpos = _guide->point_on_line; if (_guide->is_vertical()) { _oldangle = 90; } else if (_guide->is_horizontal()) { _oldangle = 0; } else { _oldangle = Geom::rad_to_deg( std::atan2( - _guide->normal_to_line[Geom::X], _guide->normal_to_line[Geom::Y] ) ); } { Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide); const gchar *guide_id = repr->attribute("id"); gchar *label = g_strdup_printf(_("Guideline ID: %s"), guide_id); _label_name.set_label(label); g_free(label); } { gchar *guide_description = sp_guide_description(_guide, false); gchar *label = g_strdup_printf(_("Current: %s"), guide_description); g_free(guide_description); _label_descr.set_markup(label); g_free(label); } _modeChanged(); // sets values of spinboxes. if ( _oldangle == 90. || _oldangle == 270. || _oldangle == -90. || _oldangle == -270.) { _spin_button_x.grab_focus(); _spin_button_x.select_region(0, 20); } else if ( _oldangle == 0. || _oldangle == 180. || _oldangle == -180.) { _spin_button_y.grab_focus(); _spin_button_y.select_region(0, 20); } else { _spin_angle.grab_focus(); _spin_angle.select_region(0, 20); } set_position(Gtk::WIN_POS_MOUSE); show_all_children(); set_modal(true); _desktop->setWindowTransient (gobj()); property_destroy_with_parent() = true; }
void ColorPickerDialog::emitResponse(ResponseType response) { signal_response(*this, response, color); }