Hi All,

I am back from a refactoring of my smalltalk objc binding.
Now I have proxy from both side that forward send back and forth.
But I guess something is missing, for example in smalltalk I create a windows:


  nsApplication := Objc.ObjcRuntime at: 'NSApplication'.
  nsApp := nsApplication sharedApplication.
  nsWindow :=  Objc.ObjcRuntime at: 'NSWindow'.
  nsWindow := nsWindow alloc.
  nsWindow initWithContentRect: nsRect styleMask: 15 backing:Objc.ObjcAppKit 
nsBackingStoreBuffered defer: (Character value:1).
  nsWindow setTitle: 'Test windows' asNSString.


  view := NSView new.
  nsWindow setContentView: view.


  nsWindow center.
  nsWindow orderFront: 0.
  nsWindow contentView.
  nsApp run.

Now my 'view' is a instance of a proxy to a objective-c NSView:
Using gnu-smalltalk syntax:

Object subclass: NSView [
    | objcRect |

    NSView class >> new [
    ^(self basicNew) initialize; yourself
    ]

    drawRect: rect [
    | nsColor |
    'drawRect called' printNl. 
    nsColor := Objc.ObjcRuntime at: 'NSColor'.
    nsColor := nsColor redColor.
    nsColor set.
    (objcRect gstBounds) printNl.
    Objc.ObjcAppKit nsRectFill: (objcRect gstBounds) objcPtr
     
    ]

    doesNotUnderstand: aMessage [
    ^objcRect send: aMessage selector with: aMessage arguments
    ]

    initialize [
    | cls |
    cls := Objc.ObjcRuntime at: 'NSView'.
    objcRect := cls alloc init.
    
    ]
]

NSView should be a subclass of ObjcObject but it does not change the issue:
drawRect: is never called.

So I want to know if there is a kind of check like [view respondTo: 
@"drawRect:"] or something similar?

Thanks

_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à