コード例 #1
0
void
ChipCapacitiesDialog::connect_signals()
{
	std::vector<double> capacities = Scanner::BuiltinCapacities::capacities();

	for ( std::vector<double>::const_iterator iter = capacities.begin();
		iter != capacities.end(); ++iter) {

		Gtk::RadioButton* button;
		Glib::ustring name = Glib::ustring::compose( "radiobutton%1",
			Glib::ustring::format(iter - capacities.begin()));

		builder_->get_widget( name, button);

		insert_into_buttons_map( *iter, button);

		button->signal_toggled().connect( sigc::bind(sigc::mem_fun( *this,
			&ChipCapacitiesDialog::on_capacity_changed), *iter));
	}
}
コード例 #2
0
ファイル: VRGuiUtils.cpp プロジェクト: AntonChalakov/polyvr
void setRadioButtonCallback(string cb, sigc::slot<void> sig ) {
    Gtk::RadioButton* rbut;
    VRGuiBuilder()->get_widget(cb, rbut);
    rbut->signal_toggled().connect(sig);
}
コード例 #3
0
Example_ScrolledViewport::Example_ScrolledViewport()
{
    Gtk::HBox* hbox;
    Gtk::VBox* vbox;

    set_title("ScrolledViewport Example");

    Papyrus::Gtk::Viewport& viewport = m_ScrolledViewport.viewport();

    m_Zoomer = Papyrus::Zoomer::create( );
    viewport.add_controller( m_Zoomer );

    viewport.set_size_request( 300, 200 );

    // Create some shapes to add to the group
    Papyrus::Group::pointer g = Papyrus::example_group( );

    viewport.canvas()->add( g );
    m_Zoomer->add( g );

    vbox = Gtk::manage( new Gtk::VBox() );
    vbox->pack_start( m_ScrolledViewport );
    vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

    Gtk::RadioButton* rb;
    Gtk::VBox* vbox2;
    Gtk::Frame* frame;
    Gtk::Label* label;

    label = Gtk::manage( new Gtk::Label("Use the mouse wheel to zoom in and out.\n\nThe scrollbars are set to automatic in this example so you will need to zoom in before they show up.") );
    label->set_use_markup();
    label->set_line_wrap();
    vbox->pack_start(*label, Gtk::PACK_SHRINK, 10);
    vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

    vbox2 = Gtk::manage( new Gtk::VBox() );
    frame = Gtk::manage( new Gtk::Frame("Viewport Scroll Placement") );
    frame->add(*vbox2);
    vbox->pack_start(*frame, Gtk::PACK_SHRINK, 10);
    label = Gtk::manage( new Gtk::Label("<i>Placement refers to the corner where the viewport will be placed</i>") );
    label->set_use_markup();
    label->set_line_wrap();
    vbox2->pack_start(*label, Gtk::PACK_SHRINK);
    Gtk::RadioButtonGroup scroll_placement_group;
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Left" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_LEFT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Left" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_LEFT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Top Right" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_TOP_RIGHT) );
    vbox2->pack_start( *rb );
    rb = Gtk::manage( new Gtk::RadioButton( scroll_placement_group, "Bottom Right" ) );
    rb->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &Example_ScrolledViewport::on_scroll_placement_changed), Gtk::CORNER_BOTTOM_RIGHT) );
    vbox2->pack_start( *rb );

    this->add( *vbox );

    show_all();
}
コード例 #4
0
ファイル: example_markers.cpp プロジェクト: scott--/papyrus
Example_markers::Example_markers()
{
  Gtk::VBox *vbox, *vbox2;
  Gtk::HBox *hbox;
  Gtk::RadioButton *rbutton;
  
  set_title("Line Markers Example");
  set_border_width(10);

  m_Viewport.canvas()->set_size( 500, 400 );

  vbox = Gtk::manage(new Gtk::VBox());
  vbox->pack_start( m_Viewport );
  m_line = Papyrus::Polyline::create();
  m_line->add_vertex(-100, 0);
  m_line->add_vertex(100, 0);
  m_line->set_stroke( Cairo::SolidPattern::create_rgb(0.0, 0.0, 1.0) );
  m_line->stroke()->set_width(3);

  m_line->set_marker(Papyrus::START_MARKER, Papyrus::Marker::create());
  m_line->marker(Papyrus::START_MARKER)->set_facing(Papyrus::Marker::LEFT);
  m_line->marker(Papyrus::START_MARKER)->stroke()->set_width(3);
  
  m_line->set_marker(Papyrus::END_MARKER, Papyrus::Marker::create());
  m_line->marker(Papyrus::END_MARKER)->set_facing(Papyrus::Marker::RIGHT);
  m_line->marker(Papyrus::END_MARKER)->stroke()->set_width(3);
  
  m_Viewport.canvas()->add( m_line );

  vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

  hbox = Gtk::manage(new Gtk::HBox());
  vbox->pack_start( *hbox );

  vbox2 = Gtk::manage(new Gtk::VBox());
  vbox2->pack_start( *Gtk::manage(new Gtk::Label("Start Marker")) );
  vbox2->pack_start( m_start_combobox );
  Gtk::RadioButtonGroup start_facing_group;
  rbutton = Gtk::manage(new Gtk::RadioButton(start_facing_group, "Left"));
  rbutton->set_active();
  rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::START_MARKER, Papyrus::Marker::LEFT));
  vbox2->pack_start(*rbutton);
  rbutton = Gtk::manage(new Gtk::RadioButton(start_facing_group, "Right"));
  rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::START_MARKER, Papyrus::Marker::RIGHT));
  vbox2->pack_start(*rbutton);
  hbox->pack_start(*vbox2);

  vbox2 = Gtk::manage(new Gtk::VBox());
  vbox2->pack_start( *Gtk::manage(new Gtk::Label("End Marker")) );
  vbox2->pack_start( m_end_combobox );
  Gtk::RadioButtonGroup end_facing_group;
  rbutton = Gtk::manage(new Gtk::RadioButton(end_facing_group, "Left"));
  rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::END_MARKER, Papyrus::Marker::LEFT));
  vbox2->pack_start(*rbutton);
  rbutton = Gtk::manage(new Gtk::RadioButton(end_facing_group, "Right"));
  rbutton->set_active();
  rbutton->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_facing_changed), Papyrus::END_MARKER, Papyrus::Marker::RIGHT));
  vbox2->pack_start(*rbutton);
  hbox->pack_start(*vbox2);

  for (unsigned i=Papyrus::Marker::FIRST_STYLE; i < Papyrus::Marker::LAST_STYLE; i++)
  {
    m_start_combobox.append_text( Papyrus::Marker::style_strings[i] );
    m_end_combobox.append_text( Papyrus::Marker::style_strings[i] );
  }

  m_start_combobox.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_style_changed), Papyrus::START_MARKER));

  m_start_combobox.set_active(Papyrus::Marker::NONE);

  m_end_combobox.signal_changed().connect( sigc::bind(sigc::mem_fun(*this, &Example_markers::on_marker_style_changed), Papyrus::END_MARKER));

  m_end_combobox.set_active(Papyrus::Marker::NONE);

  this->add( *vbox );

  show_all();
}