GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Oct 25, 2014 12:41 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Custom toolbar buttons
PostPosted: Sun Dec 11, 2011 12:37 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
Fair question.i have some images that i want to use as toolbar buttons.How?I only know gtk_toolbar_item_new_from_stock.

Cheers!


Top
 Profile  
 
 Post subject: Re: Custom toolbar buttons
PostPosted: Sun Dec 11, 2011 1:31 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Going by your previous post are you are still using GTK+ 2.24?

You will need to create your tool bar as normal see documentation at http://developer.gnome.org/gtk/stable/GtkToolbar.html

You will then need to create your individual buttons by creating a GtkToolButton, see documentation at http://developer.gnome.org/gtk/stable/GtkToolButton.html that way you can set the label and icon.
Code:
...
    GtkWidget *toolbar = gtk_toolbar_new();
    GtkWidget *tb1 = gtk_tool_button_new(GTK_WIDGET(icon), "Text");

    gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tb1, 0);
...

_________________
E.


Top
 Profile  
 
 Post subject: Re: Custom toolbar buttons
PostPosted: Sun Dec 11, 2011 6:09 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
thanks,yes im still on 2.24,do you suggest upgrading to 3?


Top
 Profile  
 
 Post subject: Re: Custom toolbar buttons
PostPosted: Sun Dec 11, 2011 6:38 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
It depends on your circumstances. If you need to stay portable to Microsoft Windows, then it would be best to stay with 2.24 for now as version 3.xx has not been ported yet.

If you can upgrade, you may need to upgrade your distribution of Linux if you are using that. Version 3 has a number of new features which are nice and many of the deprecated features in version 2.24 have now been removed. There have been some reported problems, largely to do with speed and the use of cairo has slowed down some of the redraws.

_________________
E.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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