blob: db2a14367bd7378514325d9c4c9bb74eaf45dc96 [file] [log] [blame]
Alexandre Lision62005312016-01-28 15:55:16 -05001/*
Sébastien Blin029ffa82019-01-02 17:43:48 -05002 * Copyright (C) 2016-2019 Savoir-faire Linux Inc.
Alexandre Lision62005312016-01-28 15:55:16 -05003 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#import "DialpadWC.h"
21
Alexandre Lision62005312016-01-28 15:55:16 -050022@interface DialpadWC ()
23
24@property (unsafe_unretained) IBOutlet NSTextField* composerField;
25
26@end
27
28@implementation DialpadWC
29@synthesize composerField;
30
31- (void)windowDidLoad {
32 [super windowDidLoad];
Alexandre Lision62005312016-01-28 15:55:16 -050033}
34
35- (IBAction)dtmfPressed:(id)sender
36{
37 [self sendDTMF:[sender title]];
38}
39
40- (void) keyDown:(NSEvent *)theEvent
41{
42 NSString* characters = [theEvent characters];
43 if ([characters length] == 1) {
44 NSString* filter = @"0123456789*#";
45 if ([filter containsString:characters]) {
46 [self sendDTMF:characters];
47 }
48 }
49}
50
51- (void) sendDTMF:(NSString*) dtmf
52{
Alexandre Lision62005312016-01-28 15:55:16 -050053}
54
55///Accessibility
56- (void)insertTab:(id)sender
57{
58 if ([[self window] firstResponder] == self) {
59 [[self window] selectNextKeyView:self];
60 }
61}
62
63- (void)insertBacktab:(id)sender
64{
65 if ([[self window] firstResponder] == self) {
66 [[self window] selectPreviousKeyView:self];
67 }
68}
69
70- (void) windowWillClose:(NSNotification *)notification
71{
72 [composerField setStringValue:@""];
73 [composerField setNeedsDisplay:YES];
74}
75
76@end