RE: [PHP-GTK-DEV] __gtype and constants
| From: | Steph | Date: | Sat, 14 Aug 2004 15:33:12 +0000 |
| Subject: | RE: [PHP-GTK-DEV] __gtype and constants | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-721@lists.php.net to get a copy of this message | ||
Another thought struck (as they do) - presumably the gtype thing won't break
PHP-GTK BC in itself (because the 'nice' ways of getting type etc won't be
changed), but changing the namespace for class constants will - won't it?
(Prevent me from burbling on if I'm wrong please someone)
> -----Original Message-----
> From: Alan Knowles [mailto:alan@akbkhome.com]
> Sent: 14 August 2004 15:14
> To: Andrei Zmievski
> Cc: PHP-GTK Dev
> Subject: Re: [PHP-GTK-DEV] __gtype and constants
>
>
> __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. *
> >
> >
> >
>
> --
> PHP-GTK Development Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>