[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]Cocoa#
From: |
Oscar Papel |
Subject: |
Re: [DotGNU]Cocoa# |
Date: |
Sun, 12 Oct 2003 10:50:53 -0400 |
> I had a look through Apple's Objective-C documentation, and I think this
is
> doable. The <objc/objc-api.h> interface contains a number of functions
that
> can be used to walk the class hierarchy at runtime, enumerate all of the
> methods, create objects, send messages, etc.
I thought about this. Mac-folk call it "introspection" The problem I came
to is one of message interception.
Let's take NSWindow. it has a close message. I would want to take this
message and generate a Closing and Closed Event for c# whenever it is
called. It also needs to be able to cancel the closing. I currently do
this by subclassing NSWindow and overriding it like this:
<code>
BOOL cancel=false;
if (pOnClosingFunc!=nil) cancel=((*pOnClosingFunc)((void *)self)==false);
if (!cancel) {
[super close];
if (pOnClosedFunc!=nil) (*pOnClosedFunc) ((void *)self);
}
</code>
So my Subclassed window needs two function pointers and an additional "set
function pointers" method.
Until I figure out a way to do this in general, I'll need to write a lot of
code.
I can still use introspection to generate the wrappers but only after I'm
done subclassing
Thanks for all your effort,
Oscar Papel
- [DotGNU]Cocoa#, Oscar Papel, 2003/10/12
- Re: [DotGNU]Cocoa#,
Oscar Papel <=