Hello, I will soon have a little time to work on a tutorial on using custom gtk widgets in perl. I started it in html, but I am not sure that's the best format. I am more familiar with latex; would that be an acceptable format? Here is what I did up to now, that's just a start. Cheers, EtienneTitle: Using Gtk widgets from perl
Using Custom Gtk Widgets in Perl
Sometimes you see a gtk widget and think : "If only I could use it from inside Perl ..." This tutorial is about using gtk widgets --written in C-- from perl. Widgets that are included in the standard distribution of gtk+ are supported by the standard distribution of Gtk-Perl ((right?)). Here, we will see how third-party or custom widgets, maybe one you wrote yourself, can be accessed from perl.
To reach this goal and try to understand how it was reached ((I should understand what's going on too...)), we shall first see how the C interface to a gtk widget works : a widget has an associated header file which defines some data types and interface functions. Then we see how a perl module can be made that allows to use this widget.
Basic knowledge of gtk programming ((here ref)), perl modules (see man perlmod and man perlxs) is assumed. Also it is assumed that a recent version of gtk+ and its perl bindings, Gtk-Perl-0.7004 or better, are installed, as well as the widget under consideration ((HERE: Ref to creating custom widgets)).
Take, for example, Dov Grobgeld's widget gtkimageviewer
has a header file gtk_image_viewer.h
which defines the type
GtkImageViewer
((what about
GtkImageViewerClass
?)).
Create a directory that will contain the module. An appropriate name for
the widget gtkimageviewer
is GtkImageViewer. This directory will
contain the following files :
Makefile.PL
pkg.defs
GtkImageViewer.pm
xs/GtkImageViewer.xs
And the usual MANIFEST, README
... (see man perlmod)