scribble
| From: | Andrei Zmievski | Date: | Thu, 19 Jul 2001 05:28:21 +0000 |
| Subject: | scribble | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-2280@lists.php.net to get a copy of this message | ||
I've just committed Scribble example ported from C, after being challenged by Steph who said it couldn't be done. Of course, I had to cheat and (re)implement a few things in PHP-GTK in order to do that. :)
The Scribble example shows how you can query the state and allocation of a widget:
$widget->state()
$widget->allocation
I'm not entirely happy with the way this is done. I think $widget->state (as a property) would be more intuitive, but I made it this way to be consistent with $widget->flags(). Maybe one or the other should be changed.
The allocation is a GtkAllocation class (derived directly from PHP's standard class stdClass), it's very dumb and provides just 4 properties. Yes, it's a wrapper. I've also made $event->area to be a GtkAllocation as well. The problem is that a couple of functions are supposed to take GtkAllocation as an argument and how do we do that? Construct GtkAllocation manually and pass it to the function? Pass an array of 4 integers (the way Python does it)? And then there's also the issue of returning areas/allocations/requisitions from functions. Python just returns arrays of numbers. Should we follow that convention or have them return classes with properties?
-Andrei