[Glade-devel] Glade Binding Framework



On Fri, 2007-03-23 at 23:25 +0200, Vincent Geddes wrote:
[snip]
class GladeMyBoxAdaptor(glade.get_adaptor_for_type ('GtkHBox')):
       __gtype_name__ = 'GladeMyBoxAdaptor'


is the `glade.get_adaptor_for_type ('GtkHBox')' API the only way to get
an adaptor class in any language we provide bindings for? This works in
Python and Ruby as they seem to treat classes as normal objects. I doubt
C++ classes can be treated as objects (unless RTTI allows that) though,
and I don't think the C++ syntax allows one to subclass a class in such
a way either. The same probably goes for many other languages as well.

In a nutshell, I highly doubt this will work in C++:

 class MyBoxAdaptor : public Glade::get_adaptor_for_type ("GtkHBox")
 {
   ...
 }

Shouldn't we just provide the class definitions statically, so that
developers can subclass in the way it's usually done in most languages?

Yes, C++ cannot declare classes at runtime. And I wouldn't want it to.

-- 
Murray Cumming
murrayc at murrayc.com
www.murrayc.com
www.openismus.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]