FreeRDP
Loading...
Searching...
No Matches
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 BOOL _virtual_key_shift_map[256];
28
29 NSObject<RDPKeyboardDelegate> *_delegate;
30
31 BOOL _ctrl_pressed;
32 BOOL _alt_pressed;
33 BOOL _shift_pressed;
34 BOOL _win_pressed;
35 BOOL _altgr_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@property(readonly) BOOL altGrPressed;
44
45// returns a keyboard instance
46+ (RDPKeyboard *)getSharedRDPKeyboard;
47
48// init the keyboard and assign the given rdp session and delegate
49- (void)initWithSession:(RDPSession *)session delegate:(NSObject<RDPKeyboardDelegate> *)delegate;
50
51// called to reset any pending key states (i.e. pressed modifier keys)
52- (void)reset;
53
54// sends the given unicode character to the server
55- (void)sendUnicode:(NSInteger)character;
56
57// send a key stroke event using the given virtual key code, then release any modifier
58// keys that were toggled on (they apply to a single key stroke)
59- (void)sendVirtualKeyCode:(NSInteger)keyCode;
60
61// send a single key down or up event for the given virtual key code
62- (void)sendVirtualKey:(NSInteger)vKey up:(BOOL)up;
63
64// toggle ctrl key, returns true if pressed, otherwise false
65- (void)toggleCtrlKey;
66
67// toggle alt key, returns true if pressed, otherwise false
68- (void)toggleAltKey;
69
70// toggle shift key, returns true if pressed, otherwise false
71- (void)toggleShiftKey;
72
73// toggle windows key, returns true if pressed, otherwise false
74- (void)toggleWinKey;
75
76// toggle alt gr (right alt) key
77- (void)toggleAltGrKey;
78
79// send key strokes
80- (void)sendEnterKeyStroke;
81- (void)sendEscapeKeyStroke;
82- (void)sendBackspaceKeyStroke;
83- (void)sendDeleteKeyStroke;
84- (void)sendTabKeyStroke;
85
86@end