summaryrefslogtreecommitdiffstats
path: root/ui/views/events/event.cc
blob: 4c62b8a71f5cdd574c7a19e8dab0db6ae302383e (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
// Copyright (c) 2011 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/views/events/event.h"

#include "ui/views/view.h"

namespace ui {

////////////////////////////////////////////////////////////////////////////////
// Event, protected:

Event::Event(EventType type, int flags)
    : type_(type),
      flags_(flags) {
}

////////////////////////////////////////////////////////////////////////////////
// LocatedEvent, protected:

LocatedEvent::LocatedEvent(EventType type,
                           const gfx::Point& location,
                           int flags)
    : Event(type, flags),
      location_(location) {
}

LocatedEvent::LocatedEvent(const LocatedEvent& other,
                           View* source,
                           View* target)
    : Event(other.type(), other.flags()) {
  location_ = other.location();
  View::ConvertPointToView(source, target, &location_);
}

////////////////////////////////////////////////////////////////////////////////
// MouseEvent, public:

MouseEvent::MouseEvent(const MouseEvent& other, View* source, View* target)
    : LocatedEvent(other, source, target) {
}

}  // namespace views