Re: Subclasses

Espen S Johnsen <[email protected]> 30 Jan 2006 12:02:06 +0100
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
Ephrem Boudonnet <[email protected]> writes:

> Thanx for your work.
> I'm using clg for a project running with SBCL 0.9. (You've ever heard
> of it, it's Open Music)
> My first question would be:
> Is it possible in my lisp code to define subclasses for "gtk classes",
> for example a subclass for window, and to make instances of this
> class.  

Currently this is not possible, but it is one of the features I would
like to add. Unfortunately, until Gtk gets full introspection this is
not very likely to happen. Full introspection is targeted at gtk 2.12,
which is probably a year away.

> For the moment, I make it work using the "change-class"
> function on my "gtk instance". (I know, it's quite not "beautiful") :

Just keep in mind that if you loose all references to the proxy instance
in lisp, it could revert back to the original class if a reference is
passed back from the C code.
 
> (defclass my-window (gtk::window) ())
> (make-instance 'my-window)
> 
>  >Type not registered: my-window
>  > [Condition of type simple-error]

When I get some time I'll see if I can come up with a solution to this
(but real sub-classing of gtk classes would still have to wait until
full introspection is available).

But when that's said, do you have some code samples which shows what you
are trying to do? Because I am really wondering if you need sub-classing
at all. Could you not use composition in the way testgtk.lisp does?

-- 
Espen


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642