Re: gtk_container_child_set_properties
- From: foret <foret rsbs anu edu au>
- To: Lars Clausen <lrclause cs uiuc edu>
- Cc: gtk-list gnome org
- Subject: Re: gtk_container_child_set_properties
- Date: Wed, 02 Apr 2003 09:15:45 +1000
Hi Lars,
One way to create the button with your picture and without border is to
write sompething like :
GtkWidget *create_button(const gchar *image_name)
{
GtkWidget *button;
GtkWidget *image;
GdkPixbuf *pixbuf;
gint xsize, ysize;
image = gtk_image_new_from_file(image_name);
pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));
xsize = gdk_pixbuf_get_width(pixbuf);
ysize = gdk_pixbuf_get_height(pixbuf);
button = gtk_button_new();
gtk_container_set_border_width(GTK_CONTAINER(button), 0);
gtk_widget_set_size_request(GTK_WIDGET(button), xsize, ysize);
gtk_container_add(GTK_CONTAINER(button), image);
/* Connect the button to the event you like ... */
gtk_widget_show(image);
gtk_widget_show(button);
return button;
}
Hope it helps,
SF
Lars Clausen wrote:
Hi!
I'm trying to make a (status) button with an image in it. Unfortunately,
it gets a border around it that's unpleasantly large and that I'd like to
remove. I've tried looking at the child properties of the button, but
gtk_container_class_list_child_properties gives me nothing. Are the child
properties for various containers documented anywhere? Is there a property
or something else that lets me do this (a la the padding parameter for hbox)?
Thanks,
-Lars
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]