Ejemplo n.º 1
0
static GtkWidget *layout_config_widget(GtkWidget *group, GtkWidget *box, gint style, LayoutConfig *lc)
{
	GtkWidget *table;
	LayoutStyle ls;

	ls = layout_config_styles[style];

	if (group)
		{
		group = gtk_radio_button_new(gtk_radio_button_get_group(GTK_RADIO_BUTTON(group)));
		}
	else
		{
		group = gtk_radio_button_new(NULL);
		}
	g_object_set_data(G_OBJECT(group), "layout_config", lc);
	g_signal_connect(G_OBJECT(group), "clicked",
			 G_CALLBACK(layout_config_widget_click_cb), GINT_TO_POINTER(style));
	gtk_box_pack_start(GTK_BOX(box), group, FALSE, FALSE, 0);

	table = gtk_table_new(2, 2, TRUE);

	layout_config_table_button(table, ls.a, "1");
	layout_config_table_button(table, ls.b, "2");
	layout_config_table_button(table, ls.c, "3");

	gtk_widget_set_size_request(table, LAYOUT_STYLE_SIZE, LAYOUT_STYLE_SIZE);
	gtk_container_add(GTK_CONTAINER(group), table);
	gtk_widget_show(table);

	gtk_widget_show(group);

	return group;
}
Ejemplo n.º 2
0
void add_dic_selection(GtkWidget *win,GtkWidget *hbox,SelectionData *data)
{
	GtkWidget *vbox;
	GtkWidget *frame;
	GtkWidget *button;
	GtkWidget *image;
	GSList *group;

	int i;
	/*提供的翻译词典名称*/
	char *name[]={"百度翻译","必应翻译","金山词霸","有道翻译"};
	/*词典的图标*/
	char *path[]={"img/baidu.png","img/bing.png","img/king.png","img/youdao.png"};
	/*各回调函数*/
	callback func[]={duoyi_baidu_select,duoyi_bing_select,
	duoyi_king_select,duoyi_youdao_select};

	/*添加边框*/
	frame=gtk_frame_new("选择网络词典");
	gtk_box_pack_start(GTK_BOX(hbox),frame,FALSE,FALSE,5);
	vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL,10);
	gtk_container_add(GTK_CONTAINER(frame),vbox);
	gtk_container_set_border_width(GTK_CONTAINER(vbox),0x10);

	button=gtk_radio_button_new(NULL);
	image=gtk_image_new_from_file(path[0]);
	gtk_button_set_image(GTK_BUTTON(button),image);
	gtk_button_set_label(GTK_BUTTON(button),name[0]);
	gtk_button_set_image_position(GTK_BUTTON(button),GTK_POS_TOP);
	gtk_box_pack_start(GTK_BOX(vbox),button,FALSE,FALSE,0);

	g_signal_connect(G_OBJECT(button),"pressed",
				G_CALLBACK(func[0]),data);
	/*如果默认词典是百度,发送一个clicked信号*/
	if(data->select == 0)
		gtk_button_clicked(GTK_BUTTON(button));

	for(i=1;i != 4;++i)
	{
		group=gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
		image=gtk_image_new_from_file(path[i]);
		button=gtk_radio_button_new(group);
		/*添加图标*/
		gtk_button_set_image(GTK_BUTTON(button),image);
		/*添加名称*/
		gtk_button_set_label(GTK_BUTTON(button),name[i]);
		gtk_button_set_image_position(GTK_BUTTON(button),GTK_POS_TOP);

		gtk_box_pack_start(GTK_BOX(vbox),button,FALSE,FALSE,0);
		g_signal_connect(G_OBJECT(button),"pressed",
				G_CALLBACK(func[i]),data);

		/*设置显示词典*/
		if(i == data->select)
			gtk_button_clicked(GTK_BUTTON(button));
	}
}
Ejemplo n.º 3
0
void Dialog::addRadioIcons(GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer)
{
  GtkWidget* table = gtk_table_new (2, static_cast<guint>(icons.last - icons.first), FALSE);
  gtk_widget_show (table);

  gtk_table_set_row_spacings (GTK_TABLE (table), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table), 5);

  GSList* group = 0;
  GtkWidget* radio = 0;
  for(StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon)
  {
    guint pos = static_cast<guint>(icon - icons.first);
    GtkImage* image = new_local_image(*icon);
    gtk_widget_show(GTK_WIDGET(image));
    gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(image), pos, pos+1, 0, 1,
                      (GtkAttachOptions) (0),
                      (GtkAttachOptions) (0), 0, 0);

    radio = gtk_radio_button_new(group);
    gtk_widget_show (radio);
    gtk_table_attach (GTK_TABLE (table), radio, pos, pos+1, 1, 2,
                      (GtkAttachOptions) (0),
                      (GtkAttachOptions) (0), 0, 0);

    group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
  }

  AddIntRadioData(*GTK_RADIO_BUTTON(radio), importViewer, exportViewer);

  DialogVBox_packRow(GTK_VBOX(vbox), GTK_WIDGET(DialogRow_new(name, table)));
}
Ejemplo n.º 4
0
static void
add_child (GtkStackSwitcher *self,
           GtkWidget        *widget)
{
  GtkWidget *button;
  GList *group;

  button = gtk_radio_button_new (NULL);
  gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);

  update_button (self, widget, button);

  group = gtk_container_get_children (GTK_CONTAINER (self));
  if (group != NULL)
    {
      gtk_radio_button_join_group (GTK_RADIO_BUTTON (button), GTK_RADIO_BUTTON (group->data));
      g_list_free (group);
    }

  gtk_container_add (GTK_CONTAINER (self), button);

  g_object_set_data (G_OBJECT (button), "stack-child", widget);
  g_signal_connect (button, "clicked", G_CALLBACK (on_button_clicked), self);
  g_signal_connect (widget, "child-notify::title", G_CALLBACK (on_title_icon_updated), self);
  g_signal_connect (widget, "child-notify::icon-name", G_CALLBACK (on_title_icon_updated), self);
  g_signal_connect (widget, "child-notify::position", G_CALLBACK (on_position_updated), self);

  g_hash_table_insert (self->priv->buttons, widget, button);
}
Ejemplo n.º 5
0
/*
 * Creates a new GtkWidget of class GtkRadioButton, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
GtkWidget *
gb_radio_button_new (GbWidgetNewData * data)
{
  GtkWidget *new_widget;
  GSList *group_list = NULL;

  /* SPECIAL CODE: to handle toolbar buttons. */
  if (data->parent && GTK_IS_TOOLBAR (data->parent))
    {
      new_widget = gb_toolbar_new_toolbar_button (data, GTK_TOOLBAR_CHILD_RADIOBUTTON);
      if (new_widget)
	return new_widget;
    }

  if (data->parent)
    gtk_container_foreach (GTK_CONTAINER (data->parent),
			   (GtkCallback) find_parents_group, &group_list);

  if (data->action == GB_CREATING)
    new_widget = gtk_radio_button_new_with_label (group_list, data->name);
  else
    {
      new_widget = gtk_radio_button_new (group_list);
      gtk_container_add (GTK_CONTAINER (new_widget), editor_new_placeholder());
    }
  return new_widget;
}
Ejemplo n.º 6
0
static GtkWidget * create_pixmap_radio_button(bg_nle_timeline_t * w,
                                              const char * filename,
                                              const char * tooltip,
                                              guint * id, GSList ** group)
  {
  GtkWidget * button;
  GtkWidget * image;
  char * path;
  path = bg_search_file_read("icons", filename);
  if(path)
    {
    image = gtk_image_new_from_file(path);
    free(path);
    }
  else
    image = gtk_image_new();

  gtk_widget_show(image);
  button = gtk_radio_button_new(*group);
  gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
  
  if(!(*group))
    *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
  
  gtk_container_add(GTK_CONTAINER(button), image);

  *id = g_signal_connect(G_OBJECT(button), "toggled",
                         G_CALLBACK(button_callback), w);
  
  gtk_widget_show(button);

  bg_gtk_tooltips_set_tip(button, tooltip, PACKAGE);
  
  return button;
  }
Ejemplo n.º 7
0
GtkWidget* RenderThemeGtk::gtkRadioButton() const
{
    if (m_gtkRadioButton)
        return m_gtkRadioButton;
    m_gtkRadioButton = gtk_radio_button_new(0);
    setupWidgetAndAddToContainer(m_gtkRadioButton, gtkContainer());
    return m_gtkRadioButton;
}
QRadioButton::QRadioButton(QWidget * parent, const char * name, int f)
    : QButton(parent,name,f)
{
    GtkWidget *btn =  gtk_radio_button_new(NULL);
    setGtkWidget(btn);

    setChecked(false);
}
Ejemplo n.º 9
0
void
gdm_extension_list_add_extension (GdmExtensionList  *extension_list,
                                  GdmLoginExtension *extension)
{
        GtkWidget *image;
        GtkWidget *button;
        GIcon     *icon;
        char      *description;

        if (extension_list->priv->extensions == NULL) {
                button = gtk_radio_button_new (NULL);
        } else {
                GdmLoginExtension *previous_extension;
                GtkRadioButton *previous_button;

                previous_extension = GDM_LOGIN_EXTENSION (extension_list->priv->extensions->data);
                previous_button = GTK_RADIO_BUTTON (g_object_get_data (G_OBJECT (previous_extension), "gdm-extension-list-button"));
                button = gtk_radio_button_new_from_widget (previous_button);
        }
        g_object_set_data (G_OBJECT (extension), "gdm-extension-list-button", button);

        g_object_set (G_OBJECT (button), "draw-indicator", FALSE, NULL);
        g_object_set_data (G_OBJECT (button), "gdm-extension", extension);
        g_signal_connect_swapped (button, "toggled",
                                  G_CALLBACK (on_extension_toggled),
                                  extension_list);

        gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
        gtk_widget_set_sensitive (button, gdm_login_extension_is_enabled (extension));

        g_signal_connect_swapped (G_OBJECT (extension), "enabled",
                                  G_CALLBACK (on_extension_enabled),
                                  extension_list);

        g_signal_connect_swapped (G_OBJECT (extension), "disabled",
                                  G_CALLBACK (on_extension_disabled),
                                  extension_list);

        icon = gdm_login_extension_get_icon (extension);
        image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_SMALL_TOOLBAR);
        g_object_unref (icon);

        gtk_widget_show (image);
        gtk_container_add (GTK_CONTAINER (button), image);
        description = gdm_login_extension_get_description (extension);
        gtk_widget_set_tooltip_text (button, description);
        g_free (description);
        gtk_widget_show (button);

        gtk_container_add (GTK_CONTAINER (extension_list->priv->box), button);
        extension_list->priv->extensions = g_list_append (extension_list->priv->extensions,
                                                g_object_ref (extension));

        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
                g_signal_emit (extension_list, signals[ACTIVATED], 0, extension);
        }
}
Ejemplo n.º 10
0
void cgraphics_radiobutton_widget_create( widget_t *widget )
{
    widget->native = gtk_radio_button_new(NULL);
    assert(widget->native != NULL && "failed to create GTK radiobutton");

    cgraphics_widget_create( widget );

    g_signal_connect( G_OBJECT(widget->native), "clicked", G_CALLBACK(cgraphics_radio_clicked_handler), widget );
}
Ejemplo n.º 11
0
gint main (gint argc, gchar *argv[])
{
  GtkWidget *window;
  GtkWidget *button;       
  GtkWidget *vbox;

  gtk_init (&argc, &argv);
  //window = gtk_window_new(GTK_WINDOW_POPUP);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size(GTK_WINDOW(window),200,200);
 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);  
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE);
gtk_window_set_title(GTK_WINDOW(window),"GPU FS");  
  g_signal_connect ( G_OBJECT (window), "destroy",
                       G_CALLBACK (closeApp), NULL);


  radiobutton1 = gtk_radio_button_new(NULL);
  radiobutton2 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radiobutton1));
  radiobutton3 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radiobutton1));
  radiobutton4 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radiobutton1));
  radiobutton5 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radiobutton1));
  radiobutton6 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radiobutton1));
 hseparator=gtk_hseparator_new ();

  vbox = gtk_vbox_new (TRUE, 4); 
 
  add_widget_with_label (GTK_CONTAINER(vbox), "100%:",radiobutton1);
  add_widget_with_label (GTK_CONTAINER(vbox), "75%:", radiobutton2);
  add_widget_with_label (GTK_CONTAINER(vbox), "50%:", radiobutton3);
  add_widget_with_label (GTK_CONTAINER(vbox), "33%:", radiobutton4);
  add_widget_with_label (GTK_CONTAINER(vbox), NULL, hseparator);
  add_widget_with_label (GTK_CONTAINER(vbox), "Auto:", radiobutton5);
  add_widget_with_label (GTK_CONTAINER(vbox), "PowerSaver:", radiobutton6);
 
  g_signal_connect(G_OBJECT(radiobutton1), "toggled", 
                     G_CALLBACK(radio_button_clicked1), NULL);
  g_signal_connect(G_OBJECT(radiobutton2), "toggled", 
                     G_CALLBACK(radio_button_clicked2), NULL);
  g_signal_connect(G_OBJECT(radiobutton3), "toggled", 
                     G_CALLBACK(radio_button_clicked3), NULL);
  g_signal_connect(G_OBJECT(radiobutton4), "toggled", 
                     G_CALLBACK(radio_button_clicked4), NULL);
  g_signal_connect(G_OBJECT(radiobutton5), "toggled", 
                     G_CALLBACK(radio_button_clicked5), NULL);
  g_signal_connect(G_OBJECT(radiobutton6), "toggled", 
                     G_CALLBACK(radio_button_clicked6), NULL);

	
  gtk_container_add(GTK_CONTAINER(window), vbox);		
  gtk_widget_show_all(window);
  gtk_main ();
	
  return 0;
}
Ejemplo n.º 12
0
static GtkWidget *
radiobutton_new(GladeXML *xml, GladeWidgetInfo *info)
{
	GtkWidget *button;
	GList *tmp;
	char *string = NULL;
	gboolean active = FALSE, draw_indicator = TRUE;
	GSList *group = NULL;
	char *group_name = NULL;
	
	for (tmp = info->attributes; tmp; tmp = tmp->next) {
		GladeAttribute *attr = tmp->data;

		if (!strcmp(attr->name, "label"))
			string = attr->value;
		else if (!strcmp(attr->name, "active"))
			active = attr->value[0] == 'T';
		else if (!strcmp(attr->name, "draw_indicator"))
			draw_indicator = attr->value[0] == 'T';
		else if (!strcmp(attr->name, "group")){
			group_name = attr->value;
			group = g_hash_table_lookup (xml->priv->radio_groups,
						     group_name);
			if (!group)
				group_name = g_strdup(group_name);
		}
	}
	if (string != NULL) {
		guint key;
		
		button = gtk_radio_button_new_with_label(group, "");
		key = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(button)->child),
					    string[0] ? _(string) : "");
		if (key)
			gtk_widget_add_accelerator(button, "clicked",
						   glade_xml_ensure_accel(xml),
						   key, GDK_MOD1_MASK, 0);
	} else
		button = gtk_radio_button_new (group);

	if (group_name) {
		GtkRadioButton *radio = GTK_RADIO_BUTTON (button);
		
		g_hash_table_insert (xml->priv->radio_groups,
				     group_name,
				     gtk_radio_button_group (radio));
	} 

	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), active);
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), draw_indicator);
	return button;
}
Ejemplo n.º 13
0
/* {EV_RADIO_BUTTON_IMP}.new_gtk_button */
EIF_POINTER F1155_16203 (EIF_REFERENCE Current)
{
	GTCX
	EIF_POINTER tp1;
	EIF_POINTER Result = ((EIF_POINTER) 0);
	
	
	
	RTGC;
	tp1 = (EIF_POINTER) NULL;
	Result = (EIF_POINTER) gtk_radio_button_new((GSList*) tp1);
	return Result;
}
Ejemplo n.º 14
0
void pageTwo()
{
	

	songInit();
	makeDrumKit();
	gtk_window_set_title (GTK_WINDOW (window), "Drum Studio");
	

	
	hbox = gtk_hbox_new( 0, 0);
	radio1 = gtk_radio_button_new(NULL);
	gtk_box_pack_start (GTK_BOX(hbox),radio1,0,0,0);
	radio2 = gtk_radio_button_new( gtk_radio_button_group(GTK_RADIO_BUTTON(radio1)));
	
	gtk_box_pack_start (GTK_BOX(hbox),radio2,0,0,0);
	
	radio4 = gtk_radio_button_new( gtk_radio_button_group(GTK_RADIO_BUTTON(radio2)));
	gtk_box_pack_start (GTK_BOX(hbox),radio4,0,0,0);
	
	radio8 = gtk_radio_button_new( gtk_radio_button_group(GTK_RADIO_BUTTON(radio4)));
	gtk_box_pack_start (GTK_BOX(hbox),radio8,0,0,0);
	gtk_widget_set_size_request(radio1,100,20);
	gtk_widget_set_size_request(radio2,100,20);
	gtk_widget_set_size_request(radio4,100,20);
	gtk_widget_set_size_request(radio8,100,20);

	g_signal_connect(radio1,"toggled",G_CALLBACK(setDur),(gpointer)"1");
	g_signal_connect(radio2,"toggled",G_CALLBACK(setDur),(gpointer)"2");
	g_signal_connect(radio4,"toggled",G_CALLBACK(setDur),(gpointer)"4");
	g_signal_connect(radio8,"toggled",G_CALLBACK(setDur),(gpointer)"8");

	LeftTable = gtk_table_new (15, 5, TRUE);
	gtk_table_attach_defaults (GTK_TABLE (LeftTable),hbox , 0, 1, 0, 1);
	gtk_table_attach_defaults (GTK_TABLE (MainTable),LeftTable , 0, 1, 0, 1);
	
	
}
Ejemplo n.º 15
0
GtkWidget * GetRadioButtonWidget()
{
    static GtkWidget *s_button = NULL;

    if ( !s_button )
    {
        s_button = gtk_radio_button_new(NULL);
        g_object_add_weak_pointer(G_OBJECT(s_button), (void**)&s_button);
        gtk_container_add(GetContainer(), s_button);
        gtk_widget_realize( s_button );
    }

    return s_button;
}
Ejemplo n.º 16
0
/**
@brief add radio button with mmemonic label to @a box

@param box widget to hold the button
@param label button label which may contain mnemonic, or NULL if no label
@param group the radio group, or NULL to start a group
@param state the intitial state of the button
@param exp TRUE to make the button expand with @a box
@param pad padding between button and @a box
@param callback callback function for "toggled" signal, or NULL
@param data data specified for the callback

@return the button widget
*/
GtkWidget *e2_button_add_radio (GtkWidget *box, gchar *label, GSList *group,
	gboolean state, gboolean exp, guint pad,
	void (*callback)(GtkToggleButton*,gpointer), gpointer data)
{
	GtkWidget *radio_button = (label != NULL) ?
		gtk_radio_button_new_with_mnemonic (group, label):
		gtk_radio_button_new (group);
	if (state)
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE);
	if (callback != NULL)
		g_signal_connect (G_OBJECT (radio_button), "toggled",
			G_CALLBACK (callback), data);
	gtk_box_pack_start (GTK_BOX (box), radio_button, exp, TRUE, pad);
	return radio_button;
}
Ejemplo n.º 17
0
GtkWidget * GetRadioButtonWidget()
{
    static GtkWidget *s_button = NULL;
    static GtkWidget *s_window = NULL;

    if ( !s_button )
    {
        s_window = gtk_window_new( GTK_WINDOW_POPUP );
        gtk_widget_realize( s_window );
        s_button = gtk_radio_button_new(NULL);
        gtk_container_add( GTK_CONTAINER(s_window), s_button );
        gtk_widget_realize( s_button );
    }

    return s_button;
}
Ejemplo n.º 18
0
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE group_or_label, label_or_use_underline, use_underline;
    GtkWidget *widget;

    if (rb_scan_args(argc, argv, "03", &group_or_label, &label_or_use_underline, &use_underline) > 0) {
        if (rb_obj_is_kind_of(group_or_label, RG_TARGET_NAMESPACE)){
            widget = create_button(group_or_label, label_or_use_underline, use_underline);
        } else {
            widget = create_button(Qnil, group_or_label, label_or_use_underline);
        }
    } else {
        widget = gtk_radio_button_new(NULL);
    }

    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}
Ejemplo n.º 19
0
static void roccat_single_cpi_selector_init(RoccatSingleCpiSelector *selector) {
	RoccatSingleCpiSelectorPrivate *priv = ROCCAT_SINGLE_CPI_SELECTOR_GET_PRIVATE(selector);
	GtkHBox *hbox;

	selector->priv = priv;

	hbox = GTK_HBOX(gtk_hbox_new(FALSE, 0));
	gtk_container_add(GTK_CONTAINER(selector), GTK_WIDGET(hbox));

	priv->radio = GTK_RADIO_BUTTON(gtk_radio_button_new(NULL));
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->radio), FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(priv->radio), "toggled", G_CALLBACK(click_radio_cb), selector);

	priv->active = GTK_CHECK_BUTTON(gtk_check_button_new());
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->active), FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(priv->active), "toggled", G_CALLBACK(toggle_active_cb), selector);

	priv->scale = GAMINGGEAR_HSCALE(gaminggear_hscale_new_with_range(0, 1, 1));
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->scale), TRUE, TRUE, 0);
}
Ejemplo n.º 20
0
JNIEXPORT jlong JNICALL
Java_org_gnome_gtk_GtkRadioButton_gtk_1radio_1button_1new
(
	JNIEnv* env,
	jclass cls,
	jlongArray _group
)
{
	GtkWidget* result;
	jlong _result;
	GSList* group;

	// convert parameter group
	if (_group == NULL) {
		group = NULL;
	} else {
		group = (GSList*) bindings_java_convert_jarray_to_gslist(env, _group);
		if (group == NULL) {
			return 0L; // Java Exception already thrown
		}
	}

	// call function
	result = gtk_radio_button_new(group);

	// cleanup parameter group
	if (group != NULL) {
		g_slist_free(group);
	}

	// translate return value to JNI type
	_result = (jlong) result;

	// cleanup return value
	if (result != NULL) {
		bindings_java_memory_cleanup((GObject*)result, TRUE);
	}

	// and finally
	return _result;
}
Ejemplo n.º 21
0
static GObject *roccat_polling_rate_selector_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties) {
	RoccatPollingRateSelectorPrivate *priv;
	GObject *obj;
	GtkTable *table;
	GtkWidget *radio;
	guint i;
	guint column_number;

	struct {
		guint value;
		gchar *title;
	} radios[ROCCAT_POLLING_RATE_SELECTOR_NUM] = {
			{ROCCAT_POLLING_RATE_SELECTOR_125, "125"},
			{ROCCAT_POLLING_RATE_SELECTOR_250, "250"},
			{ROCCAT_POLLING_RATE_SELECTOR_500, "500"},
			{ROCCAT_POLLING_RATE_SELECTOR_1000, "1000"},
	};

	obj = G_OBJECT_CLASS(roccat_polling_rate_selector_parent_class)->constructor(gtype, n_properties, properties);
	table = GTK_TABLE(obj);
	priv = ROCCAT_POLLING_RATE_SELECTOR(obj)->priv;

	priv->radios = NULL;
	column_number = 0;
	for (i = 0; i < ROCCAT_POLLING_RATE_SELECTOR_NUM; ++i) {
		if (radios[i].value & priv->mask) {
			radio = gtk_radio_button_new(priv->radios);
			g_object_set_data(G_OBJECT(radio), value_key, GUINT_TO_POINTER(radios[i].value));
			priv->radios = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));

			gtk_table_attach(table, radio, column_number, column_number + 1, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
			gtk_table_attach(table, gtk_label_new(radios[i].title), column_number, column_number + 1, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0);

			++column_number;
		}
	}
	return obj;
}
static GObject *konepuremilitary_single_cpi_selector_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties) {
	KonepuremilitarySingleCpiSelectorPrivate *priv;
	KonepuremilitarySingleCpiSelector *selector;
	GObject *obj;

	obj = G_OBJECT_CLASS(konepuremilitary_single_cpi_selector_parent_class)->constructor(gtype, n_properties, properties);
	selector = KONEPUREMILITARY_SINGLE_CPI_SELECTOR(obj);
	priv = selector->priv;

	priv->radio = GTK_RADIO_BUTTON(gtk_radio_button_new(NULL));
	gtk_box_pack_start(GTK_BOX(selector), GTK_WIDGET(priv->radio), FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(priv->radio), "toggled", G_CALLBACK(click_radio_cb), selector);

	priv->active = GTK_CHECK_BUTTON(gtk_check_button_new());
	gtk_box_pack_start(GTK_BOX(selector), GTK_WIDGET(priv->active), FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(priv->active), "toggled", G_CALLBACK(toggle_active_cb), selector);

	priv->scale = GAMINGGEAR_XY_SCALES(gaminggear_xy_scales_new(priv->min, priv->max, priv->step));
	gtk_box_pack_start(GTK_BOX(selector), GTK_WIDGET(priv->scale), TRUE, TRUE, 0);

	gtk_widget_show_all(GTK_WIDGET(selector));

	return obj;
}
Ejemplo n.º 23
0
/**
 * gimp_enum_icon_box_new_with_range:
 * @enum_type:     the #GType of an enum.
 * @minimum:       the minumim enum value
 * @maximum:       the maximum enum value
 * @icon_prefix:   the prefix of the group of icon names to use.
 * @icon_size:     the icon size for the icons
 * @callback:      a callback to connect to the "toggled" signal of each
 *                 #GtkRadioButton that is created.
 * @callback_data: data to pass to the @callback.
 * @first_button:  returns the first button in the created group.
 *
 * Just like gimp_enum_icon_box_new(), this function creates a group
 * of radio buttons, but additionally it supports limiting the range
 * of available enum values.
 *
 * Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
 *
 * Since: GIMP 2.10
 **/
GtkWidget *
gimp_enum_icon_box_new_with_range (GType         enum_type,
                                   gint          minimum,
                                   gint          maximum,
                                   const gchar  *icon_prefix,
                                   GtkIconSize   icon_size,
                                   GCallback     callback,
                                   gpointer      callback_data,
                                   GtkWidget   **first_button)
{
  GtkWidget  *hbox;
  GtkWidget  *button;
  GtkWidget  *image;
  GEnumClass *enum_class;
  GEnumValue *value;
  gchar      *icon_name;
  GSList     *group = NULL;

  g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
  g_return_val_if_fail (icon_prefix != NULL, NULL);

  enum_class = g_type_class_ref (enum_type);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  g_object_weak_ref (G_OBJECT (hbox),
                     (GWeakNotify) g_type_class_unref, enum_class);

  if (first_button)
    *first_button = NULL;

  for (value = enum_class->values; value->value_name; value++)
    {
      if (value->value < minimum || value->value > maximum)
        continue;

      button = gtk_radio_button_new (group);

      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
      gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);

      if (first_button && *first_button == NULL)
        *first_button = button;

      icon_name = g_strconcat (icon_prefix, "-", value->value_nick, NULL);

      image = gtk_image_new_from_icon_name (icon_name, icon_size);

      g_free (icon_name);

      if (image)
        {
          gtk_container_add (GTK_CONTAINER (button), image);
          gtk_widget_show (image);
        }

      gimp_help_set_help_data (button,
                               gimp_enum_value_get_desc (enum_class, value),
                               NULL);

      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      gtk_widget_show (button);

      g_object_set_data (G_OBJECT (button), "gimp-item-data",
                         GINT_TO_POINTER (value->value));

      if (callback)
        g_signal_connect (button, "toggled",
                          callback,
                          callback_data);
    }

  return hbox;
}
Ejemplo n.º 24
0
static int gtkToggleMapMethod(Ihandle* ih)
{
  Ihandle* radio = iupRadioFindToggleParent(ih);
  char *value;
  int is3state = 0;

  if (!ih->parent)
    return IUP_ERROR;

  if (radio)
    ih->data->radio = 1;

  value = iupAttribGet(ih, "IMAGE");
  if (value)
    ih->data->type = IUP_TOGGLE_IMAGE;
  else
    ih->data->type = IUP_TOGGLE_TEXT;

  if (radio)
  {
    GtkRadioButton* last_tg = (GtkRadioButton*)iupAttribGet(radio, "_IUPGTK_LASTRADIOBUTTON");
    if (last_tg)
      ih->handle = gtk_radio_button_new_from_widget(last_tg);
    else
      ih->handle = gtk_radio_button_new(NULL);
    iupAttribSetStr(radio, "_IUPGTK_LASTRADIOBUTTON", (char*)ih->handle);
  }
  else
  {
    if (ih->data->type == IUP_TOGGLE_TEXT)
    {
      ih->handle = gtk_check_button_new();

      if (iupAttribGetInt(ih, "3STATE"))
        is3state = 1;
    }
    else
      ih->handle = gtk_toggle_button_new();
  }

  if (!ih->handle)
    return IUP_ERROR;

  if (ih->data->type == IUP_TOGGLE_TEXT)
  {
    gtk_button_set_image((GtkButton*)ih->handle, gtk_label_new(NULL));
    gtk_toggle_button_set_mode((GtkToggleButton*)ih->handle, TRUE);
  }
  else
  {
    gtk_button_set_image((GtkButton*)ih->handle, gtk_image_new());
    gtk_toggle_button_set_mode((GtkToggleButton*)ih->handle, FALSE);
  }

  /* add to the parent, all GTK controls must call this. */
  iupgtkBaseAddToParent(ih);

  if (!iupStrBoolean(iupAttribGetStr(ih, "CANFOCUS")))
    GTK_WIDGET_FLAGS(ih->handle) &= ~GTK_CAN_FOCUS;

  g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);

  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

  g_signal_connect(G_OBJECT(ih->handle), "toggled",            G_CALLBACK(gtkToggleToggled), ih);

  if (ih->data->type == IUP_TOGGLE_IMAGE || is3state)
  {
    g_signal_connect(G_OBJECT(ih->handle), "button-press-event",  G_CALLBACK(gtkToggleButtonEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "button-release-event",G_CALLBACK(gtkToggleButtonEvent), ih);
  }

  if (is3state)
  {
    g_signal_connect(G_OBJECT(ih->handle), "key-press-event",  G_CALLBACK(gtkToggleKeyEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "key-release-event",  G_CALLBACK(gtkToggleKeyEvent), ih);
  }

  gtk_widget_realize(ih->handle);

  return IUP_NOERROR;
}
Ejemplo n.º 25
0
GtkWidget *
glade_tool_item_group_editor_new (GladeWidgetAdaptor *adaptor, 
                                  GladeEditable      *embed)
{
  GladeToolItemGroupEditor *group_editor;
  GladeEditorProperty *eprop;
  GtkWidget *table, *frame, *label, *hbox;
  gchar *str;
  gint row = 0;

  g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
  g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);

  group_editor = g_object_new (GLADE_TYPE_TOOL_ITEM_GROUP_EDITOR, NULL);
  group_editor->embed = GTK_WIDGET (embed);

  /* Pack the parent on top... */
  gtk_box_pack_start (GTK_BOX (group_editor), GTK_WIDGET (embed), FALSE, FALSE, 0);

  str = g_strdup_printf ("<b>%s</b>", _("Group Header"));
  label = gtk_label_new (str);
  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
  g_free (str);
  frame = gtk_frame_new (NULL);
  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
  gtk_box_pack_start (GTK_BOX (group_editor), frame, FALSE, FALSE, 0);

  table = gtk_grid_new ();
  gtk_widget_set_margin_top (table, 6);
  gtk_widget_set_margin_start (table, 12);
  gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
                                  GTK_ORIENTATION_VERTICAL);
  gtk_grid_set_row_spacing (GTK_GRID (table), 4);
  gtk_container_add (GTK_CONTAINER (frame), table);

  /* label */
  eprop =
      glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE,
                                                 TRUE);
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  group_editor->label_radio = gtk_radio_button_new (NULL);
  gtk_box_pack_start (GTK_BOX (hbox), group_editor->label_radio, FALSE, FALSE,
                      2);
  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
  table_attach (table, hbox, 0, row);
  table_attach (table, GTK_WIDGET (eprop), 1, row++);
  group_editor->properties = g_list_prepend (group_editor->properties, eprop);

  /* label-widget ... */
  eprop =
      glade_widget_adaptor_create_eprop_by_name (adaptor, "label-widget",
                                                 FALSE, TRUE);
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  group_editor->label_widget_radio = gtk_radio_button_new_from_widget
      (GTK_RADIO_BUTTON (group_editor->label_radio));
  gtk_box_pack_start (GTK_BOX (hbox), group_editor->label_widget_radio, FALSE,
                      FALSE, 2);
  gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
  table_attach (table, hbox, 0, row);
  table_attach (table, GTK_WIDGET (eprop), 1, row++);
  group_editor->properties = g_list_prepend (group_editor->properties, eprop);

  g_signal_connect (G_OBJECT (group_editor->label_widget_radio), "toggled",
                    G_CALLBACK (label_widget_toggled), group_editor);
  g_signal_connect (G_OBJECT (group_editor->label_radio), "toggled",
                    G_CALLBACK (label_toggled), group_editor);

  gtk_widget_show_all (GTK_WIDGET (group_editor));

  return GTK_WIDGET (group_editor);
}
Ejemplo n.º 26
0
static int gtkToggleMapMethod(Ihandle* ih)
{
  Ihandle* radio = iupRadioFindToggleParent(ih);
  char *value;
  int is3state = 0;

  if (!ih->parent)
    return IUP_ERROR;

  value = iupAttribGet(ih, "IMAGE");
  if (value)
    ih->data->type = IUP_TOGGLE_IMAGE;
  else
    ih->data->type = IUP_TOGGLE_TEXT;

  if (radio)
  {
    GtkRadioButton* last_tg = (GtkRadioButton*)iupAttribGet(radio, "_IUPGTK_LASTRADIOBUTTON");
    if (last_tg)
      ih->handle = gtk_radio_button_new_from_widget(last_tg);
    else
      ih->handle = gtk_radio_button_new(NULL);
    iupAttribSet(radio, "_IUPGTK_LASTRADIOBUTTON", (char*)ih->handle);

    /* make sure it has at least one name */
    if (!iupAttribGetHandleName(ih))
      iupAttribSetHandleName(ih);

    ih->data->is_radio = 1;
  }
  else
  {
    if (ih->data->type == IUP_TOGGLE_TEXT)
    {
      ih->handle = gtk_check_button_new();

      if (iupAttribGetBoolean(ih, "3STATE"))
        is3state = 1;
    }
    else
      ih->handle = gtk_toggle_button_new();
  }

  if (!ih->handle)
    return IUP_ERROR;

  if (ih->data->type == IUP_TOGGLE_TEXT)
  {
    gtk_button_set_image((GtkButton*)ih->handle, gtk_label_new(NULL));
    gtk_toggle_button_set_mode((GtkToggleButton*)ih->handle, TRUE);
  }
  else
  {
    gtk_button_set_image((GtkButton*)ih->handle, gtk_image_new());
    gtk_toggle_button_set_mode((GtkToggleButton*)ih->handle, FALSE);
  }

  iupgtkClearSizeStyleCSS(ih->handle);

  /* add to the parent, all GTK controls must call this. */
  iupgtkAddToParent(ih);

  if (!iupAttribGetBoolean(ih, "CANFOCUS"))
    iupgtkSetCanFocus(ih->handle, 0);

  if (ih->data->type == IUP_TOGGLE_IMAGE && ih->data->flat)
  {
    gtk_button_set_relief((GtkButton*)ih->handle, GTK_RELIEF_NONE);

    g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(gtkToggleEnterLeaveEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(gtkToggleEnterLeaveEvent), ih);
  }
  else
  {
    g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  }

  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

  g_signal_connect(G_OBJECT(ih->handle), "toggled",            G_CALLBACK(gtkToggleToggled), ih);

  if (ih->data->type == IUP_TOGGLE_IMAGE || is3state)
  {
    g_signal_connect(G_OBJECT(ih->handle), "button-press-event",  G_CALLBACK(gtkToggleButtonEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "button-release-event",G_CALLBACK(gtkToggleButtonEvent), ih);
  }

  if (is3state)
  {
    g_signal_connect(G_OBJECT(ih->handle), "key-press-event",  G_CALLBACK(gtkToggleKeyEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "key-release-event",  G_CALLBACK(gtkToggleKeyEvent), ih);
  }

  gtk_widget_realize(ih->handle);

  /* update a mnemonic in a label if necessary */
  iupgtkUpdateMnemonic(ih);

  return IUP_NOERROR;
}
Ejemplo n.º 27
0
/** \brief Create and initialise time controller widgets.
 *  \param module The parent GtkSatModule
 *
 */
void tmg_create (GtkSatModule *mod)
{
    GtkWidget   *vbox, *hbox, *table;
    GtkWidget   *image;
    GtkWidget   *label;
    gchar       *title;
    gchar       *buff;


    /* make sure controller is not already active */
    if (mod->tmgActive) {
        sat_log_log (SAT_LOG_LEVEL_INFO,
                     _("%s: Time Controller for %s is already active"),
                     __FUNCTION__, mod->name);

        /* try to make window visible in case it is covered
                   by something else */
        gtk_window_present (GTK_WINDOW (mod->tmgWin));

        return;
    }

    /* create hbox containing the controls
       the controls are implemented as radiobuttons in order
       to inherit the mutual exclusion behaviour
    */
    hbox = gtk_hbox_new (FALSE, 0);

    
    /* FWD */
    mod->tmgFwd = gtk_radio_button_new (NULL);
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgFwd), FALSE);
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mod->tmgFwd), TRUE);
    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_FORWARD, GTK_ICON_SIZE_BUTTON);
    gtk_container_add (GTK_CONTAINER (mod->tmgFwd), image);
    gtk_widget_set_tooltip_text (mod->tmgFwd, _("Play forward"));
    g_signal_connect (mod->tmgFwd, "toggled", G_CALLBACK (tmg_fwd), mod);
    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgFwd, FALSE, FALSE, 0);

    /* STOP */
    mod->tmgStop = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (mod->tmgFwd));
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgStop), FALSE);
    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON);
    gtk_container_add (GTK_CONTAINER (mod->tmgStop), image);
    gtk_widget_set_tooltip_text (mod->tmgStop, _("Stop"));
    g_signal_connect (mod->tmgStop, "toggled", G_CALLBACK (tmg_stop), mod);
    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgStop, FALSE, FALSE, 0);

    /* BWD */
    mod->tmgBwd = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (mod->tmgFwd));
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mod->tmgBwd), FALSE);
    image = gtk_image_new_from_stock (GTK_STOCK_MEDIA_REWIND, GTK_ICON_SIZE_BUTTON);
    gtk_container_add (GTK_CONTAINER (mod->tmgBwd), image);
    gtk_widget_set_tooltip_text (mod->tmgBwd, _("Play backwards"));
    g_signal_connect (mod->tmgBwd, "toggled", G_CALLBACK (tmg_bwd), mod);
    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgBwd, FALSE, FALSE, 0);

    /* reset time */
    mod->tmgReset = gtk_button_new_with_label (_("Reset"));
    gtk_widget_set_tooltip_text (mod->tmgReset, _("Reset to current date and time"));
    g_signal_connect (mod->tmgReset, "clicked", G_CALLBACK (tmg_reset), mod);
    gtk_box_pack_end (GTK_BOX (hbox), mod->tmgReset, FALSE, FALSE, 10);

    /* status label */
    mod->tmgState = gtk_label_new (NULL);
    gtk_misc_set_alignment (GTK_MISC (mod->tmgState), 0.0, 0.5);
    gtk_label_set_markup (GTK_LABEL (mod->tmgState), _("<b>Real-Time</b>"));
    gtk_box_pack_start (GTK_BOX (hbox), mod->tmgState, TRUE, TRUE, 10);


    /* create table containing the date and time widgets */
    table = gtk_table_new (5, 3, FALSE);
    gtk_table_set_row_spacings (GTK_TABLE (table), 0);

    mod->tmgCal = gtk_calendar_new ();
    gtk_calendar_set_display_options (GTK_CALENDAR (mod->tmgCal),
                                      GTK_CALENDAR_SHOW_HEADING     |
                                      GTK_CALENDAR_SHOW_DAY_NAMES |
                                      GTK_CALENDAR_WEEK_START_MONDAY);
    g_signal_connect (mod->tmgCal, "day-selected",
                      G_CALLBACK (tmg_time_set), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgCal,
                      0, 1, 0, 5, GTK_SHRINK, GTK_SHRINK,
                      0, 0);

    /* Time controllers.
       Note that the controllers for hours, minutes, and seconds have ranges;
       however, they can wrap around their limits in order to ensure a smooth
       and continuous control of the time
    */

    /* hour */
    label = gtk_label_new (_(" Hour:"));
    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label,
                      1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 5, 0);
    mod->tmgHour = gtk_spin_button_new_with_range (0, 23, 1);
    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgHour), TRUE);
    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgHour),
                                       GTK_UPDATE_IF_VALID);
    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgHour), 0);
    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgHour), TRUE);
    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgHour), 2);
    gtk_widget_set_tooltip_text (mod->tmgHour,
                                 _("Use this control to set the hour"));
    g_signal_connect (mod->tmgHour, "value-changed",
                      G_CALLBACK (tmg_time_set), mod);
    g_signal_connect (mod->tmgHour, "wrapped", G_CALLBACK (tmg_hour_wrap), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgHour,
                      2, 3, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);

    /* minutes */
    label = gtk_label_new (_(" Min:"));
    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label,
                      1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 5, 0);
    mod->tmgMin = gtk_spin_button_new_with_range (0, 59, 1);
    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgMin), TRUE);
    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgMin),
                                       GTK_UPDATE_IF_VALID);
    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgMin), 0);
    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgMin), TRUE);
    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMin), 2);
    gtk_widget_set_tooltip_text (mod->tmgMin,
                                 _("Use this control to set the minutes"));
    g_signal_connect (mod->tmgMin, "value-changed",
                      G_CALLBACK (tmg_time_set), mod);
    g_signal_connect (mod->tmgMin, "wrapped", G_CALLBACK (tmg_min_wrap), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgMin,
                      2, 3, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);

    /* seconds */
    label = gtk_label_new (_(" Sec:"));
    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label,
                      1, 2, 2, 3, GTK_SHRINK, GTK_SHRINK, 5, 0);
    mod->tmgSec = gtk_spin_button_new_with_range (0, 59, 1);
    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgSec), TRUE);
    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgSec),
                                       GTK_UPDATE_IF_VALID);
    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgSec), 0);
    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgSec), TRUE);
    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgSec), 2);
    gtk_widget_set_tooltip_text (mod->tmgSec,
                                 _("Use this control to set the seconds"));
    g_signal_connect (mod->tmgSec, "value-changed",
                      G_CALLBACK (tmg_time_set), mod);
    g_signal_connect (mod->tmgSec, "wrapped", G_CALLBACK (tmg_sec_wrap), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgSec,
                      2, 3, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);

    /* milliseconds */
    label = gtk_label_new (_(" Msec:"));
    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label,
                      1, 2, 3, 4, GTK_SHRINK, GTK_SHRINK, 5, 0);
    mod->tmgMsec = gtk_spin_button_new_with_range (0, 999, 1);
    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgMsec), TRUE);
    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgMsec),
                                       GTK_UPDATE_IF_VALID);
    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgMsec), 0);
    gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (mod->tmgMsec), TRUE);
    //FIXME gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgMsec), 2);
    gtk_widget_set_tooltip_text (mod->tmgMsec,
                                 _("Use this control to set the milliseconds"));
    g_signal_connect (mod->tmgMsec, "value-changed",
                      G_CALLBACK (tmg_time_set), mod);
    g_signal_connect (mod->tmgMsec, "wrapped", G_CALLBACK (tmg_msec_wrap), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgMsec,
                      2, 3, 3, 4, GTK_SHRINK, GTK_SHRINK, 0, 0);

    /* time throttle */
    label = gtk_label_new (_("Throttle:"));
    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
    gtk_table_attach (GTK_TABLE (table), label,
                      1, 2, 4, 5, GTK_SHRINK, GTK_SHRINK, 5, 0);
    mod->tmgFactor = gtk_spin_button_new_with_range (1, 100, 1);
    gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mod->tmgFactor), TRUE);
    gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mod->tmgFactor),
                                       GTK_UPDATE_IF_VALID);
    gtk_spin_button_set_digits (GTK_SPIN_BUTTON (mod->tmgFactor), 0);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (mod->tmgFactor), 1);
    gtk_widget_set_tooltip_text (mod->tmgFactor,
                                 _("Time throttle / compression factor"));
    g_signal_connect (mod->tmgFactor, "value-changed",
                      G_CALLBACK (tmg_throttle), mod);
    gtk_table_attach (GTK_TABLE (table), mod->tmgFactor,
                      2, 3, 4, 5, GTK_SHRINK, GTK_SHRINK, 0, 0);

    /* add slider */
    mod->tmgSlider = gtk_hscale_new_with_range (-0.1, +0.1, 0.0001);  // +/- 2.5 hr
    /*gtk_widget_set_tooltip_text (mod->tmgSlider,
                                 _("Drag the slider to change the time up to +/- 2.5 hours.\n"\
                                   "Resolution is ~ 8 seconds."));*/
    gtk_scale_set_draw_value (GTK_SCALE (mod->tmgSlider), FALSE);
    gtk_range_set_value (GTK_RANGE (mod->tmgSlider), 0.0);
    g_signal_connect (mod->tmgSlider, "value-changed",
                      G_CALLBACK (slider_moved), mod);


    /* create the vertical box */
    vbox = gtk_vbox_new (FALSE, 0);

    gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), mod->tmgSlider, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);


    /* create main window */
    mod->tmgWin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    title = g_strconcat (_("Time Controller"), " / ", mod->name, NULL);
    gtk_window_set_title (GTK_WINDOW (mod->tmgWin), title);
    g_free (title);
    gtk_window_set_transient_for (GTK_WINDOW (mod->tmgWin),
                                  GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (mod))));
    g_signal_connect (G_OBJECT (mod->tmgWin), "delete_event",
                      G_CALLBACK (tmg_delete), mod);    
    g_signal_connect (G_OBJECT (mod->tmgWin), "destroy",
                      G_CALLBACK (tmg_destroy), mod);

    /* window icon */
    buff = icon_file_name ("gpredict-clock.png");
    gtk_window_set_icon_from_file (GTK_WINDOW (mod->tmgWin), buff, NULL);
    g_free (buff);

    gtk_container_add (GTK_CONTAINER (mod->tmgWin), vbox);
    gtk_widget_show_all (mod->tmgWin);

    mod->tmgActive = TRUE;

    sat_log_log (SAT_LOG_LEVEL_INFO,
                 _("%s: Time Controller for %s launched"),
                 __FUNCTION__, mod->name);
}
Ejemplo n.º 28
0
GtkWidget* bimp_watermark_gui_new(watermark_settings settings)
{
	GtkWidget *gui, *hbox_text_entry, *hbox_text_font, *hbox_text_color, *hbox_opacity, *frame_position, *table_position;
	GtkWidget *align_radio_text, *align_radio_image;
	GtkWidget *label_text, *label_font, *label_color, *label_opacity, *label_percent;
		
	gui = gtk_vbox_new(FALSE, 5);
	
	align_radio_text = gtk_alignment_new(0, 0, 0, 0);
	gtk_alignment_set_padding(GTK_ALIGNMENT(align_radio_text), 0, 5, 10, 0);
	radio_text = gtk_radio_button_new_with_label(NULL, _("Text watermark"));
	
	vbox_text = gtk_vbox_new(FALSE, 5);
	hbox_text_entry = gtk_hbox_new(FALSE, 5);
	label_text = gtk_label_new(g_strconcat(_("Text"), ":", NULL));
	gtk_widget_set_size_request (label_text, LABEL_W, LABEL_H);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_text), settings->mode);
	entry_text = gtk_entry_new();
	gtk_entry_set_max_length(GTK_ENTRY(entry_text), 50);
	gtk_entry_set_text(GTK_ENTRY(entry_text), settings->text);
	gtk_widget_set_size_request (entry_text, INPUT_W, INPUT_H);
	
	hbox_text_font = gtk_hbox_new(FALSE, 5);
	label_font = gtk_label_new(g_strconcat(_("Font"), ":", NULL));
	gtk_widget_set_size_request (label_font, LABEL_W, LABEL_H);
	chooser_font = gtk_font_button_new_with_font(pango_font_description_to_string(settings->font));
	gtk_widget_set_size_request (chooser_font, INPUT_W, INPUT_H);
	
	hbox_text_color = gtk_hbox_new(FALSE, 5);
	label_color = gtk_label_new(g_strconcat(_("Color"), ":", NULL));
	gtk_widget_set_size_request (label_color, LABEL_W, LABEL_H);
	chooser_color = gtk_color_button_new_with_color(&(settings->color));
	gtk_widget_set_size_request (chooser_color, INPUT_W, INPUT_H);
	
	align_radio_image = gtk_alignment_new(0, 0, 0, 0);
	gtk_alignment_set_padding(GTK_ALIGNMENT(align_radio_image), 0, 5, 10, 0);
	radio_image = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(radio_text), _("Image watermark"));
	
	vbox_image = gtk_vbox_new(FALSE, 5);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_image), !settings->mode);
	chooser_image = gtk_file_chooser_button_new(_("Select image"), GTK_FILE_CHOOSER_ACTION_OPEN);
	
	/* set image chooser's filters */
	GtkFileFilter *filter_all, *supported[5];	
	filter_all = gtk_file_filter_new();
	gtk_file_filter_set_name(filter_all, _("All supported types"));
	
		supported[0] = gtk_file_filter_new();
		gtk_file_filter_set_name(supported[0], "Bitmap (*.bmp)");
		gtk_file_filter_add_pattern (supported[0], "*.bmp");
		gtk_file_filter_add_pattern (filter_all, "*.bmp");
		
		supported[1] = gtk_file_filter_new();
		gtk_file_filter_set_name(supported[1], "JPEG (*.jpg, *.jpeg, *jpe)");
		gtk_file_filter_add_pattern (supported[1], "*.jpg");
		gtk_file_filter_add_pattern (supported[1], "*.jpeg");
		gtk_file_filter_add_pattern (supported[1], "*.jpe");
		gtk_file_filter_add_pattern (filter_all, "*.jpg");
		gtk_file_filter_add_pattern (filter_all, "*.jpeg");
		gtk_file_filter_add_pattern (filter_all, "*.jpe");
	
		supported[2] = gtk_file_filter_new();
		gtk_file_filter_set_name(supported[2], "GIF (*.gif)");
		gtk_file_filter_add_pattern (supported[2], "*.gif");
		gtk_file_filter_add_pattern (filter_all, "*.gif");
		
		supported[3] = gtk_file_filter_new();
		gtk_file_filter_set_name(supported[3], "PNG (*.png)");
		gtk_file_filter_add_pattern (supported[3], "*.png");
		gtk_file_filter_add_pattern (filter_all, "*.png");
		
		supported[4] = gtk_file_filter_new();
		gtk_file_filter_set_name(supported[4], "TIFF (*tif, *.tiff)");
		gtk_file_filter_add_pattern (supported[4], "*.tiff");
		gtk_file_filter_add_pattern (supported[4], "*.tif");
		gtk_file_filter_add_pattern (filter_all, "*.tiff");
		gtk_file_filter_add_pattern (filter_all, "*.tif");
	
	gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser_image), filter_all);
	int i;
	for(i = 0; i < 5; i++) {
		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser_image), supported[i]);
	}
	
	if (settings->image_file != NULL) {
		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser_image), settings->image_file);
	}
	gtk_widget_set_size_request (chooser_image, INPUT_W, INPUT_H);
	
	hbox_opacity = gtk_hbox_new(FALSE, 5);
	label_opacity = gtk_label_new(g_strconcat(_("Opacity"), ":", NULL));
	gtk_widget_set_size_request (label_opacity, LABEL_TRANSP_W, LABEL_TRANSP_H);
	gtk_misc_set_alignment(GTK_MISC(label_opacity), 0.5, 0.8);
	scale_opacity = gtk_hscale_new_with_range(1, 100, 1);
	gtk_range_set_value(GTK_RANGE(scale_opacity), settings->opacity);
	gtk_widget_set_size_request (scale_opacity, SCALE_TRANSP_W, SCALE_TRANSP_H);
	label_percent = gtk_label_new("%");
	gtk_widget_set_size_request (label_percent, LABEL_PERCENT_W, LABEL_PERCENT_H);
	gtk_misc_set_alignment(GTK_MISC(label_percent), 0.5, 0.8);
	
	frame_position = gtk_frame_new(g_strconcat(_("Position on the image"), ":", NULL));
	gtk_widget_set_size_request (frame_position, FRAME_POSITION_W, FRAME_POSITION_H);
	table_position = gtk_table_new(3, 3, TRUE);
	
	button_tl = gtk_radio_button_new (NULL);
	gtk_button_set_image(GTK_BUTTON(button_tl), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_postl, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_tl, watermark_pos_get_string(WM_POS_TL));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_tl), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_tl), settings->position == WM_POS_TL);
	gtk_widget_set_size_request (button_tl, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_tl, 0, 1, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
	button_tc = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_tc), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_postc, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_tc, watermark_pos_get_string(WM_POS_TC));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_tc), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_tc), settings->position == WM_POS_TC);
	gtk_widget_set_size_request (button_tc, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_tc, 1, 2, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
	
	button_tr = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_tr), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_postr, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_tr, watermark_pos_get_string(WM_POS_TR));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_tr), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_tr), settings->position == WM_POS_TR);
	gtk_widget_set_size_request (button_tr, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_tr, 2, 3, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
	button_cl = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_cl), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_poscl, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_cl, watermark_pos_get_string(WM_POS_CL));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_cl), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_cl), settings->position == WM_POS_CL);
	gtk_widget_set_size_request (button_cl, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_cl, 0, 1, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
	
	button_cc = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_cc), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_poscc, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_cc, watermark_pos_get_string(WM_POS_CC));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_cc), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_cc), settings->position == WM_POS_CC);
	gtk_widget_set_size_request (button_cc, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_cc, 1, 2, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
	button_cr = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_cr), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_poscr, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_cr, watermark_pos_get_string(WM_POS_CR));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_cr), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_cr), settings->position == WM_POS_CR);
	gtk_widget_set_size_request (button_cr, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_cr, 2, 3, 1, 2, GTK_EXPAND, GTK_EXPAND, 0, 0);
	
	button_bl = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_bl), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_posbl, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_bl, watermark_pos_get_string(WM_POS_BL));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_bl), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_bl), settings->position == WM_POS_BL);
	gtk_widget_set_size_request (button_bl, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_bl, 0, 1, 2, 3, GTK_EXPAND, GTK_EXPAND, 0, 0);
	button_bc = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_bc), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_posbc, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_bc, watermark_pos_get_string(WM_POS_BC));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_bc), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_bc), settings->position == WM_POS_BC);
	gtk_widget_set_size_request (button_bc, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_bc, 1, 2, 2, 3, GTK_EXPAND, GTK_EXPAND, 0, 0);
	
	button_br = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(button_tl));
	gtk_button_set_image(GTK_BUTTON(button_br), gtk_image_new_from_pixbuf(gdk_pixbuf_from_pixdata(&pixdata_posbr, TRUE, NULL)));
	gtk_widget_set_tooltip_text (button_br, watermark_pos_get_string(WM_POS_BR));
	gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button_br), FALSE);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_br), settings->position == WM_POS_BR);
	gtk_widget_set_size_request (button_br, BUTTON_POSITION_W, BUTTON_POSITION_H);
	gtk_table_attach(GTK_TABLE(table_position), button_br, 2, 3, 2, 3, GTK_EXPAND, GTK_EXPAND, 0, 0);
	
	gtk_box_pack_start(GTK_BOX(gui), radio_text, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(hbox_text_entry), label_text, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_text_entry), entry_text, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_text_font), label_font, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_text_font), chooser_font, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_text_color), label_color, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_text_color), chooser_color, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(vbox_text), hbox_text_entry, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox_text), hbox_text_font, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox_text), hbox_text_color, FALSE, FALSE, 0);
	gtk_container_add(GTK_CONTAINER(align_radio_text), vbox_text);
	gtk_box_pack_start(GTK_BOX(gui), align_radio_text, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(gui), radio_image, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(vbox_image), chooser_image, FALSE, FALSE, 0);
	gtk_container_add(GTK_CONTAINER(align_radio_image), vbox_image);
	gtk_box_pack_start(GTK_BOX(gui), align_radio_image, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(hbox_opacity), label_opacity, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_opacity), scale_opacity, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_opacity), label_percent, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(gui), hbox_opacity, FALSE, FALSE, 0);
	
	gtk_container_add(GTK_CONTAINER(frame_position), table_position);
	gtk_box_pack_start(GTK_BOX(gui), frame_position, FALSE, FALSE, 0);
	
	toggle_group(NULL, NULL);
	
	g_signal_connect(G_OBJECT(radio_text), "toggled", G_CALLBACK(toggle_group), NULL);
	
	return gui;
}
Ejemplo n.º 29
0
static void atlas_template_dialog_init(AtlasTemplateDialog *atlas_template_dialog)
{
	AtlasTemplateDialog * atd = atlas_template_dialog;
	gtk_dialog_set_has_separator(GTK_DIALOG(atd), FALSE);

	gtk_dialog_add_button(GTK_DIALOG(atd), "Apply", 0);
	gtk_dialog_add_button(GTK_DIALOG(atd), "Cancel", -1);

	atd -> combo_pagesize = gtk_combo_box_new_text();
	int i; char text[8];
	for (i = 0; i < PAPERSIZE_LAST; i++){
		gtk_combo_box_append_text(GTK_COMBO_BOX(atd -> combo_pagesize), page_format_names[i]);
	}

	atd -> entry_width = gtk_entry_new();
	atd -> entry_height = gtk_entry_new();

	atd -> radio_orientation_landscape	= gtk_radio_button_new(NULL);
	atd -> radio_orientation_portrait	= gtk_radio_button_new(gtk_radio_button_get_group(GTK_RADIO_BUTTON(atd -> radio_orientation_landscape)));
	GtkWidget * image_landscape 	= gtk_image_new_from_stock("gtk-orientation-landscape", GTK_ICON_SIZE_BUTTON);
	GtkWidget * image_portrait	= gtk_image_new_from_stock("gtk-orientation-portrait", GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image(GTK_BUTTON(atd -> radio_orientation_landscape), image_landscape);
	gtk_button_set_image(GTK_BUTTON(atd -> radio_orientation_portrait), image_portrait);
	GtkWidget * box_orientation = gtk_hbox_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(box_orientation), atd -> radio_orientation_portrait, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(box_orientation), atd -> radio_orientation_landscape, FALSE, FALSE, 0);

        atd -> entry_border_top    = gtk_entry_new();
        atd -> entry_border_left   = gtk_entry_new();
        atd -> entry_border_right  = gtk_entry_new();
        atd -> entry_border_bottom = gtk_entry_new();

        atd -> entry_resolution = gtk_entry_new();

	GtkWidget * label_paper_format	= gtk_label_new("Paper format");
	GtkWidget * label_format	= gtk_label_new("Format");
	GtkWidget * label_width		= gtk_label_new("Width");
	GtkWidget * label_height	= gtk_label_new("Height");
	GtkWidget * label_orientation	= gtk_label_new("Orientation");
	GtkWidget * label_margins	= gtk_label_new("Margins");
	GtkWidget * label_left		= gtk_label_new("Left");
	GtkWidget * label_right		= gtk_label_new("Right");
	GtkWidget * label_top		= gtk_label_new("Top");
	GtkWidget * label_bottom	= gtk_label_new("Bottom");
	GtkWidget * label_quality	= gtk_label_new("Quality");
	GtkWidget * label_resolution	= gtk_label_new("Resolution");

	GtkWidget * table = gtk_table_new(10, 2, FALSE);
        gtk_table_attach(GTK_TABLE(table), label_paper_format,		0, 1, 0,  1,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_format,		0, 1, 1,  2,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> combo_pagesize,	1, 2, 1,  2,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_width,			0, 1, 2,  3,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_width,		1, 2, 2,  3,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_height,		0, 1, 3,  4,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_height,		1, 2, 3,  4,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_orientation,		0, 1, 4,  5,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), box_orientation,		1, 2, 4,  5,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_margins,		0, 1, 5,  6,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_left,			0, 1, 6,  7,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_border_left,	1, 2, 6,  7,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_right,			0, 1, 7,  8,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_border_right,	1, 2, 7,  8,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_top,			0, 1, 8,  9,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_border_top,	1, 2, 8,  9,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_bottom,		0, 1, 9,  10, GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_border_bottom,	1, 2, 9,  10, GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_quality,		0, 1, 10, 11,  GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), label_resolution,		0, 1, 11, 12, GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtk_table_attach(GTK_TABLE(table), atd -> entry_resolution,	1, 2, 11, 12, GTK_EXPAND | GTK_FILL, 0, 0, 0);

	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(atd) -> vbox), table, FALSE, FALSE, 0);

	//gtk_widget_set_size_request(GTK_WIDGET(atd -> entry_height), 40, -1);
	gtk_widget_show_all(GTK_WIDGET(atd));

        g_signal_connect(G_OBJECT(atd -> combo_pagesize), "changed", G_CALLBACK(papertype_changed_cb), (gpointer)atd);
        g_signal_connect(G_OBJECT(atd -> radio_orientation_portrait), "toggled", G_CALLBACK(orientation_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_width), "changed", G_CALLBACK(size_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_height), "changed", G_CALLBACK(size_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_border_top), "changed", G_CALLBACK(border_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_border_bottom), "changed", G_CALLBACK(border_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_border_left), "changed", G_CALLBACK(border_changed_cb), (gpointer)atd);
	g_signal_connect(G_OBJECT(atd -> entry_border_right), "changed", G_CALLBACK(border_changed_cb), (gpointer)atd);
	//g_signal_connect(G_OBJECT(atd -> entry_resolution), "changed", G_CALLBACK(resolution_changed_cb), (gpointer)atd);
}
Ejemplo n.º 30
0
GtkWidget*
create_step1_dbox (void)
{
  GtkWidget *step1_dbox;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox1;
  GtkWidget *label10;
  GtkWidget *hseparator1;
  GSList *vbox1_group = NULL;
  GtkWidget *radiobutton1;
  GtkWidget *label14;
  GtkWidget *radiobutton2;
  GtkWidget *label13;
  GtkWidget *radiobutton3;
  GtkWidget *label12;
  GtkWidget *hseparator2;
  GtkWidget *label11;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox3;
  GtkWidget *button4;
  GtkWidget *hbox4;
  GtkWidget *pixmap4;
  guint label7_key;
  GtkWidget *label7;
  GtkWidget *button5;
  GtkWidget *hbox5;
  GtkWidget *pixmap5;
  guint label8_key;
  GtkWidget *label8;
  GtkWidget *button6;
  GtkWidget *hbox6;
  GtkWidget *pixmap6;
  guint label9_key;
  GtkWidget *label9;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  step1_dbox = gtk_dialog_new ();
  gtk_widget_set_name (step1_dbox, "step1_dbox");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "step1_dbox", step1_dbox);
  gtk_window_set_title (GTK_WINDOW (step1_dbox), _("GtkTiEmu startup"));
  gtk_window_set_modal (GTK_WINDOW (step1_dbox), TRUE);
  gtk_window_set_policy (GTK_WINDOW (step1_dbox), TRUE, TRUE, TRUE);

  dialog_vbox3 = GTK_DIALOG (step1_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox3, "dialog_vbox3");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "dialog_vbox3", dialog_vbox3);
  gtk_widget_show (dialog_vbox3);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox1, "vbox1");
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);

  label10 = gtk_label_new (_("Welcome to GtkTiEmu. To use it, you must have a ROM image..."));
  gtk_widget_set_name (label10, "label10");
  gtk_widget_ref (label10);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label10", label10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label10);
  gtk_box_pack_start (GTK_BOX (vbox1), label10, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label10), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label10), 15, 5);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator1, "hseparator1");
  gtk_widget_ref (hseparator1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hseparator1", hseparator1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 0);

  radiobutton1 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1));
  gtk_widget_set_name (radiobutton1, "radiobutton1");
  gtk_widget_ref (radiobutton1);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton1", radiobutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton1);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton1, FALSE, FALSE, 0);

  label14 = gtk_label_new (_("You can use TiLP or another dumping program for getting a ROM image of your calculator."));
  gtk_widget_set_name (label14, "label14");
  gtk_widget_ref (label14);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label14", label14,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label14);
  gtk_container_add (GTK_CONTAINER (radiobutton1), label14);
  gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label14), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label14), 5, 0);

  radiobutton2 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2));
  gtk_widget_set_name (radiobutton2, "radiobutton2");
  gtk_widget_ref (radiobutton2);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton2", radiobutton2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton2);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton2, FALSE, FALSE, 0);

  label13 = gtk_label_new (_("You have downloaded a FLASH upgrade on the TI website and you would like to convert it."));
  gtk_widget_set_name (label13, "label13");
  gtk_widget_ref (label13);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label13", label13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label13);
  gtk_container_add (GTK_CONTAINER (radiobutton2), label13);
  gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label13), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label13), 5, 0);

  radiobutton3 = gtk_radio_button_new (vbox1_group);
  vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton3));
  gtk_widget_set_name (radiobutton3, "radiobutton3");
  gtk_widget_ref (radiobutton3);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "radiobutton3", radiobutton3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton3);
  gtk_box_pack_start (GTK_BOX (vbox1), radiobutton3, FALSE, FALSE, 0);

  label12 = gtk_label_new (_("You have already a ROM image and you would like to use it."));
  gtk_widget_set_name (label12, "label12");
  gtk_widget_ref (label12);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label12", label12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label12);
  gtk_container_add (GTK_CONTAINER (radiobutton3), label12);
  gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label12), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label12), 5, 0);

  hseparator2 = gtk_hseparator_new ();
  gtk_widget_set_name (hseparator2, "hseparator2");
  gtk_widget_ref (hseparator2);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hseparator2", hseparator2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator2);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, TRUE, TRUE, 0);

  label11 = gtk_label_new (_("Remind you that you should not distribute your ROM images. They are copyrighted by Texas Instruments."));
  gtk_widget_set_name (label11, "label11");
  gtk_widget_ref (label11);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label11", label11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (vbox1), label11, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label11), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label11), 15, 5);

  dialog_action_area3 = GTK_DIALOG (step1_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area3, "dialog_action_area3");
  gtk_object_set_data (GTK_OBJECT (step1_dbox), "dialog_action_area3", dialog_action_area3);
  gtk_widget_show (dialog_action_area3);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area3), 10);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox3, "hbuttonbox3");
  gtk_widget_ref (hbuttonbox3);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbuttonbox3", hbuttonbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (dialog_action_area3), hbuttonbox3, TRUE, TRUE, 0);

  button4 = gtk_button_new ();
  gtk_widget_set_name (button4, "button4");
  gtk_widget_ref (button4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button4", button4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button4);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button4);
  GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox4, "hbox4");
  gtk_widget_ref (hbox4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox4", hbox4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox4);
  gtk_container_add (GTK_CONTAINER (button4), hbox4);

  pixmap4 = create_pixmap (step1_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap4, "pixmap4");
  gtk_widget_ref (pixmap4);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap4", pixmap4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap4);
  gtk_box_pack_start (GTK_BOX (hbox4), pixmap4, TRUE, FALSE, 0);

  label7 = gtk_label_new ("");
  label7_key = gtk_label_parse_uline (GTK_LABEL (label7),
                                   _("< _Back"));
  gtk_widget_set_name (label7, "label7");
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox4), label7, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label7), 5, 0);

  button5 = gtk_button_new ();
  gtk_widget_set_name (button5, "button5");
  gtk_widget_ref (button5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button5", button5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button5);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button5);
  GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox5, "hbox5");
  gtk_widget_ref (hbox5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox5", hbox5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (button5), hbox5);

  pixmap5 = create_pixmap (step1_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap5, "pixmap5");
  gtk_widget_ref (pixmap5);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap5", pixmap5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap5);
  gtk_box_pack_start (GTK_BOX (hbox5), pixmap5, TRUE, FALSE, 0);

  label8 = gtk_label_new ("");
  label8_key = gtk_label_parse_uline (GTK_LABEL (label8),
                                   _("_Next >"));
  gtk_widget_set_name (label8, "label8");
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label8), 5, 0);

  button6 = gtk_button_new ();
  gtk_widget_set_name (button6, "button6");
  gtk_widget_ref (button6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "button6", button6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button6);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button6);
  GTK_WIDGET_SET_FLAGS (button6, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox6 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox6, "hbox6");
  gtk_widget_ref (hbox6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "hbox6", hbox6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox6);
  gtk_container_add (GTK_CONTAINER (button6), hbox6);

  pixmap6 = create_pixmap (step1_dbox, "no.xpm");
  gtk_widget_set_name (pixmap6, "pixmap6");
  gtk_widget_ref (pixmap6);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "pixmap6", pixmap6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap6);
  gtk_box_pack_start (GTK_BOX (hbox6), pixmap6, TRUE, FALSE, 0);

  label9 = gtk_label_new ("");
  label9_key = gtk_label_parse_uline (GTK_LABEL (label9),
                                   _("_Cancel"));
  gtk_widget_set_name (label9, "label9");
  gtk_widget_ref (label9);
  gtk_object_set_data_full (GTK_OBJECT (step1_dbox), "label9", label9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox6), label9, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label9), 5, 0);

  gtk_signal_connect (GTK_OBJECT (radiobutton1), "toggled",
                      GTK_SIGNAL_FUNC (step1_on_radiobutton1_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton2), "toggled",
                      GTK_SIGNAL_FUNC (step2_on_radiobutton2_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton3), "toggled",
                      GTK_SIGNAL_FUNC (step3_on_radiobutton3_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button4), "clicked",
                      GTK_SIGNAL_FUNC (step1_b1_button_clicked),
                      step1_dbox);
  gtk_signal_connect (GTK_OBJECT (button5), "clicked",
                      GTK_SIGNAL_FUNC (step1_b2_button_clicked),
                      step1_dbox);
  gtk_signal_connect (GTK_OBJECT (button6), "clicked",
                      GTK_SIGNAL_FUNC (step1_b3_button_clicked),
                      step1_dbox);

  gtk_widget_add_accelerator (button4, "clicked", accel_group,
                              label7_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button5, "clicked", accel_group,
                              label8_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_add_accelerator (button6, "clicked", accel_group,
                              label9_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);

  gtk_window_add_accel_group (GTK_WINDOW (step1_dbox), accel_group);

  return step1_dbox;
}