servo / cocoa-rs

DEPRECATED - Cocoa/Objective-C bindings for the Rust programming language
https://github.com/servo/core-foundation-rs/
Other
286 stars 72 forks source link

How do I implement delegates? #167

Closed zhenchaoli closed 7 years ago

zhenchaoli commented 7 years ago

Hi!

This is not really an issue (or maybe it is?), but how do I implement an NSApplicationDelegate for example, and assign it to NSApp so that I can start responding to events?

paulrouget commented 7 years ago

Here is an example: https://github.com/paulrouget/servoshell/blob/73727c68758851313d12554a46dac24255fe6be4/src/platform/macos/app.rs

Delegate is set here: https://github.com/paulrouget/servoshell/blob/73727c68758851313d12554a46dac24255fe6be4/src/platform/macos/app.rs#L116

Hope that helps.

zhenchaoli commented 7 years ago

Yeah, definitely! Thanks @paulrouget