Skip to content
Browse files

Added support for passing magnify events to the delegate (pinch zoom)

  • Loading branch information...
1 parent ec0f67b commit 7ea1c410f45a976d3c2a15961cceafcbd50b7119 @indragiek committed
Showing with 23 additions and 1 deletion.
  1. +2 −1 OEGridView.h
  2. +21 −0 OEGridView.m
View
3 OEGridView.h
@@ -39,7 +39,8 @@
- (NSDragOperation)gridView:(OEGridView *)gridView validateDrop:(id<NSDraggingInfo>)sender;
- (NSDragOperation)gridView:(OEGridView *)gridView draggingUpdated:(id<NSDraggingInfo>)sender;
- (BOOL)gridView:(OEGridView *)gridView acceptDrop:(id<NSDraggingInfo>)sender;
-
+- (void)gridView:(OEGridView *)gridView magnifiedWithEvent:(NSEvent*)event;
+- (void)gridView:(OEGridView *)gridView magnifyEndedWithEvent:(NSEvent*)event;
@end
#pragma mark -
View
21 OEGridView.m
@@ -118,6 +118,8 @@ @implementation OEGridView {
unsigned int validateDrop : 1;
unsigned int draggingUpdated : 1;
unsigned int acceptDrop : 1;
+ unsigned int magnifiedWithEvent : 1;
+ unsigned int magnifyEndedWithEvent : 1;
} _delegateHas; // Cached methods that the delegate implements
struct
@@ -1298,6 +1300,23 @@ - (NSMenu*)menuForEvent:(NSEvent *)event
}
#pragma mark -
+#pragma mark Touch Gestures
+
+- (void)magnifyWithEvent:(NSEvent *)event
+{
+ if (_delegateHas.magnifiedWithEvent) {
+ [_delegate gridView:self magnifiedWithEvent:event];
+ }
+}
+
+- (void)endGestureWithEvent:(NSEvent *)event
+{
+ if (_delegateHas.magnifyEndedWithEvent) {
+ [_delegate gridView:self magnifyEndedWithEvent:event];
+ }
+}
+
+#pragma mark -
#pragma mark Keyboard Handling Operations
- (void)OE_moveKeyboardSelectionToIndex:(NSUInteger)index
@@ -1581,6 +1600,8 @@ - (void)setDelegate:(id<OEGridViewDelegate>)delegate
_delegateHas.validateDrop = [_delegate respondsToSelector:@selector(gridView:validateDrop:)];
_delegateHas.draggingUpdated = [_delegate respondsToSelector:@selector(gridView:draggingUpdated:)];
_delegateHas.acceptDrop = [_delegate respondsToSelector:@selector(gridView:acceptDrop:)];
+ _delegateHas.magnifiedWithEvent = [_delegate respondsToSelector:@selector(gridView:magnifiedWithEvent:)];
+ _delegateHas.magnifyEndedWithEvent = [_delegate respondsToSelector:@selector(gridView:magnifyEndedWithEvent:)];
}
}

0 comments on commit 7ea1c41

Please sign in to comment.
Something went wrong with that request. Please try again.