Re: Perl/Gtk - Limits of the bindings?
- From: etienne grossmann <etienne anonimo isr ist utl pt>
- To: dermot higrade botwrights farm
- CC: etienne isr ist utl pt, gtk-list redhat com
- Subject: Re: Perl/Gtk - Limits of the bindings?
- Date: Tue, 29 Jun 1999 19:11:04 +0100 (WEST)
Hello,
> BTW I am using Gtk+ 1.2.0 and Perl-Gtk-0.5121 (and, incidentally, Glade
> 0.5.0). and I cannot find ways to do the following.
It may have something to do having version 1.2.0 (current >=
1.2.3).
But not all, apparently :
> Gtk::ScrolledWindow->set_policy('never');
> error is "invalid Gtk::PolicyType never,
> expecting 'always', or 'automatic'".
Indeed, GTK_POLICY_NEVER seems to be defined in
/usr/local/include/gtk/gtkenums.h. But it seems not to be defined in
Gtk-Perl.
If I do
> 2) Gtk::ScrolledWindow->set_update_policy('always', 'always');
I get :
======================================================================
Undefined subroutine &Gtk::ScrolledWindow::set_update_policy called at ././imclick line 181
======================================================================
However,
$scrolled_window->set_policy(-automatic, -automatic);
Works fine. $scrolled_window was obtained by
======================================================================
$hadj = new Gtk::Adjustment ($imw, 0.0, $imw, 1, 256.0, 256.0);
$vadj = new Gtk::Adjustment ($imh, 0.0, $imh, 1, 256.0, 256.0);
$scrolled_window = new Gtk::ScrolledWindow($hadj,$vadj);
======================================================================
(Sorry I am not sure what the Adjustments do).
Now, if I do
======================================================================
$scrolled_window->set_policy(-never, -automatic);
======================================================================
it doesn't work. However (ugly hack), if I apply the patch below and
"make" and "make install", it will work. (don't apply that patch, as
it's a dumb hack).
======================================================================
--- build/GtkDefs.c.orig Tue Jun 29 18:32:47 1999
+++ build/GtkDefs.c Tue Jun 29 18:44:36 1999
@@ -2968,6 +2968,7 @@
enum_GtkPolicyType = newHV();
hv_store(enum_GtkPolicyType, "always", 6, newSViv(GTK_POLICY_ALWAYS), 0);
hv_store(enum_GtkPolicyType, "automatic", 9, newSViv(GTK_POLICY_AUTOMATIC), 0);
+ hv_store(enum_GtkPolicyType, "never", 5, newSViv(GTK_POLICY_AUTOMATIC), 0);
enum_GtkPositionType = newHV();
hv_store(enum_GtkPositionType, "left", 4, newSViv(GTK_POS_LEFT), 0);
======================================================================
It will work. WARNING : The patched file, build/GtkDefs.c, is
automatically generated. I was unable so find out where the "always"
and "automatic" came from, so I modified that file. If I re-run "perl
Makefile.PL", I have to re-modify build/GtkDefs.c.
It would be better to modify the place where the values "always" and
"automatic" were defined.
Btw : it seems that scrollbars appear with 'never' too!
**********************************************************************
**********************************************************************
> I have been advised to use gdk_pixmap_colormap_create_from_xpm
> instead which I reckon is not bound yet.
I think I had a similar problem, when I needed
gdk_imlib_crop_image(). So I applied the following patch (and proposed
it to Kenneth Albanowski).
======================================================================
--- GdkImlib/xs/GdkImlib.xs.orig Sat May 22 18:57:47 1999
+++ GdkImlib/xs/GdkImlib.xs Sat May 22 19:03:14 1999
@@ -405,6 +405,22 @@
int w
int h
+void
+gdk_imlib_crop_image(self, x, y, w, h)
+ Gtk::Gdk::ImlibImage self
+ int x
+ int y
+ int w
+ int h
+
+Gtk::Gdk::ImlibImage
+gdk_imlib_crop_and_clone_image(self, x, y, w, h)
+ Gtk::Gdk::ImlibImage self
+ int x
+ int y
+ int w
+ int h
+
int
gdk_imlib_get_fallback(Class)
SV * Class
======================================================================
You probably can do the same sort of thing (if you are willing) :
check that your function really exists :
======================================================================
etienne@anonimo: grep gdk_pixmap_colormap_create_from_xpm /usr/local/include/gdk/*
/usr/local/include/gdk/gdk.h:GdkPixmap* gdk_pixmap_colormap_create_from_xpm
/usr/local/include/gdk/gdk.h:GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
======================================================================
Apparently it does.
Modify (carefuly) GdkImlib/xs/GdkImlib.xs so that your function is
declared, like in the patch above. Careful with spaces, newlines etc :
I think xs is very sensitive to that.
**********************************************************************
**********************************************************************
> I am sorry to make such a long posting but I really would appreciate any
> help that people can offer, especially sources of documentation.
I'm sorry for the length too. A good source of info is in
/usr/local/include/gtk/*.h
/usr/local/include/gdk/*.h
/usr/include/gdk_*
and
Gtk-Perl/*
A little unintuitive, though. I have some code that uses (a little
bit) pixmaps, if you like.
Better, certainly, I think Havoc Pennington is writing a book.
Good luck
Etienne
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]