Merge git://onigirihouse.com/git/yuuki

db4
Slava Pestov 2008-02-09 16:00:25 -06:00
commit 0e0a1fb244
4 changed files with 27 additions and 1 deletions

View File

@ -58,6 +58,7 @@ SYMBOL: super-sent-messages
"NSPasteboard"
"NSResponder"
"NSSavePanel"
"NSScreen"
"NSView"
"NSWindow"
"NSWorkspace"

View File

@ -7,6 +7,10 @@ SYMBOL: ui-backend
HOOK: set-title ui-backend ( string world -- )
HOOK: set-fullscreen? ui-backend ( ? world -- )
HOOK: fullscreen? ui-backend ( world -- ? )
HOOK: (open-window) ui-backend ( world -- )
HOOK: (close-window) ui-backend ( handle -- )

View File

@ -1,6 +1,6 @@
! Copyright (C) 2006, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays cocoa cocoa.application command-line
USING: math arrays cocoa cocoa.application command-line
kernel memory namespaces cocoa.messages cocoa.runtime
cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows
cocoa.classes cocoa.application sequences system ui ui.backend
@ -53,6 +53,18 @@ M: pasteboard set-clipboard-contents
M: cocoa-ui-backend set-title ( string world -- )
world-handle second swap <NSString> -> setTitle: ;
: enter-fullscreen ( world -- )
world-handle first NSScreen -> mainScreen f -> enterFullScreenMode:withOptions: drop ;
: exit-fullscreen ( world -- )
world-handle first f -> exitFullScreenModeWithOptions: ;
M: cocoa-ui-backend set-fullscreen? ( ? world -- )
swap [ enter-fullscreen ] [ exit-fullscreen ] if ;
M: cocoa-ui-backend fullscreen? ( world -- ? )
world-handle first -> isInFullScreenMode zero? not ;
: auto-position ( world -- )
dup world-loc { 0 0 } = [
world-handle second -> center

View File

@ -13,6 +13,15 @@ HELP: set-title
{ $description "Sets the title bar of the native window containing the world." }
{ $notes "This word should not be called directly by user code. Instead, change the " { $link world-title } " model; see " { $link "models" } "." } ;
HELP: set-fullscreen?
{ $values { "?" "a boolean" } { "world" world } }
{ $description "Sets and unsets fullscreen mode for the world." }
{ $notes "Find a world using " { $link find-world } "." } ;
HELP: fullscreen?
{ $values { "world" world } { "?" "a boolean" } }
{ $description "Queries the world to see if it is running in fullscreen mode." } ;
HELP: raise-window
{ $values { "world" world } }
{ $description "Makes the native window containing the given world the front-most window." }