Update Cocoa UI backend for recent changes

release
Slava Pestov 2007-11-24 15:41:27 -05:00
parent f0d29daedd
commit 2da8509134
4 changed files with 26 additions and 6 deletions

View File

@ -60,11 +60,19 @@ M: cocoa-ui-backend set-title ( string world -- )
drop
] if ;
M: cocoa-ui-backend (open-world-window) ( world -- )
M: cocoa-ui-backend (open-window) ( world -- )
dup gadget-window
dup auto-position
world-handle second f -> makeKeyAndOrderFront: ;
M: cocoa-ui-backend (close-window) ( handle -- )
first unregister-window ;
M: cocoa-ui-backend close-window ( gadget -- )
find-world [
world-handle second f -> performClose:
] when* ;
M: cocoa-ui-backend raise-window ( world -- )
world-handle [
second dup f -> orderFront: -> makeKeyWindow

View File

@ -3,7 +3,8 @@
USING: alien arrays assocs cocoa kernel math cocoa.messages
cocoa.subclassing cocoa.classes cocoa.views cocoa.application
cocoa.pasteboard cocoa.types cocoa.windows sequences ui
ui.gadgets ui.gadgets.worlds ui.gestures core-foundation ;
ui.gadgets ui.gadgets.worlds ui.gestures core-foundation
threads ;
IN: ui.cocoa.views
: send-mouse-moved ( view event -- )
@ -313,8 +314,6 @@ CLASS: {
{ "dealloc" "void" { "id" "SEL" }
[
drop
dup window stop-world
dup unregister-window
dup remove-observer
SUPER-> dealloc
]
@ -347,6 +346,12 @@ CLASS: {
forget-rollover
2nip -> object -> contentView window unfocus-world
]
}
{ "windowShouldClose:" "bool" { "id" "SEL" "id" }
[
2nip -> contentView window ungraft t
]
} ;
: install-window-delegate ( window -- )

View File

@ -77,7 +77,8 @@ TUPLE: deploy-gadget vocab settings ;
: com-deploy ( gadget -- )
dup com-save
find-deploy-vocab [ deploy ] curry call-listener ;
dup find-deploy-vocab [ deploy ] curry call-listener
close-window ;
: com-help ( -- )
"ui-deploy" help-window ;
@ -86,7 +87,11 @@ TUPLE: deploy-gadget vocab settings ;
{ +nullary+ t }
} define-command
: com-close ( gadget -- )
close-window ;
deploy-gadget "toolbar" f {
{ f com-close }
{ f com-help }
{ f com-revert }
{ f com-save }

View File

@ -72,7 +72,9 @@ M: world ungraft*
>r [ 1 track, ] { 0 1 } make-track r>
f <world> open-world-window ;
: close-window ( gadget -- )
HOOK: close-window ui-backend ( gadget -- )
M: object close-window
find-world [ ungraft ] when* ;
: find-window ( quot -- world )