|
|
| Author |
Message |
|
|
jasonkb Familiar Face
Joined: 21 Apr 2007 Posts: 8 Location: Melbourne
|
Posted: Sun Apr 22, 2007 12:01 pm Post subject: Custom widget tutorials? |
|
|
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: 372 Location: State College, Pennsylvania
|
Posted: Sun Apr 22, 2007 1:27 pm Post subject: |
|
|
| 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
|
Posted: Sun Apr 22, 2007 1:36 pm Post subject: |
|
|
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: 372 Location: State College, Pennsylvania
|
|
| Back to top |
|
 |
jasonkb Familiar Face
Joined: 21 Apr 2007 Posts: 8 Location: Melbourne
|
Posted: Sun Apr 22, 2007 2:47 pm Post subject: |
|
|
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: 407 Location: Portland, OR USA
|
Posted: Sun Apr 22, 2007 4:56 pm Post subject: |
|
|
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
|
Posted: Mon Apr 23, 2007 3:20 am Post subject: |
|
|
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 |
|
 |
|