Perl comments
- From: Kenneth Albanowski <kjahds kjahds com>
- To: gtk-list redhat com
- Subject: Perl comments
- Date: Sun, 19 Oct 1997 05:31:01 -0400 (EDT)
I've been having a fun, in some spare moments, updating my Gtk Perl module
to make use of the features in Gtk 970925, which I believe to be the
latest. (I'm not sure when I'll get the new code released, unfortunately.)
(First of all, let me apologize to Marius Vollmer: I believe he has a
patch out that might provide some of the features I am looking for, but I
just don't have the time to work with anything but the most mainstream
version.)
I'm greatly impressed with the new features I find in 970925, especially
the type system (where GTK_TYPE_WIDGET_FLAGS can inherit from
GTK_TYPE_ENUM), and the .defs file, which has allowed me to remove a large
segment of my hand-written code, and replace it with code that is
completely automatically generated.
I've still got a few unresolved glitches. The main one is that my signal
handler still has to handle each signal individually, since there's no
possible way to cope with GTK_TYPE_POINTER arguments. Can I suggest the
use of a new GTK_TYPE_INT_POINTER type that inherits from
GTK_TYPE_POINTER. This should be extremely simple, and would let my signal
marshaller automatically deal with pointers of known types. (The *RETLOC*
macros seem to be a partial step in this direction.)
Another issue is that pointer types (like GTK_TYPE_POINTER and
GTK_TYPE_STRING) do not make it clear who owns the memory, who should free
it, and when, which is especially important for the STRING type.
I've got a slight bone to pick about GdkWindow: I'm of the opinion that
it's inappropriate to treat GdkPixmap as "a type of" GdkWindow (with the
result that GdkWindow is mentioned in gtk.defs). Since the various drawing
functions work on both GdkPixmap's and GdkWindow's, but the window
functions only work on GdkWindow, it seems to make much more sense to
treat GdkPixmap as the "base", with GdkWindow and GdkBitmap as inheriting
from GdkPixmap. (Yes, I realize this doesn't actually affect any code,
it's just a semantic change.)
Note that, ideally, my code should be able to adapt to any additional Gtk
compatible widgets (at least to the extent of dealing with 'set' style
code) just by dropping in an appropriate .defs file. I hope this format
becomes a standard mechanism of describing the contents of widget code.
(At the very least, gtk.defs should be installed.)
In case anyone is interested (I hope these can go into the main
distribution), here are the .def entries I've had to add to make the file
usable with my module. There are undoubtedly more enumerations, and
perhaps more objects, that I've left out.
(define-enum GtkCurveType
(linear GTK_CURVE_TYPE_LINEAR)
(spline GTK_CURVE_TYPE_SPLINE)
(free GTK_CURVE_TYPE_FREE))
(define-enum GtkSelectionMode
(single GTK_SELECTION_SINGLE)
(browse GTK_SELECTION_BROWSE)
(multiple GTK_SELECTION_MULTIPLE)
(extended GTK_SELECTION_EXTENDED))
(define-enum GdkFunction
(copy GDK_COPY)
(invert GDK_INVERT)
(xor GDK_XOR))
(define-enum GdkFill
(solid GDK_SOLID)
(tiled GDK_TILED)
(stippled GDK_STIPPLED)
(opaque-stippled GDK_OPAQUE_STIPPLED))
(define-enum GdkLineStyle
(solid GDK_LINE_SOLID)
(on-off-dash GDK_LINE_ON_OFF_DASH)
(double-dash GDK_LINE_DOUBLE_DASH))
(define-enum GdkInputMode
(disabled GDK_MODE_DISABLED)
(screen GDK_MODE_SCREEN)
(window GDK_MODE_WINDOW))
(define-enum GdkInputSource
(mouse GDK_SOURCE_MOUSE)
(pen GDK_SOURCE_PEN)
(eraser GDK_SOURCE_ERASER)
(cursor GDK_SOURCE_CURSOR))
(define-enum GdkAxisUse
(ignore GDK_AXIS_IGNORE)
(x GDK_AXIS_X)
(y GDK_AXIS_Y)
(pressure GDK_AXIS_PRESSURE)
(xtilt GDK_AXIS_XTILT)
(ytilt GDK_AXIS_YTILT)
(last GDK_AXIS_LAST))
(define-object GtkAdjustment (GtkData))
(define-object GtkAspectFrame (GtkFrame))
(define-object GtkAlignment (GtkBin))
(define-object GtkArrow (GtkMisc))
(define-object GtkBin (GtkContainer))
(define-object GtkBox (GtkContainer))
(define-object GtkButton (GtkContainer))
(define-object GtkCheckButton (GtkToggleButton))
(define-object GtkColorSelection (GtkVBox))
(define-object GtkColorSelectionDialog (GtkWindow))
(define-object GtkContainer (GtkWidget))
(define-object GtkCurve (GtkDrawingArea))
(define-object GtkData (GtkObject))
(define-object GtkDialog (GtkWindow))
(define-object GtkDrawingArea (GtkWidget))
(define-object GtkEntry (GtkWidget))
(define-object GtkFileSelection (GtkWindow))
(define-object GtkFrame (GtkBin))
(define-object GtkGammaCurve (GtkVBox))
(define-object GtkHBox (GtkBox))
(define-object GtkHPaned (GtkPaned))
(define-object GtkHRuler (GtkRuler))
(define-object GtkHScale (GtkScale))
(define-object GtkHScrollbar (GtkScrollbar))
(define-object GtkHSeparator (GtkSeparator))
(define-object GtkImage (GtkMisc))
(define-object GtkInputDialog (GtkWindow))
(define-object GtkItem (GtkBin))
(define-object GtkLabel (GtkMisc))
(define-object GtkList (GtkContainer))
(define-object GtkListItem (GtkItem))
(define-object GtkMenu (GtkMenuShell))
(define-object GtkMenuBar (GtkMenuShell))
(define-object GtkMenuItem (GtkItem))
(define-object GtkMenuShell (GtkContainer))
(define-object GtkMisc (GtkWidget))
(define-object GtkNotebook (GtkContainer))
(define-object GtkObject ())
(define-object GtkOptionMenu (GtkButton))
(define-object GtkPaned (GtkContainer))
(define-object GtkPixmap (GtkMisc))
(define-object GtkPreview (GtkWidget))
(define-object GtkProgressBar (GtkWidget))
(define-object GtkRadioButton (GtkCheckButton))
(define-object GtkRadioMenuItem (GtkCheckMenuItem))
(define-object GtkRange (GtkWidget))
(define-object GtkRuler (GtkWidget))
(define-object GtkScale (GtkRange))
(define-object GtkScrollbar (GtkRange))
(define-object GtkScrolledWindow (GtkContainer))
(define-object GtkSeparator (GtkWidget))
(define-object GtkTable (GtkContainer))
(define-object GtkText (GtkWidget))
(define-object GtkToggleButton (GtkButton))
(define-object GtkTree (GtkContainer))
(define-object GtkTreeItem (GtkItem))
(define-object GtkVBox (GtkBox))
(define-object GtkViewport (GtkBin))
(define-object GtkVPaned (GtkPaned))
(define-object GtkVRuler (GtkRuler))
(define-object GtkVScale (GtkScale))
(define-object GtkVScrollbar (GtkScrollbar))
(define-object GtkVSeparator (GtkSeparator))
(define-object GtkWidget (GtkObject))
(define-object GtkWindow (GtkBin))
--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]