FreeRDP
RDPKeyboard.h
1 /*
2  RDP Keyboard helper
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 <Foundation/Foundation.h>
12 #import "RDPSession.h"
13 
14 @class RDPKeyboard;
15 
16 @protocol RDPKeyboardDelegate <NSObject>
17 @optional
18 - (void)modifiersChangedForKeyboard:(RDPKeyboard *)keyboard;
19 @end
20 
21 @interface RDPKeyboard : NSObject
22 {
23 
24  RDPSession *_session;
25 
26  int _virtual_key_map[256];
27  int _unicode_map[256];
28  NSDictionary *_special_keys;
29 
30  NSObject<RDPKeyboardDelegate> *_delegate;
31 
32  BOOL _ctrl_pressed;
33  BOOL _alt_pressed;
34  BOOL _shift_pressed;
35  BOOL _win_pressed;
36 }
37 
38 @property(assign) id<RDPKeyboardDelegate> delegate;
39 @property(readonly) BOOL ctrlPressed;
40 @property(readonly) BOOL altPressed;
41 @property(readonly) BOOL shiftPressed;
42 @property(readonly) BOOL winPressed;
43 
44 // returns a keyboard instance
45 + (RDPKeyboard *)getSharedRDPKeyboard;
46 
47 // init the keyboard and assign the given rdp session and delegate
48 - (void)initWithSession:(RDPSession *)session delegate:(NSObject<RDPKeyboardDelegate> *)delegate;
49 
50 // called to reset any pending key states (i.e. pressed modifier keys)
51 - (void)reset;
52 
53 // sends the given unicode character to the server
54 - (void)sendUnicode:(int)character;
55 
56 // send a key stroke event using the given virtual key code
57 - (void)sendVirtualKeyCode:(int)keyCode;
58 
59 // toggle ctrl key, returns true if pressed, otherwise false
60 - (void)toggleCtrlKey;
61 
62 // toggle alt key, returns true if pressed, otherwise false
63 - (void)toggleAltKey;
64 
65 // toggle shift key, returns true if pressed, otherwise false
66 - (void)toggleShiftKey;
67 
68 // toggle windows key, returns true if pressed, otherwise false
69 - (void)toggleWinKey;
70 
71 // send key strokes
72 - (void)sendEnterKeyStroke;
73 - (void)sendEscapeKeyStroke;
74 - (void)sendBackspaceKeyStroke;
75 
76 @end