diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-04-18 22:29:50 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-04-19 00:18:33 +0300 |
commit | 1e7bf8de3b3bc4ac1d65d8b101d7ccedab24fcad (patch) | |
tree | 39f7de356bbb3c9c7bf68aba17855760d9f628e3 | |
parent | 7711a60a64cc02e2a733b73be21525370d3840b2 (diff) |
Add pan gesture handling
I get exactly the same kind of artefacts as in the Android app, which
I guess is good as it is at least consistent, as the implementation at
the LO layer is identical...
Change-Id: Icf0690fd2c48a133cb66de2ab7977b7088d2199e
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/AppDelegate.m | 2 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.h | 3 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.m | 12 | ||||
-rw-r--r-- | sal/inc/osl/detail/ios-bootstrap.h | 1 | ||||
-rw-r--r-- | vcl/ios/iosinst.cxx | 11 |
5 files changed, 27 insertions, 2 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m index 9a9314522533..dd5ac41faea1 100644 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m @@ -59,8 +59,10 @@ static View *theView; self.view->textView.delegate = self; UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)]; + UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.view action:@selector(panGesture:)]; [self.window addGestureRecognizer: tapRecognizer]; + [self.window addGestureRecognizer: panRecognizer]; NSLog(@"statusBarOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation]); diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h index b0e8394809b2..4abe2baa1e58 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.h +++ b/ios/experimental/LibreOffice/LibreOffice/View.h @@ -15,7 +15,8 @@ UITextView* textView; } - (void)drawRect:(CGRect)rect; -- (void)tapGesture:(UIGestureRecognizer *)gestureRecognizer; +- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer; +- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer; @end diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m index 56e4e0ea0451..ed1abc695258 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.m +++ b/ios/experimental/LibreOffice/LibreOffice/View.m @@ -46,7 +46,7 @@ // NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]); } -- (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer +- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer { if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { CGPoint location = [gestureRecognizer locationInView: self]; @@ -57,6 +57,16 @@ NSLog(@"tapGesture: %@", gestureRecognizer); } +- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer +{ + if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { + CGPoint translation = [gestureRecognizer translationInView: self]; + NSLog(@"panGesture: pan: (%d,%d)", (int)translation.x, (int)translation.y); + lo_pan(translation.x, translation.y); + } else + NSLog(@"panGesture: %@", gestureRecognizer); +} + @end // vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sal/inc/osl/detail/ios-bootstrap.h b/sal/inc/osl/detail/ios-bootstrap.h index 4738eeb72da6..fa3d0c85b460 100644 --- a/sal/inc/osl/detail/ios-bootstrap.h +++ b/sal/inc/osl/detail/ios-bootstrap.h @@ -49,6 +49,7 @@ void lo_runMain(); void lo_set_view_size(int width, int height); void lo_render_windows(CGContextRef context, CGRect rect); void lo_tap(int x, int y); +void lo_pan(int x, int y); void lo_keyboard_input(int c); #ifdef __cplusplus diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx index 39410fcb7fb8..7ba2656f7359 100644 --- a/vcl/ios/iosinst.cxx +++ b/vcl/ios/iosinst.cxx @@ -403,6 +403,17 @@ void lo_tap(int x, int y) } extern "C" +void lo_pan(int x, int y) +{ + SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame(); + if (pFocus) { + SAL_INFO( "vcl.ios", "scroll: " << "(" << x << "," << y << ")" ); + ScrollEvent aEvent( x, y ); + Application::PostScrollEvent(VCLEVENT_WINDOW_SCROLL, pFocus->GetWindow(), &aEvent); + } +} + +extern "C" void lo_keyboard_input(int c) { SalFrame *pFocus = IosSalInstance::getInstance()->getFocusFrame(); |