widget tutorial (warming up for)




  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,

  Etienne

Title: Using Gtk widgets from perl

Using Custom Gtk Widgets in Perl

Abstract

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.

Introduction

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

Basics of C interface to Gtk widgets

A gtk widget has a header file in which at least one datatype is defined. An object of this type is what a C program sees of a widget. The header file also defines functions used to manipulate this widget.

Take, for example, Dov Grobgeld's widget gtkimageviewer has a header file gtk_image_viewer.hwhich defines the type GtkImageViewer ((what about GtkImageViewerClass?)).

Making a Perl module

Create a directory that will contain the module. An appropriate name for the widget gtkimageviewer is GtkImageViewer. This directory will contain the following files :

And the usual MANIFEST, README ... (see man perlmod)





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