From 7fc738168813726ffbbc74f057fccb875d2231ee Mon Sep 17 00:00:00 2001 From: Lily Haverlag Date: Wed, 13 Dec 2023 16:11:09 +0100 Subject: [PATCH] add `add_presented_handler` to `Drawable` --- src/drawable.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/drawable.rs b/src/drawable.rs index 5c03584..032f96f 100644 --- a/src/drawable.rs +++ b/src/drawable.rs @@ -5,8 +5,12 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. +use block::Block; + use super::NSUInteger; +type DrawablePresentedHandler<'a> = Block<(&'a DrawableRef,), ()>; + /// See pub enum MTLDrawable {} @@ -23,4 +27,8 @@ impl DrawableRef { pub fn drawable_id(&self) -> NSUInteger { unsafe { msg_send![self, drawableID] } } + + pub fn add_presented_handler(&self, block: &DrawablePresentedHandler) { + unsafe { msg_send![self, addPresentedHandler: block] } + } }