FreeRDP
Utils.h
1 /*
2  Utility functions
3 
4  Copyright 2013 Thincast Technologies GmbH, Authors: Martin Fleisz, Dorian Johnson
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 <CoreGraphics/CoreGraphics.h>
13 #import "TSXTypes.h"
14 
15 // helper macro to encode a table path into a tag value (used to identify controls in their delegate
16 // handlers)
17 #define GET_TAG(section, row) ((((int)section) << 16) | ((int)(row)))
18 #define GET_TAG_FROM_PATH(path) ((((int)path.section) << 16) | ((int)(path.row)))
19 
20 BOOL ScanHostNameAndPort(NSString *address, NSString **host, unsigned short *port);
21 
22 #pragma mark -
23 #pragma mark Screen Resolutions
24 
25 NSString *ScreenResolutionDescription(TSXScreenOptions type, int width, int height);
26 BOOL ScanScreenResolution(NSString *description, int *width, int *height, TSXScreenOptions *type);
27 
28 NSDictionary *SelectionForColorSetting(void);
29 NSArray *ResolutionModes(void);
30 
31 #pragma mark Security Protocol
32 
33 NSString *ProtocolSecurityDescription(TSXProtocolSecurityOptions type);
34 BOOL ScanProtocolSecurity(NSString *description, TSXProtocolSecurityOptions *type);
35 NSDictionary *SelectionForSecuritySetting(void);
36 
37 #pragma mark Bookmarks
38 @class BookmarkBase;
39 NSMutableArray *FilterBookmarks(NSArray *bookmarks, NSArray *filter_words);
40 NSMutableArray *FilterHistory(NSArray *history, NSString *filterStr);
41 
42 #pragma mark iPad/iPhone detection
43 
44 BOOL IsPad(void);
45 BOOL IsPhone(void);
46 
47 #pragma mark Version Info
48 NSString *TSXAppFullVersion(void);
49 
50 #pragma mark Touch/Mouse handling
51 
52 // set mouse buttons swapped flag
53 void SetSwapMouseButtonsFlag(BOOL swapped);
54 
55 // set invert scrolling flag
56 void SetInvertScrollingFlag(BOOL invert);
57 
58 // return event value for left mouse button
59 int GetLeftMouseButtonClickEvent(BOOL down);
60 
61 // return event value for right mouse button
62 int GetRightMouseButtonClickEvent(BOOL down);
63 
64 // return event value for mouse move event
65 int GetMouseMoveEvent(void);
66 
67 // return mouse wheel event
68 int GetMouseWheelEvent(BOOL down);
69 
70 // scrolling gesture detection delta
71 CGFloat GetScrollGestureDelta(void);
72 
73 #pragma mark Connectivity tools
74 // activates the iphone's WWAN interface in case it is offline
75 void WakeUpWWAN(void);
76 
77 #pragma mark System Info functions
78 NSString *TSXGetPlatform(void);
79 BOOL TSXDeviceHasJailBreak(void);
80 NSString *TSXGetPrimaryMACAddress(NSString *sep);