diff options
author | ptyl@cloudon.com <ptyl@cloudon.com> | 2013-09-11 16:25:04 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-10-11 08:19:50 +0000 |
commit | da69a3ef5c395a3772a1c999aae5f172fc139d1e (patch) | |
tree | 11109b44c56e8243d2aa8bef30baebd93a41d061 /ios | |
parent | 0fa78319a8148cf1e0d200dac1cabbe7fdd47d3a (diff) |
iOS experimental app support for selection marking via long press gesture
Change-Id: Ib7a71797a2dc967f9d8ddd60fdc10c78201a87c8
Reviewed-on: https://gerrit.libreoffice.org/5911
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'ios')
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/AppDelegate.m | 2 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.h | 2 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.m | 17 |
3 files changed, 21 insertions, 0 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m index b0857ce5b6fd..7e3a0a900c57 100644 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m @@ -60,9 +60,11 @@ static View *theView; UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)]; UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.view action:@selector(panGesture:)]; + UILongPressGestureRecognizer * longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self.view action:@selector(longPressGesture:)]; [self.window addGestureRecognizer: tapRecognizer]; [self.window addGestureRecognizer: panRecognizer]; + [self.window addGestureRecognizer: longPressRecognizer]; NSLog(@"statusBarOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation]); diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h index 4abe2baa1e58..7fd47d1250c1 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.h +++ b/ios/experimental/LibreOffice/LibreOffice/View.h @@ -17,6 +17,8 @@ - (void)drawRect:(CGRect)rect; - (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer; - (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer; +- (void)longPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer; + @end diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m index 4e347a24f599..a047bb0874f6 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.m +++ b/ios/experimental/LibreOffice/LibreOffice/View.m @@ -95,6 +95,23 @@ } } +- (void)longPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer +{ + CGPoint point = [gestureRecognizer locationInView:self]; + + UIGestureRecognizerState state = gestureRecognizer.state; + + NSLog(@"longPressGesture: state %d cords (%d,%d)",state ,(int)point.x,(int)point.y); + + if (state == UIGestureRecognizerStateBegan) { + lo_mouse_drag(point.x, point.y, DOWN); + } else if (state == UIGestureRecognizerStateChanged) { + lo_mouse_drag(point.x, point.y, MOVE); + } else if (state == UIGestureRecognizerStateEnded) { + lo_mouse_drag(point.x, point.y, UP); + } +} + @end // vim:set shiftwidth=4 softtabstop=4 expandtab: |