]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorSlava Pestov <slava@goo.local>
Wed, 23 Apr 2008 06:31:38 +0000 (01:31 -0500)
committerSlava Pestov <slava@goo.local>
Wed, 23 Apr 2008 06:31:38 +0000 (01:31 -0500)
1  2 
extra/ui/cocoa/views/views.factor

index 442eda90efc1f4c58d80f8a2d4df7c347adac8c0,ab0c3015251ad5cc1ff602da257031e79efdbdb1..83890788e3675b4dfea8a6a3636252debf799640
@@@ -1,10 -1,10 +1,10 @@@
- ! Copyright (C) 2006, 2007 Slava Pestov
+ ! Copyright (C) 2006, 2008 Slava Pestov
  ! See http://factorcode.org/license.txt for BSD license.
  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
- threads ;
+ threads combinators ;
  IN: ui.cocoa.views
  
  : send-mouse-moved ( view event -- )
@@@ -126,13 -126,6 +126,13 @@@ CLASS: 
      { +name+ "FactorView" }
      { +protocols+ { "NSTextInput" } }
  }
 +
 +! Rendering
 +! Rendering
 +{ "drawRect:" "void" { "id" "SEL" "id" "NSRect" }
 +    [ 3drop window relayout-1 ]
 +}
 +
  ! Events
  { "acceptsFirstMouse:" "bool" { "id" "SEL" "id" }
      [ 3drop 1 ]
      [ [ nip T{ select-all-action } send-action$ ] ui-try ]
  }
  
+ ! Multi-touch gestures: this is undocumented.
+ ! http://cocoadex.com/2008/02/nsevent-modifications-swipe-ro.html
+ { "magnifyWithEvent:" "void" { "id" "SEL" "id" }
+     [
+         nip
+         dup -> deltaZ sgn {
+             {  1 [ T{ zoom-in-action } send-action$ ] }
+             { -1 [ T{ zoom-out-action } send-action$ ] }
+             {  0 [ 2drop ] }
+         } case
+     ]
+ }
+ { "swipeWithEvent:" "void" { "id" "SEL" "id" }
+     [
+         nip
+         dup -> deltaX sgn {
+             {  1 [ T{ left-action } send-action$ ] }
+             { -1 [ T{ right-action } send-action$ ] }
+             {  0
+                 [
+                     dup -> deltaY sgn {
+                         {  1 [ T{ up-action } send-action$ ] }
+                         { -1 [ T{ down-action } send-action$ ] }
+                         {  0 [ 2drop ] }
+                     } case
+                 ]
+             }
+         } case
+     ]
+ }
+ ! "rotateWithEvent:" "void" { "id" "SEL" "id" }}
  { "acceptsFirstResponder" "bool" { "id" "SEL" }
      [ 2drop 1 ]
  }