Re: __gtype and constants
| From: | Alan Knowles | Date: | Sat, 14 Aug 2004 14:14:23 +0000 |
| Subject: | Re: __gtype and constants | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-720@lists.php.net to get a copy of this message | ||
__type seems a bit odd - is it a little clearer to follow the existing API
GType::from_object($object)->type
GType::from_class('GtkButton')->type
-- definatly move them to the class :) - I dont think that would be the bottleneck for performance (eg. compared to the rendering on the screen of the widget)
Regards
Alan
Andrei Zmievski wrote:
Two things. 1. I hacked in a static class variable called '__gtype' which contains the GType object corresponding to the class it's in. For example, GtkButton::$__gtype will give you the GType object for it. To get the actual value of the type, GtkButton::$__gtype->type. Nifty or not? 2. I am trying to figure out how to go about doing constants. I can either leave them in the global namespace, e.g. GTK_WINDOW_TOPLEVEL, or I can move into each class' namespace, e.g. GtkWindow::TOPLEVEL. The access to the second version is a tad slower than the first, but I think it achieves a nice encapsulation. Thoughts? -Andrei * DOS is, quite possibly, the worst text-adventure game ever. *