Re: Tutorial on writing widgets?



Hi,

On Thu, 2014-07-17 at 16:54 -0400, Rena wrote:
Is there any tutorial on how to make a library that provides a GTK widget,
like GtkGlExt or GtkSourceView, but for GTK+ 3? I want to write such a
library, but I can't find a guide on how to do it, and existing libraries
are proving too complex for me to learn from with no other references.

For writing a library, the C language is more or less recommended, but
Vala can be used too. You should be familiar with GObject, GTK-Doc,
GObject introspection annotations, and the Autotools for the build
system. For the Autotools if you don't want to proceed by trials and
errors, a good and recent book is "Autotools" by John Calcote:
http://www.nostarch.com/autotools.htm

For library development, read David Zeuthen's articles:
http://davidz25.blogspot.be/2011/07/writing-c-library-intro-conclusion-and.html

And also Ulrich Drepper's articles "How to Write Shared Libraries" and
"Good Practices in Library Design, Implementation, and Maintenance":
http://akkadia.org/drepper/

For widget implementation, a good introduction is in the GGAD book, but
it is unfortunately mostly obsolete. But the main principles remain
valid. GtkObject has been replaced mainly by GObject, Cairo is now used
for drawing, Pango is used for text rendering, the size requisition is
more powerful with height-for-width and width-for-height, and many other
things have changed too.

http://www.e-booksdirectory.com/details.php?ebook=1811

See the GtkWidget documentation for an up-to-date reference. The GTK+
documentation contains also sections on the drawing model, migrating
from GTK+ 2 to GTK+ 3, and so on.

I recommend that you first write your GtkWidget in an application code,
since writing a library is more complicated (you must pay more attention
to not break the API/ABI).

--
Sébastien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]