Added set-fullscreen? and fullscreen? hooks along with their cocoa implementations.

db4
Matthew Willis 2008-02-09 00:17:24 -08:00
parent 6f0e64bb4c
commit 122be5b48e
4 changed files with 27 additions and 1 deletions

View File

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

View File

@ -7,6 +7,10 @@ SYMBOL: ui-backend
HOOK: set-title ui-backend ( string world -- ) 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: (open-window) ui-backend ( world -- )
HOOK: (close-window) ui-backend ( handle -- ) HOOK: (close-window) ui-backend ( handle -- )

View File

@ -1,6 +1,6 @@
! Copyright (C) 2006, 2007 Slava Pestov. ! Copyright (C) 2006, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! 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 kernel memory namespaces cocoa.messages cocoa.runtime
cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows
cocoa.classes cocoa.application sequences system ui ui.backend 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 -- ) M: cocoa-ui-backend set-title ( string world -- )
world-handle second swap <NSString> -> setTitle: ; 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 -- ) : auto-position ( world -- )
dup world-loc { 0 0 } = [ dup world-loc { 0 0 } = [
world-handle second -> center 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." } { $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" } "." } ; { $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 HELP: raise-window
{ $values { "world" world } } { $values { "world" world } }
{ $description "Makes the native window containing the given world the front-most window." } { $description "Makes the native window containing the given world the front-most window." }