GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom widget tutorials?

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
jasonkb
Familiar Face


Joined: 21 Apr 2007
Posts: 8
Location: Melbourne

PostPosted: Sun Apr 22, 2007 12:01 pm    Post subject: Custom widget tutorials? Reply with quote

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.
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Sun Apr 22, 2007 1:27 pm    Post subject: Reply with quote

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.
Back to top
jasonkb
Familiar Face


Joined: 21 Apr 2007
Posts: 8
Location: Melbourne

PostPosted: Sun Apr 22, 2007 1:36 pm    Post subject: Reply with quote

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/programming/gtk_examples/index.shtml

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

Cheers.
Jason.
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 376
Location: State College, Pennsylvania

PostPosted: Sun Apr 22, 2007 1:42 pm    Post subject: Reply with quote

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!
Back to top
jasonkb
Familiar Face


Joined: 21 Apr 2007
Posts: 8
Location: Melbourne

PostPosted: Sun Apr 22, 2007 2:47 pm    Post subject: Reply with quote

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.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 426
Location: Portland, OR USA

PostPosted: Sun Apr 22, 2007 4:56 pm    Post subject: Reply with quote

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.
Back to top
jasonkb
Familiar Face


Joined: 21 Apr 2007
Posts: 8
Location: Melbourne

PostPosted: Mon Apr 23, 2007 3:20 am    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP