Paste: Loupe - a gadget inspector
Author: | klazuka |
Mode: | factor |
Date: | Thu, 20 Aug 2009 20:06:53 |
Plain Text |
USING: accessors cursor kernel namespaces ui ui.gadgets
ui.gadgets.borders ui.gadgets.buttons ui.gadgets.worlds
ui.gestures ui.tools.inspector ;
IN: loupe
<PRIVATE
: unloupe ( -- )
arrow cursor-hand
f button-up-hook set-global ;
PRIVATE>
: loupe ( -- )
crosshairs cursor-hand
[ pick-up inspector unloupe ] button-up-hook set-global ;
: <loupe-gadget> ( -- gadget )
"Loupe" [ drop loupe ] <border-button> ;
: <loupe-world-attributes> ( -- world-attributes )
<world-attributes>
"Tools" >>title
{ small-title-bar close-button } >>window-controls ;
: main ( -- ) [ <loupe-gadget> { 10 10 } <border>
<loupe-world-attributes> open-window ] with-ui ;
MAIN: main
USING: cocoa cocoa.classes ;
IN: cursor
FRAMEWORK: /System/Library/Frameworks/AppKit.framework
IMPORT: NSCursor
: arrow ( -- cursor )
NSCursor -> arrowCursor ;
: crosshairs ( -- cursor )
NSCursor -> crosshairCursor ;
: cursor-hand ( cursor -- )
-> set ;
SYMBOL: button-up-hook
: send-button-up ( gesture loc world -- )
button-up-hook get
[ call( loc world -- ) ]
[ move-hand ] if*
dup #>> hand-buttons get-global delete
stop-drag-timer
button-gesture ;
New Annotation