GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Sep 02, 2014 2:00 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: GtkToolButton icon doesn't want to gray out
PostPosted: Tue Jan 29, 2013 7:14 am 
Offline
Familiar Face

Joined: Sat Jun 23, 2012 1:36 pm
Posts: 5
When I use a custom icon widget for my GtkToolButton (see gtk_tool_button_set_icon_widget()), and I set the GtkToolButton to the insensitive state, the icon does not want to gray out like it does when I use a stock icon (like GTK_STOCK_ADD) instead. How can I fix this behaviour?


Top
 Profile  
 
 Post subject: Re: GtkToolButton icon doesn't want to gray out
PostPosted: Tue Jan 29, 2013 11:43 am 
Offline
Familiar Face

Joined: Sat Jun 23, 2012 1:36 pm
Posts: 5
I found a good workaround for this problem. First step, make your GdkPixbuf a built-in icon with gtk_icon_theme_add_builtin_icon(). This is done instead of loading it into a GtkImage. Second step, set the icon of the GtkToolButton with gtk_tool_button_set_icon_name(), using the name you specified in the first step. This is done instead of using gtk_tool_button_set_icon_widget().

Incidentally, I created the GdkPixbuf using cairo drawing functions. First I create an image surface with surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height). Then I create a cairo context with cr = cairo_create(surface). Then I draw on this context with cairo's drawing functions. And finally I convert the image surface to a GdkPixbuf with gdk_pixbuf_get_from_surface(). It's a nice way to create icons programmatically.


Top
 Profile  
 
 Post subject: Re: GtkToolButton icon doesn't want to gray out
PostPosted: Tue May 14, 2013 12:05 pm 
Offline

Joined: Fri Mar 30, 2012 12:32 pm
Posts: 3
ijontichy wrote:
When I use a custom icon widget for my GtkToolButton (see gtk_tool_button_set_icon_widget()), and I set the GtkToolButton to the insensitive state, the icon does not want to gray out like it does when I use a stock icon (like GTK_STOCK_ADD) instead. How can I fix this behaviour?


Is this problem still not fixed in GTK+? I have run into this problem after moving from GTK+ 2.x to 3.x (3.4.2 to be specific) and came across this thread when I was looking for a possible fix/solution. Shouldn't this be considered a regression bug that needs to be fixed in GTK+ 3.x as the UI gives an inconsistent impression if the GtkToolButton is actually insensitive but the icon is not grayed out?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group