blob: 179420f376b59adf1fd8989db9cf46045565bc08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/events/event_handler.h"
#include "ui/events/event.h"
#include "ui/events/event_dispatcher.h"
namespace ui {
EventHandler::EventHandler() {
}
EventHandler::~EventHandler() {
while (!dispatchers_.empty()) {
EventDispatcher* dispatcher = dispatchers_.top();
dispatchers_.pop();
dispatcher->OnHandlerDestroyed(this);
}
}
void EventHandler::OnEvent(Event* event) {
if (event->IsKeyEvent())
OnKeyEvent(event->AsKeyEvent());
else if (event->IsMouseEvent())
OnMouseEvent(event->AsMouseEvent());
else if (event->IsScrollEvent())
OnScrollEvent(event->AsScrollEvent());
else if (event->IsTouchEvent())
OnTouchEvent(event->AsTouchEvent());
else if (event->IsGestureEvent())
OnGestureEvent(event->AsGestureEvent());
else if (event->IsCancelModeEvent())
OnCancelMode(event->AsCancelModeEvent());
}
void EventHandler::OnKeyEvent(KeyEvent* event) {
}
void EventHandler::OnMouseEvent(MouseEvent* event) {
}
void EventHandler::OnScrollEvent(ScrollEvent* event) {
}
void EventHandler::OnTouchEvent(TouchEvent* event) {
}
void EventHandler::OnGestureEvent(GestureEvent* event) {
}
void EventHandler::OnCancelMode(CancelModeEvent* event) {
}
} // namespace ui
|