__gtype and constants
| From: | Andrei Zmievski | Date: | Sat, 14 Aug 2004 07:31:53 +0000 |
| Subject: | __gtype and constants | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-718@lists.php.net to get a copy of this message | ||
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. *