Auto merge of #123 - pcwalton:nsview-additions, r=larsbergstrom

Add autosizing-related methods and constants to `NSView`, and add `NSRectFill`.

r? @larsbergstrom

<!-- 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/123)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo
2016-05-09 11:29:20 -07:00
+20
View File
@@ -1275,6 +1275,7 @@ pub trait NSView {
unsafe fn addSubview_(self, view: id);
unsafe fn superview(self) -> id;
unsafe fn removeFromSuperview(self);
unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions);
unsafe fn wantsLayer(self) -> BOOL;
unsafe fn setWantsLayer(self, wantsLayer: BOOL);
@@ -1323,6 +1324,10 @@ impl NSView for id {
msg_send![self, removeFromSuperview]
}
unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions) {
msg_send![self, setAutoresizingMask:autoresizingMask]
}
unsafe fn wantsLayer(self) -> BOOL {
msg_send![self, wantsLayer]
}
@@ -1340,6 +1345,16 @@ impl NSView for id {
}
}
pub type NSAutoresizingMaskOptions = u64;
pub const NSViewNotSizable: u64 = 0;
pub const NSViewMinXMargin: u64 = 1;
pub const NSViewWidthSizable: u64 = 2;
pub const NSViewMaxXMargin: u64 = 4;
pub const NSViewMinYMargin: u64 = 8;
pub const NSViewHeightSizable: u64 = 16;
pub const NSViewMaxYMargin: u64 = 32;
pub trait NSOpenGLView {
unsafe fn alloc(_: Self) -> id {
msg_send![class("NSOpenGLView"), alloc]
@@ -2476,3 +2491,8 @@ impl NSStatusBar for id {
msg_send![self, isVertical]
}
}
extern {
pub fn NSRectFill(rect: NSRect);
}