1 ! Copyright (C) 2006, 2007 Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays kernel math cocoa cocoa.messages cocoa.classes
4 sequences math.bitwise ;
7 : NSBorderlessWindowMask 0 ; inline
8 : NSTitledWindowMask 1 ; inline
9 : NSClosableWindowMask 2 ; inline
10 : NSMiniaturizableWindowMask 4 ; inline
11 : NSResizableWindowMask 8 ; inline
13 : NSBackingStoreRetained 0 ; inline
14 : NSBackingStoreNonretained 1 ; inline
15 : NSBackingStoreBuffered 2 ; inline
17 : standard-window-type ( -- n )
21 NSMiniaturizableWindowMask
25 : <NSWindow> ( rect -- window )
26 NSWindow -> alloc swap
27 standard-window-type NSBackingStoreBuffered 1
28 -> initWithContentRect:styleMask:backing:defer: ;
30 : <ViewWindow> ( view rect -- window )
31 <NSWindow> [ swap -> setContentView: ] keep
32 dup dup -> contentView -> setInitialFirstResponder:
33 dup 1 -> setAcceptsMouseMovedEvents:
34 dup 0 -> setReleasedWhenClosed: ;
36 : window-content-rect ( window -- rect )
38 [ -> frame ] [ -> styleMask ] bi
39 -> contentRectForFrameRect:styleMask: ;