GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Jul 30, 2014 5:11 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Custom widget tutorials?
PostPosted: Sun Apr 22, 2007 12:01 pm 
Offline
Familiar Face

Joined: Sat Apr 21, 2007 11:09 am
Posts: 8
Location: Melbourne
Hello folks. Was wondering if there are any tutorials on the creation of custom widgets in GTK+?

I'm looking to build an app that has a text area in it with the line numbers displayed. Would I really need to create custom drawing routines or is there a simpler approach to something like this (ie a compound widget made up from other widgets...)?

Thanks in advance!
Jason.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:27 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
If you want line numbering, you should look into GtkSourceView. If you want to do it yourself, you should check out gtk_text_view_get_window() and gtk_text_view_set_border_window_size(), which will not require you to create a new widget.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:36 pm 
Offline
Familiar Face

Joined: Sat Apr 21, 2007 11:09 am
Posts: 8
Location: Melbourne
Thanks for that!!! I'll look into that right now. I had no idea there was a GtkSourceView widget... That is really something. Where does one find out about these GTK+ widgets? Is there some sort of GTK+ widget list/api that can be downloaded? If there is one, it would stop me asking senseless questions like this on the forum. All I have to go by at the moment is:

http://www.linuxheadquarters.com/howto/ ... ndex.shtml

It is a rather basic tutorial, and the links from that page do not provide a widget list... :-(

Cheers.
Jason.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:42 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
You can find the API documentation for GTK+, GLib, GObject, Pango, GDK, and GdkPixbuf at http://www.gtk.org/api/. The API documentation for a large number of other libraries are at http://developer.gnome.org/doc/API/. The GtkSourceView documentation can be found at http://gtksourceview.sourceforge.net/docs.html.

Also, don't worry about asking "stupid questions." The hardest part of GTK+ is getting started. I certainly don't mind answering them!

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:47 pm 
Offline
Familiar Face

Joined: Sat Apr 21, 2007 11:09 am
Posts: 8
Location: Melbourne
You have been tremendously helpful in getting me off to a decent start. The API references you posted are really detailed and there are some super tutorials- just what I needed to get me started.

I'm really impressed with what I have seen so far of GTK+. Thankyou for your patience with my questions. Forums are great because of people like yourself.

Cheers.
Jason.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 4:56 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
A couple of tips:

Download DevHelp (http://developer.imendio.com/projects/devhelp) for your API docs so that you can have them locally. GtkSourceView will be in there too assuming you've download all the development packages. The API pages come in handy and you'll find yourself using them often.

When using GtkSourceView, the sample application test-widget.c is very helpful in getting started. Furthermore, the majority of GTK+ text editing applications out there are using it. So you can also look at the source of any of these, such as Gedit.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 3:20 am 
Offline
Familiar Face

Joined: Sat Apr 21, 2007 11:09 am
Posts: 8
Location: Melbourne
hey thanks for that suggestion. Got them all down now and browsing them. This is really helpful.

Things are starting to work for me now! Buttons are now generating events and windows are closing etc... Its starting to get really fun now that things just work. You guys are great!

Jason.
(Self pronounced GTK+ convert)

:D


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group