FreeRDP
TouchPointerView.h
1 /*
2  RDP Touch Pointer View
3 
4  Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
5 
6  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7  If a copy of the MPL was not distributed with this file, You can obtain one at
8  http://mozilla.org/MPL/2.0/.
9  */
10 
11 #import <UIKit/UIKit.h>
12 
13 // protocol for touch pointer callbacks
14 @protocol TouchPointerDelegate
15 // callback if touch pointer should be closed
16 - (void)touchPointerClose;
17 // callback for a left click action
18 - (void)touchPointerLeftClick:(CGPoint)pos down:(BOOL)down;
19 // callback for a right click action
20 - (void)touchPointerRightClick:(CGPoint)pos down:(BOOL)down;
21 // callback for pointer move action
22 - (void)touchPointerMove:(CGPoint)pos;
23 // callback if scrolling is performed
24 - (void)touchPointerScrollDown:(BOOL)down;
25 // callback for toggling the standard keyboard
26 - (void)touchPointerToggleKeyboard;
27 // callback for toggling the extended keyboard
28 - (void)touchPointerToggleExtendedKeyboard;
29 // callback for reset session view
30 - (void)touchPointerResetSessionView;
31 @end
32 
33 @interface TouchPointerView : UIView
34 {
35  // transformation and image currently drawn
36  CGAffineTransform _pointer_transformation;
37  UIImage *_cur_pointer_img;
38 
39  // action images
40  UIImage *_default_pointer_img;
41  UIImage *_active_pointer_img;
42  UIImage *_lclick_pointer_img;
43  UIImage *_rclick_pointer_img;
44  UIImage *_scroll_pointer_img;
45  UIImage *_extkeyboard_pointer_img;
46  UIImage *_keyboard_pointer_img;
47  UIImage *_reset_pointer_img;
48 
49  // predefined areas for all actions
50  CGRect _pointer_areas[9];
51 
52  // scroll/drag n drop handling
53  CGPoint _prev_touch_location;
54  BOOL _pointer_moving;
55  BOOL _pointer_scrolling;
56 
57  NSObject<TouchPointerDelegate> *_delegate;
58 }
59 
60 @property(assign) IBOutlet NSObject<TouchPointerDelegate> *delegate;
61 
62 // positions the pointer on screen if it got offscreen after an orentation change or after
63 // displaying the keyboard
64 - (void)ensurePointerIsVisible;
65 
66 // returns the extent required for the scrollview to use the touch pointer near the edges of the
67 // session view
68 - (UIEdgeInsets)getEdgeInsets;
69 
70 // return pointer dimension and position information
71 - (CGPoint)getPointerPosition;
72 - (int)getPointerWidth;
73 - (int)getPointerHeight;
74 
75 @end