78 :(id)target
79{
80 self = [super initWithFrame:CGRectMake(0, 0, 320, kViewHeight)];
81 if (self)
82 {
83 [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
84
85 _bar = [[UIView alloc] initWithFrame:CGRectZero];
86 [self addSubview:_bar];
87
88 _background = [RDPCreateGlassCapsuleView() retain];
89 [_bar addSubview:_background];
90
91
92 _keys_container = [[UIView alloc] initWithFrame:CGRectZero];
93 [_bar addSubview:_keys_container];
94
95 _keys_scrollview = [[RDPKeyScrollView alloc] initWithFrame:CGRectZero];
96 [_keys_scrollview setShowsHorizontalScrollIndicator:NO];
97 [_keys_scrollview setDelaysContentTouches:NO];
98 [_keys_scrollview setDelegate:self];
99 [_keys_container addSubview:_keys_scrollview];
100
101 _fade_mask = [[CAGradientLayer layer] retain];
102 [_fade_mask setStartPoint:CGPointMake(0.0, 0.5)];
103 [_fade_mask setEndPoint:CGPointMake(1.0, 0.5)];
104
105 const RDPKeyboardToolbarMetrics *metrics = RDPGetKeyboardToolbarMetrics();
106 _key_buttons = [[NSMutableArray alloc] initWithCapacity:ACCESSORY_KEY_COUNT];
107
108
109 [self addKeyWithTitle:nil
110 image:RDPWindowsLogoImage(metrics->logoSize)
111 accessibilityLabel:NSLocalizedString(@"Windows", @"Windows key")
112 target:target
113 action:@selector(toggleWinKey:)];
114 [self addKeyWithTitle:@"esc"
115 image:nil
116 accessibilityLabel:NSLocalizedString(@"Escape", @"Escape key")
117 target:target
118 action:@selector(pressEscKey:)];
119 [self addKeyWithTitle:@"shift"
120 image:nil
121 accessibilityLabel:NSLocalizedString(@"Shift", @"Shift key")
122 target:target
123 action:@selector(toggleShiftKey:)];
124 [self addKeyWithTitle:@"ctrl"
125 image:nil
126 accessibilityLabel:NSLocalizedString(@"Control", @"Control key")
127 target:target
128 action:@selector(toggleCtrlKey:)];
129 [self addKeyWithTitle:@"alt"
130 image:nil
131 accessibilityLabel:NSLocalizedString(@"Alt", @"Alt key")
132 target:target
133 action:@selector(toggleAltKey:)];
134 [self addKeyWithTitle:@"alt gr"
135 image:nil
136 accessibilityLabel:NSLocalizedString(@"Alt Gr", @"Alt Gr key")
137 target:target
138 action:@selector(toggleAltGrKey:)];
139 [self addKeyWithTitle:@"del"
140 image:nil
141 accessibilityLabel:NSLocalizedString(@"Delete", @"Delete key")
142 target:target
143 action:@selector(pressDeleteKey:)];
144 [self addKeyWithTitle:@"tab"
145 image:nil
146 accessibilityLabel:NSLocalizedString(@"Tab", @"Tab key")
147 target:target
148 action:@selector(pressTabKey:)];
149
150 _divider = [[UIView alloc] initWithFrame:CGRectZero];
151
152 [_divider setBackgroundColor:[UIColor colorWithWhite:0.5 alpha:0.6]];
153 [_bar addSubview:_divider];
154
155 UIImageSymbolConfiguration *config =
156 [UIImageSymbolConfiguration configurationWithPointSize:metrics->symbolSize
157 weight:UIImageSymbolWeightMedium];
158 _toggle_button =
159 [RDPCreateKeyButton(nil, [UIImage systemImageNamed:@"arrow.right.arrow.left"
160 withConfiguration:config]) retain];
161 [_toggle_button setAccessibilityLabel:NSLocalizedString(@"Extended keyboard",
162 @"Extended keyboard toggle")];
163 [_toggle_button addTarget:target
164 action:@selector(toggleKeyboardWhenOtherVisible:)
165 forControlEvents:UIControlEventTouchUpInside];
166 [_toggle_button addTarget:self
167 action:@selector(playInputClick:)
168 forControlEvents:UIControlEventTouchUpInside];
169 [_bar addSubview:_toggle_button];
170 }
171 return self;
172}