@@ -20,7 +20,6 @@ pub use core_graphics::geometry::CGPoint;
2020
2121pub use self :: NSApplicationActivationPolicy :: * ;
2222pub use self :: NSApplicationActivationOptions :: * ;
23- pub use self :: NSWindowMask :: * ;
2423pub use self :: NSBackingStoreType :: * ;
2524pub use self :: NSOpenGLPixelFormatAttribute :: * ;
2625pub use self :: NSOpenGLPFAOpenGLProfiles :: * ;
@@ -141,22 +140,22 @@ pub enum NSApplicationTerminateReply {
141140 NSTerminateLater = 2 ,
142141}
143142
144- #[ repr( u64 ) ]
145- #[ derive( Clone , Copy , Debug , PartialEq ) ]
146- pub enum NSWindowMask {
147- NSBorderlessWindowMask = 0 ,
148- NSTitledWindowMask = 1 << 0 ,
149- NSClosableWindowMask = 1 << 1 ,
150- NSMiniaturizableWindowMask = 1 << 2 ,
151- NSResizableWindowMask = 1 << 3 ,
143+ bitflags ! {
144+ pub flags NSWindowStyleMask : NSUInteger {
145+ const NSBorderlessWindowMask = 0 ,
146+ const NSTitledWindowMask = 1 << 0 ,
147+ const NSClosableWindowMask = 1 << 1 ,
148+ const NSMiniaturizableWindowMask = 1 << 2 ,
149+ const NSResizableWindowMask = 1 << 3 ,
152150
153- NSTexturedBackgroundWindowMask = 1 << 8 ,
151+ const NSTexturedBackgroundWindowMask = 1 << 8 ,
154152
155- NSUnifiedTitleAndToolbarWindowMask = 1 << 12 ,
153+ const NSUnifiedTitleAndToolbarWindowMask = 1 << 12 ,
156154
157- NSFullScreenWindowMask = 1 << 14 ,
155+ const NSFullScreenWindowMask = 1 << 14 ,
158156
159- NSFullSizeContentViewWindowMask = 1 << 15
157+ const NSFullSizeContentViewWindowMask = 1 << 15
158+ }
160159}
161160
162161#[ repr( u64 ) ]
@@ -799,19 +798,19 @@ pub trait NSWindow {
799798 // Creating Windows
800799 unsafe fn initWithContentRect_styleMask_backing_defer_ ( self ,
801800 rect : NSRect ,
802- style : NSUInteger ,
801+ style : NSWindowStyleMask ,
803802 backing : NSBackingStoreType ,
804803 defer : BOOL ) -> id ;
805804 unsafe fn initWithContentRect_styleMask_backing_defer_screen_ ( self ,
806805 rect : NSRect ,
807- style : NSUInteger ,
806+ style : NSWindowStyleMask ,
808807 backing : NSBackingStoreType ,
809808 defer : BOOL ,
810809 screen : id ) -> id ;
811810
812811 // Configuring Windows
813- unsafe fn styleMask ( self ) -> NSUInteger ;
814- unsafe fn setStyleMask_ ( self , styleMask : NSUInteger ) ;
812+ unsafe fn styleMask ( self ) -> NSWindowStyleMask ;
813+ unsafe fn setStyleMask_ ( self , styleMask : NSWindowStyleMask ) ;
815814 unsafe fn toggleFullScreen_ ( self , sender : id ) ;
816815 unsafe fn worksWhenModal ( self ) -> BOOL ;
817816 unsafe fn alphaValue ( self ) -> CGFloat ;
@@ -846,9 +845,9 @@ pub trait NSWindow {
846845 // TODO: Accessing Window Information
847846
848847 // Getting Layout Information
849- unsafe fn contentRectForFrameRect_styleMask_ ( self , windowFrame : NSRect , windowStyle : NSUInteger ) -> NSRect ;
850- unsafe fn frameRectForContentRect_styleMask_ ( self , windowContentRect : NSRect , windowStyle : NSUInteger ) -> NSRect ;
851- unsafe fn minFrameWidthWithTitle_styleMask_ ( self , windowTitle : id , windowStyle : NSUInteger ) -> CGFloat ;
848+ unsafe fn contentRectForFrameRect_styleMask_ ( self , windowFrame : NSRect , windowStyle : NSWindowStyleMask ) -> NSRect ;
849+ unsafe fn frameRectForContentRect_styleMask_ ( self , windowContentRect : NSRect , windowStyle : NSWindowStyleMask ) -> NSRect ;
850+ unsafe fn minFrameWidthWithTitle_styleMask_ ( self , windowTitle : id , windowStyle : NSWindowStyleMask ) -> CGFloat ;
852851 unsafe fn contentRectForFrameRect_ ( self , windowFrame : NSRect ) -> NSRect ;
853852 unsafe fn frameRectForContentRect_ ( self , windowContent : NSRect ) -> NSRect ;
854853
@@ -1025,36 +1024,37 @@ impl NSWindow for id {
10251024
10261025 unsafe fn initWithContentRect_styleMask_backing_defer_ ( self ,
10271026 rect : NSRect ,
1028- style : NSUInteger ,
1027+ style : NSWindowStyleMask ,
10291028 backing : NSBackingStoreType ,
10301029 defer : BOOL ) -> id {
10311030 msg_send ! [ self , initWithContentRect: rect
1032- styleMask: style
1031+ styleMask: style. bits
10331032 backing: backing as NSUInteger
10341033 defer: defer]
10351034 }
10361035
10371036 unsafe fn initWithContentRect_styleMask_backing_defer_screen_ ( self ,
10381037 rect : NSRect ,
1039- style : NSUInteger ,
1038+ style : NSWindowStyleMask ,
10401039 backing : NSBackingStoreType ,
10411040 defer : BOOL ,
10421041 screen : id ) -> id {
10431042 msg_send ! [ self , initWithContentRect: rect
1044- styleMask: style
1043+ styleMask: style. bits
10451044 backing: backing as NSUInteger
10461045 defer: defer
10471046 screen: screen]
10481047 }
10491048
10501049 // Configuring Windows
10511050
1052- unsafe fn styleMask ( self ) -> NSUInteger {
1053- msg_send ! [ self , styleMask]
1051+ unsafe fn styleMask ( self ) -> NSWindowStyleMask {
1052+ let styleMask = NSWindowStyleMask :: from_bits_truncate ( msg_send ! [ self , styleMask] ) ;
1053+ styleMask
10541054 }
10551055
1056- unsafe fn setStyleMask_ ( self , styleMask : NSUInteger ) {
1057- msg_send ! [ self , setStyleMask: styleMask]
1056+ unsafe fn setStyleMask_ ( self , styleMask : NSWindowStyleMask ) {
1057+ msg_send ! [ self , setStyleMask: styleMask. bits ]
10581058 }
10591059
10601060 unsafe fn toggleFullScreen_ ( self , sender : id ) {
@@ -1176,16 +1176,16 @@ impl NSWindow for id {
11761176
11771177 // Getting Layout Information
11781178
1179- unsafe fn contentRectForFrameRect_styleMask_ ( self , windowFrame : NSRect , windowStyle : NSUInteger ) -> NSRect {
1180- msg_send ! [ self , contentRectForFrameRect: windowFrame styleMask: windowStyle]
1179+ unsafe fn contentRectForFrameRect_styleMask_ ( self , windowFrame : NSRect , windowStyle : NSWindowStyleMask ) -> NSRect {
1180+ msg_send ! [ self , contentRectForFrameRect: windowFrame styleMask: windowStyle. bits ]
11811181 }
11821182
1183- unsafe fn frameRectForContentRect_styleMask_ ( self , windowContentRect : NSRect , windowStyle : NSUInteger ) -> NSRect {
1184- msg_send ! [ self , frameRectForContentRect: windowContentRect styleMask: windowStyle]
1183+ unsafe fn frameRectForContentRect_styleMask_ ( self , windowContentRect : NSRect , windowStyle : NSWindowStyleMask ) -> NSRect {
1184+ msg_send ! [ self , frameRectForContentRect: windowContentRect styleMask: windowStyle. bits ]
11851185 }
11861186
1187- unsafe fn minFrameWidthWithTitle_styleMask_ ( self , windowTitle : id , windowStyle : NSUInteger ) -> CGFloat {
1188- msg_send ! [ self , minFrameWidthWithTitle: windowTitle styleMask: windowStyle]
1187+ unsafe fn minFrameWidthWithTitle_styleMask_ ( self , windowTitle : id , windowStyle : NSWindowStyleMask ) -> CGFloat {
1188+ msg_send ! [ self , minFrameWidthWithTitle: windowTitle styleMask: windowStyle. bits ]
11891189 }
11901190
11911191 unsafe fn contentRectForFrameRect_ ( self , windowFrame : NSRect ) -> NSRect {
0 commit comments