1/*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#import "config.h"
27#import "WAKResponder.h"
28
29#if PLATFORM(IOS)
30
31#import "WAKViewPrivate.h"
32#import "WKViewPrivate.h"
33
34@implementation WAKResponder
35
36// FIXME: the functions named handleEvent generally do not forward event to the parent chain.
37// This method should ideally be removed, or renamed "sendEvent".
38- (void)handleEvent:(WebEvent *)event
39{
40    UNUSED_PARAM(event);
41}
42
43- (void)_forwardEvent:(WebEvent *)event
44{
45    [[self nextResponder] handleEvent:event];
46}
47
48- (void)scrollWheel:(WebEvent *)event
49{
50    [self _forwardEvent:event];
51}
52
53- (void)mouseEntered:(WebEvent *)event
54{
55    [self _forwardEvent:event];
56}
57
58- (void)mouseExited:(WebEvent *)event
59{
60    [self _forwardEvent:event];
61}
62
63- (void)mouseMoved:(WebEvent *)theEvent
64{
65    [self _forwardEvent:theEvent];
66}
67
68- (void)keyDown:(WebEvent *)event
69{
70    [self _forwardEvent:event];
71}
72- (void)keyUp:(WebEvent *)event
73{
74    [self _forwardEvent:event];
75}
76
77#if ENABLE(TOUCH_EVENTS)
78- (void)touch:(WebEvent *)event
79{
80    [self _forwardEvent:event];
81}
82#endif
83
84- (WAKResponder *)nextResponder { return nil; }
85
86- (void)insertText:(NSString *)text
87{
88    UNUSED_PARAM(text);
89}
90
91- (void)deleteBackward:(id)sender
92{
93    UNUSED_PARAM(sender);
94}
95
96- (void)deleteForward:(id)sender
97{
98    UNUSED_PARAM(sender);
99}
100
101- (void)insertParagraphSeparator:(id)sender
102{
103    UNUSED_PARAM(sender);
104}
105
106- (void)moveDown:(id)sender
107{
108    UNUSED_PARAM(sender);
109}
110
111- (void)moveDownAndModifySelection:(id)sender
112{
113    UNUSED_PARAM(sender);
114}
115
116- (void)moveLeft:(id)sender
117{
118    UNUSED_PARAM(sender);
119}
120
121- (void)moveLeftAndModifySelection:(id)sender
122{
123    UNUSED_PARAM(sender);
124}
125
126- (void)moveRight:(id)sender
127{
128    UNUSED_PARAM(sender);
129}
130
131- (void)moveRightAndModifySelection:(id)sender
132{
133    UNUSED_PARAM(sender);
134}
135
136- (void)moveUp:(id)sender
137{
138    UNUSED_PARAM(sender);
139}
140
141- (void)moveUpAndModifySelection:(id)sender
142{
143    UNUSED_PARAM(sender);
144}
145
146- (void)mouseUp:(WebEvent *)event
147{
148    [self _forwardEvent:event];
149}
150
151- (void)mouseDown:(WebEvent *)event
152{
153    [self _forwardEvent:event];
154}
155
156- (BOOL)acceptsFirstResponder { return true; }
157- (BOOL)becomeFirstResponder { return true; }
158- (BOOL)resignFirstResponder { return true; }
159
160- (BOOL)tryToPerform:(SEL)anAction with:(id)anObject
161{
162    if ([self respondsToSelector:anAction]) {
163        [self performSelector:anAction withObject:anObject];
164        return YES;
165    }
166    return NO;
167}
168
169@end
170
171#endif // PLATFORM(IOS)
172