Auto merge of #132 - pcwalton:runloop, r=metajack
Add bindings for `+[NSRunLoop currentRunLoop]` and `-[NSRunLoop performSelector:target:argument:order:modes:]` r? @metajack <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/132) <!-- Reviewable:end -->
This commit is contained in:
+31
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use base::{id, class, BOOL, nil};
|
||||
use base::{id, class, BOOL, SEL, nil};
|
||||
use core_graphics::base::CGFloat;
|
||||
use core_graphics::geometry::CGRect;
|
||||
use libc;
|
||||
@@ -356,3 +356,33 @@ extern {
|
||||
fn NSInsetRect(rect: NSRect, x: CGFloat, y: CGFloat) -> NSRect;
|
||||
}
|
||||
|
||||
pub trait NSRunLoop {
|
||||
unsafe fn currentRunLoop() -> Self;
|
||||
|
||||
unsafe fn performSelector_target_argument_order_modes_(self,
|
||||
aSelector: SEL,
|
||||
target: id,
|
||||
anArgument: id,
|
||||
order: NSUInteger,
|
||||
modes: id);
|
||||
}
|
||||
|
||||
impl NSRunLoop for id {
|
||||
unsafe fn currentRunLoop() -> id {
|
||||
msg_send![class("NSRunLoop"), currentRunLoop]
|
||||
}
|
||||
|
||||
unsafe fn performSelector_target_argument_order_modes_(self,
|
||||
aSelector: SEL,
|
||||
target: id,
|
||||
anArgument: id,
|
||||
order: NSUInteger,
|
||||
modes: id) {
|
||||
msg_send![self, performSelector:aSelector
|
||||
target:target
|
||||
argument:anArgument
|
||||
order:order
|
||||
modes:modes]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user