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 -- )
! 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
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
{ $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." }