Permalink
Browse files

1st commit.

  • Loading branch information...
atsusy committed Sep 24, 2011
0 parents commit d9569d459415bff3ce0815c9f8c9e6ecd804047d
Showing with 9,490 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +2 −0 Classes/.gitignore
  3. +13 −0 Classes/JpMsmcGesturerecognizerModule.h
  4. +106 −0 Classes/JpMsmcGesturerecognizerModule.m
  5. +9 −0 Classes/JpMsmcGesturerecognizerModuleAssets.h
  6. +15 −0 Classes/JpMsmcGesturerecognizerModuleAssets.m
  7. +13 −0 Classes/TiUIView+GestureRecognizer.h
  8. +104 −0 Classes/TiUIView+GestureRecognizer.m
  9. +4 −0 JpMsmcGesturerecognizer_Prefix.pch
  10. +22 −0 LICENSE
  11. +151 −0 README
  12. +6 −0 assets/README
  13. +195 −0 build.py
  14. +48 −0 documentation/index.md
  15. +27 −0 documentation/index.md~
  16. +48 −0 example/app.js
  17. +48 −0 example/app.js~
  18. BIN example/lena_std.jpg
  19. +336 −0 gesturerecognizer.xcodeproj/project.pbxproj
  20. +7 −0 gesturerecognizer.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  21. +7,996 −0 ...gnizer.xcodeproj/project.xcworkspace/xcuserdata/atsusy.xcuserdatad/UserInterfaceState.xcuserstate
  22. +5 −0 gesturerecognizer.xcodeproj/xcuserdata/atsusy.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  23. +54 −0 gesturerecognizer.xcodeproj/xcuserdata/atsusy.xcuserdatad/xcschemes/Build & Test.xcscheme
  24. +54 −0 gesturerecognizer.xcodeproj/xcuserdata/atsusy.xcuserdatad/xcschemes/gesturerecognizer.xcscheme
  25. +32 −0 gesturerecognizer.xcodeproj/xcuserdata/atsusy.xcuserdatad/xcschemes/xcschememanagement.plist
  26. +1 −0 hooks/README
  27. +35 −0 hooks/add.py
  28. +19 −0 hooks/install.py
  29. +34 −0 hooks/remove.py
  30. +18 −0 hooks/uninstall.py
  31. +17 −0 manifest
  32. +28 −0 module.xcconfig
  33. +3 −0 platform/README
  34. +11 −0 timodule.xml
  35. +19 −0 titanium.xcconfig
@@ -0,0 +1,10 @@
+*.pbxuser
+*.perspective
+*.perspectivev3
+*.mode1v3
+project.xcworkspace
+xcuserdata
+tmp
+bin
+build
+*.zip
@@ -0,0 +1,2 @@
+JpMsmcGesturerecognizer.h
+JpMsmcGesturerecognizer.m
@@ -0,0 +1,13 @@
+/**
+ * Your Copyright Here
+ *
+ * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
+ * and licensed under the Apache Public License (version 2)
+ */
+#import "TiModule.h"
+
+@interface JpMsmcGesturerecognizerModule : TiModule
+{
+}
+
+@end
@@ -0,0 +1,106 @@
+/**
+ * Your Copyright Here
+ *
+ * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
+ * and licensed under the Apache Public License (version 2)
+ */
+#import "JpMsmcGesturerecognizerModule.h"
+#import "TiBase.h"
+#import "TiHost.h"
+#import "TiUtils.h"
+
+@implementation JpMsmcGesturerecognizerModule
+
+#pragma mark Internal
+
+// this is generated for your module, please do not change it
+-(id)moduleGUID
+{
+ return @"feebd8e2-d709-4a4d-afb4-2c996535b0bb";
+}
+
+// this is generated for your module, please do not change it
+-(NSString*)moduleId
+{
+ return @"jp.msmc.gesturerecognizer";
+}
+
+#pragma mark Lifecycle
+
+-(void)startup
+{
+ // this method is called when the module is first loaded
+ // you *must* call the superclass
+ [super startup];
+
+ NSLog(@"[INFO] %@ loaded",self);
+}
+
+-(void)shutdown:(id)sender
+{
+ // this method is called when the module is being unloaded
+ // typically this is during shutdown. make sure you don't do too
+ // much processing here or the app will be quit forceably
+
+ // you *must* call the superclass
+ [super shutdown:sender];
+}
+
+#pragma mark Cleanup
+
+-(void)dealloc
+{
+ // release any resources that have been retained by the module
+ [super dealloc];
+}
+
+#pragma mark Internal Memory Management
+
+-(void)didReceiveMemoryWarning:(NSNotification*)notification
+{
+ // optionally release any resources that can be dynamically
+ // reloaded once memory is available - such as caches
+ [super didReceiveMemoryWarning:notification];
+}
+
+#pragma mark Listener Notifications
+
+-(void)_listenerAdded:(NSString *)type count:(int)count
+{
+ if (count == 1 && [type isEqualToString:@"my_event"])
+ {
+ // the first (of potentially many) listener is being added
+ // for event named 'my_event'
+ }
+}
+
+-(void)_listenerRemoved:(NSString *)type count:(int)count
+{
+ if (count == 0 && [type isEqualToString:@"my_event"])
+ {
+ // the last listener called for event named 'my_event' has
+ // been removed, we can optionally clean up any resources
+ // since no body is listening at this point for that event
+ }
+}
+
+#pragma Public APIs
+
+-(id)example:(id)args
+{
+ // example method
+ return @"hello world";
+}
+
+-(id)exampleProp
+{
+ // example property getter
+ return @"hello world";
+}
+
+-(void)exampleProp:(id)value
+{
+ // example property setter
+}
+
+@end
@@ -0,0 +1,9 @@
+/**
+ * This is a generated file. Do not edit or your changes will be lost
+ */
+
+@interface JpMsmcGesturerecognizerModuleAssets : NSObject
+{
+}
+- (NSData*) moduleAsset;
+@end
@@ -0,0 +1,15 @@
+/**
+ * This is a generated file. Do not edit or your changes will be lost
+ */
+#import "JpMsmcGesturerecognizerModuleAssets.h"
+
+extern NSData * dataWithHexString (NSString * hexString);
+
+@implementation JpMsmcGesturerecognizerModuleAssets
+
+- (NSData*) moduleAsset
+{
+ return nil;
+}
+
+@end
@@ -0,0 +1,13 @@
+//
+// TiUIView+GestureRecognizer.h
+// gesturerecognizer
+//
+// Created by KATAOKA,Atsushi on 11/09/24.
+// Copyright 2011年 __MyCompanyName__. All rights reserved.
+//
+#import "TiUIView.h"
+
+@interface TiUIView (TiUIView_GestureRecognizer)
+- (void)setRotateGesture_:(id)value;
+- (void)setPinchGesture_:(id)value;
+@end
@@ -0,0 +1,104 @@
+//
+// TiUIView+GestureRecognizer.m
+// gesturerecognizer
+//
+// Created by KATAOKA,Atsushi on 11/09/24.
+// Copyright 2011年 __MyCompanyName__. All rights reserved.
+//
+#import "TiUtils.h"
+#import "TiUIView+GestureRecognizer.h"
+
+@implementation TiUIView (TiUIView_GestureRecognizer)
+
+- (void)handleRotationGesture:(UIRotationGestureRecognizer *)sender
+{
+ NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithFloat:[sender rotation]], @"rotation",
+ [NSNumber numberWithFloat:[sender velocity]], @"velocity", nil];
+ if([self.proxy _hasListeners:@"rotate"]){
+ [self.proxy fireEvent:@"rotate" withObject:args];
+ }
+
+ if(sender.state == UIGestureRecognizerStateEnded &&
+ [self.proxy _hasListeners:@"rotateend"]){
+ [self.proxy fireEvent:@"rotateend"];
+ }
+}
+
+- (void)setRotateGesture_:(id)value
+{
+ ENSURE_SINGLE_ARG(value, NSNumber);
+ BOOL value_ = [value boolValue];
+
+ if(value_){
+ for(UIGestureRecognizer *gesure in self.gestureRecognizers){
+ if([gesure isKindOfClass:[UIRotationGestureRecognizer class]]){
+ return;
+ }
+ }
+
+ UIRotationGestureRecognizer *rotationGesture =[[UIRotationGestureRecognizer alloc] initWithTarget:self
+ action:@selector(handleRotationGesture:)];
+ [self addGestureRecognizer:rotationGesture];
+
+ [rotationGesture release];
+ } else{
+ UIGestureRecognizer *rotationGesture = nil;
+ for(UIGestureRecognizer *gesure in self.gestureRecognizers){
+ if([gesure isKindOfClass:[UIRotationGestureRecognizer class]]){
+ rotationGesture = gesure;
+ break;
+ }
+ }
+ if(rotationGesture){
+ [self removeGestureRecognizer:rotationGesture];
+ }
+ }
+}
+
+- (void)handlePinchGesture:(UIPinchGestureRecognizer *)sender
+{
+ NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithFloat:[sender scale]], @"scale",
+ [NSNumber numberWithFloat:[sender velocity]], @"velocity", nil];
+ if([self.proxy _hasListeners:@"pinch"]){
+ [self.proxy fireEvent:@"pinch" withObject:args];
+ }
+
+ if(sender.state == UIGestureRecognizerStateEnded &&
+ [self.proxy _hasListeners:@"pinchend"]){
+ [self.proxy fireEvent:@"pinchend"];
+ }
+}
+
+- (void)setPinchGesture_:(id)value
+{
+ ENSURE_SINGLE_ARG(value, NSNumber);
+ BOOL value_ = [value boolValue];
+
+ if(value_){
+ for(UIGestureRecognizer *gesure in self.gestureRecognizers){
+ if([gesure isKindOfClass:[UIPinchGestureRecognizer class]]){
+ return;
+ }
+ }
+
+ UIPinchGestureRecognizer *pinchGesture =[[UIPinchGestureRecognizer alloc] initWithTarget:self
+ action:@selector(handlePinchGesture:)];
+ [self addGestureRecognizer:pinchGesture];
+
+ [pinchGesture release];
+ } else{
+ UIGestureRecognizer *pinchGesture = nil;
+ for(UIGestureRecognizer *gesure in self.gestureRecognizers){
+ if([gesure isKindOfClass:[UIPinchGestureRecognizer class]]){
+ pinchGesture = gesure;
+ break;
+ }
+ }
+ if(pinchGesture){
+ [self removeGestureRecognizer:pinchGesture];
+ }
+ }
+}
+@end
@@ -0,0 +1,4 @@
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+#endif
22 LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2011 MARSHMALLOW MACHINE.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
Oops, something went wrong.

0 comments on commit d9569d4

Please sign in to comment.