Exemplo n.º 1
0
void build_radio(GUI* g)
{
  WIDGET* ch1=NULL;
  WIDGET* ch2=NULL;
  WIDGET* ch3=NULL;

  ch1=create_radio_button("Radio",10,120);
  ch2=create_radio_button("Disabled Radio",120,120);
  set_radio_button_enable(ch2,0);
  ch3=create_radio_button("Fancy Radio",320,120);
  set_radio_button_text_color(ch3,0x0000FF00);
  set_radio_button_check_color(ch3,0x00000001);

  add_to_main(g,ch1);
  add_to_main(g,ch2);
  add_to_main(g,ch3);

}
Exemplo n.º 2
0
int main(int argc,char **argv)
{
	GtkWidget *win;
	GtkWidget *button;
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *frame;
	IS_SELECT is_select;

	change_path(argv[0]);

	gtk_init(&argc,&argv);

	win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position(GTK_WINDOW(win),GTK_WIN_POS_CENTER);
	gtk_window_set_title(GTK_WINDOW(win),"IScreenshot");
	gtk_window_set_icon_from_file(GTK_WINDOW(win),
			"img/64x64/iscreenshot.png",NULL);
	g_signal_connect(G_OBJECT(win),"delete_event",
			G_CALLBACK(really_quit),NULL);
	init_data(&is_select,win);

	vbox=gtk_vbox_new(FALSE,0);
	gtk_container_add(GTK_CONTAINER(win),vbox);

	create_title_screen(vbox);

	frame=gtk_frame_new("Select");
	hbox=gtk_hbox_new(FALSE,0);
	gtk_box_pack_start(GTK_BOX(vbox),frame,FALSE,FALSE,0);
	gtk_container_add(GTK_CONTAINER(frame),hbox);

	frame=gtk_frame_new("Region to capture");
	gtk_box_pack_start(GTK_BOX(hbox),frame,FALSE,FALSE,0);
	create_radio_button(frame,&is_select);

	frame=gtk_frame_new("Delay before capturing");
	gtk_box_pack_start(GTK_BOX(hbox),frame,FALSE,FALSE,0);
	create_select_time(frame,&is_select);

	hbox=gtk_hbox_new(FALSE,0);
	gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);

	button=gtk_button_new_from_stock(GTK_STOCK_OK);
	gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,FALSE,10);
	g_signal_connect(G_OBJECT(button),"clicked",
			G_CALLBACK(screenshot),&is_select);

	button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
	gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,FALSE,10);
	g_signal_connect(G_OBJECT(button),"clicked",
			G_CALLBACK(really_quit),NULL);

	gtk_widget_show_all(win);

	gtk_main();
}
Exemplo n.º 3
0
static GtkWidget *
create_general_button (GtkWidget    *box,
                       int           idx,
                       const gchar  *label,
                       const gchar  *help_string,
                       GSList      **radio_group)
{
  return create_radio_button (box, idx, general_bg_callback, label,
                              help_string, radio_group, general_bg_radio);
}
void dv_selector_widget::set_source_count(unsigned count)
{
    if (count > thumbnails_.size())
    {
	resize(count, 1);
	mixer::source_id first_new_source_id = thumbnails_.size();

	try
	{
	    thumbnails_.resize(count);

	    for (mixer::source_id i = first_new_source_id; i != count; ++i)
	    {
		unsigned column = 1;
		unsigned row = i * row_multiplier;

		if (0)//(i != 0 && i != count - 1)
		{
		    Gtk::HSeparator * sep = manage(new Gtk::HSeparator);
		    sep->show();
		    attach(*sep,
			   column - 1, column,
			   row, row + row_multiplier,
			   Gtk::FILL, Gtk::FILL,
			   0, 0);
		}

		dv_thumb_display_widget * thumb =
		    manage(new dv_thumb_display_widget);
		thumb->show();
		attach(*thumb,
		       column + column_display, column + column_display + 1,
		       row, row + row_multiplier,
		       Gtk::FILL, Gtk::FILL,
		       0, 0);
		thumbnails_[i] = thumb;

		char label_text[4];
		snprintf(label_text, sizeof(label_text),
			 (i < 9) ? "_%u" : "%u", unsigned(1 + i));
		Gtk::Label * label =
		    manage(new Gtk::Label(label_text, true));
		label->show();
		attach(*label,
		       column + column_labels, column + column_labels + 1,
		       row + row_text_label, row + row_text_label + 1,
		       Gtk::FILL, Gtk::FILL,
		       0, 0);

		Gtk::RadioButton * pri_video_button =
		    create_radio_button(pri_video_button_group_,
					pri_video_source_pixbuf_);
		pri_video_button->signal_pressed().connect(
		    sigc::bind(
			sigc::mem_fun(*this,
				      &dv_selector_widget::on_pri_video_selected),
			i));
		pri_video_button->show();
		attach(*pri_video_button,
		       column + column_labels, column + column_labels + 1,
		       row + row_pri_video_button,
		       row + row_pri_video_button + 1,
		       Gtk::FILL, Gtk::FILL,
		       0, 0);

		Gtk::RadioButton * audio_button =
		    create_radio_button(audio_button_group_,
					audio_source_pixbuf_);
		audio_button_list_.push_back(audio_button);
		// disable by default, if not in expert mode
		audio_button->set_sensitive(expert_mode ? true : false);
		audio_button->signal_pressed().connect(
				sigc::bind(
					sigc::mem_fun(*this,
						&dv_selector_widget::on_audio_selected),
					i));
		audio_button->show();
		attach(*audio_button,
		       column + column_labels, column + column_labels + 1,
		       row + row_audio_button, row + row_audio_button + 1,
		       Gtk::FILL, Gtk::FILL,
		       0, 0);

		if (i < 9)
		{
		    // Make the mnemonic on the label work.  Also make
		    // the numeric keypad and Alt-keys work.
		    label->set_mnemonic_widget(*pri_video_button);
		    pri_video_button->add_accelerator("activate",
						  accel_group_,
						  GDK_KP_1 + i,
						  Gdk::ModifierType(0),
						  Gtk::AccelFlags(0));
		    pri_video_button->signal_activate().connect(
			sigc::bind(
			    sigc::mem_fun(
				*this,
				&dv_selector_widget::on_pri_video_selected),
			    i));
		    audio_button->add_accelerator("activate",
						  accel_group_,
						  '1' + i,
						  Gdk::MOD1_MASK,
						  Gtk::AccelFlags(0));
		    audio_button->add_accelerator("activate",
						  accel_group_,
						  GDK_KP_1 + i,
						  Gdk::MOD1_MASK,
						  Gtk::AccelFlags(0));
		    audio_button->signal_activate().connect(
			sigc::bind(
			    sigc::mem_fun(
				*this,
				&dv_selector_widget::on_audio_selected),
			    i));
		}
	    }
	}
	catch (std::exception & e)
	{
	    // Roll back size changes
	    thumbnails_.resize(first_new_source_id);
	    std::cerr << "ERROR: Failed to add source display: " << e.what()
		      << "\n";
	}
    }
}