Re: Tutorial on writing widgets?


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:

For library development, read David Zeuthen's articles:

And also Ulrich Drepper's articles "How to Write Shared Libraries" and
"Good Practices in Library Design, Implementation, and Maintenance":

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.

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).


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