summaryrefslogtreecommitdiffstats
path: root/ui/views/events
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 20:29:13 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 20:29:13 +0000
commit7b398483f56fcbe4a84dc3eee6f80d1ec96c925a (patch)
treec1fdca22837562229f445cd529d39f2362201dd4 /ui/views/events
parenta2a1baf4c5f6b4246eff6b9ed9f480ec64539ee6 (diff)
downloadchromium_src-7b398483f56fcbe4a84dc3eee6f80d1ec96c925a.zip
chromium_src-7b398483f56fcbe4a84dc3eee6f80d1ec96c925a.tar.gz
chromium_src-7b398483f56fcbe4a84dc3eee6f80d1ec96c925a.tar.bz2
Switch to using FocusEvent for focus change notifications.
I also removed ViewStorage usage for now. Jay described generally the kind of cases where this might be useful but I have not encountered them yet in my current testing. I will reintroduce this code if it becomes necessary. Note that I have not yet verified that this works. That comes next. BUG=none TEST=none Review URL: http://codereview.chromium.org/6368083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/events')
-rw-r--r--ui/views/events/event.cc2
-rw-r--r--ui/views/events/event.h3
-rw-r--r--ui/views/events/focus_event.cc19
-rw-r--r--ui/views/events/focus_event.h51
4 files changed, 73 insertions, 2 deletions
diff --git a/ui/views/events/event.cc b/ui/views/events/event.cc
index f1d04b9..a6da13b 100644
--- a/ui/views/events/event.cc
+++ b/ui/views/events/event.cc
@@ -54,4 +54,4 @@ MouseEvent::MouseEvent(const MouseEvent& other, View* source, View* target)
: LocatedEvent(other, source, target) {
}
-} // namespace views
+} // namespace ui
diff --git a/ui/views/events/event.h b/ui/views/events/event.h
index d8ad17f..c3cbce0 100644
--- a/ui/views/events/event.h
+++ b/ui/views/events/event.h
@@ -30,7 +30,8 @@ class Event {
ET_KEY_PRESSED,
ET_KEY_RELEASED,
ET_MOUSEWHEEL,
- ET_DROP_TARGET_EVENT };
+ ET_DROP_TARGET_EVENT,
+ ET_FOCUS_CHANGE };
// Event flags currently supported. Although this is a "views"
// file, this header is used on non-views platforms (e.g. OSX). For
diff --git a/ui/views/events/focus_event.cc b/ui/views/events/focus_event.cc
new file mode 100644
index 0000000..4a05999
--- /dev/null
+++ b/ui/views/events/focus_event.cc
@@ -0,0 +1,19 @@
+// 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/focus_event.h"
+
+namespace ui {
+
+////////////////////////////////////////////////////////////////////////////////
+// FocusEvent, public:
+
+FocusEvent::FocusEvent(Type type, Reason reason, TraversalDirection direction)
+ : type_(type),
+ reason_(reason),
+ direction_(direction),
+ Event(ET_FOCUS_CHANGE, 0) {
+}
+
+} // namespace ui
diff --git a/ui/views/events/focus_event.h b/ui/views/events/focus_event.h
new file mode 100644
index 0000000..377c3f7
--- /dev/null
+++ b/ui/views/events/focus_event.h
@@ -0,0 +1,51 @@
+// 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.
+
+#ifndef UI_VIEWS_EVENTS_FOCUS_EVENT_H_
+#define UI_VIEWS_EVENTS_FOCUS_EVENT_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "ui/views/events/event.h"
+
+namespace ui {
+
+class FocusEvent : public Event {
+ public:
+ enum Type {
+ TYPE_FOCUS_IN, // Target View did gain focus
+ TYPE_FOCUS_OUT // Target View will lose focus
+ };
+
+ enum Reason {
+ REASON_TRAVERSAL, // Focus change occurred because of a tab-traversal
+ REASON_RESTORE, // Focus was restored (e.g. window activation).
+ REASON_DIRECT // Focus was directly set (e.g. with mouse click).
+ };
+
+ enum TraversalDirection {
+ DIRECTION_NONE,
+ DIRECTION_FORWARD,
+ DIRECTION_REVERSE
+ };
+
+ FocusEvent(Type type,
+ Reason reason,
+ TraversalDirection direction);
+
+ Type type() const { return type_; }
+ Reason reason() const { return reason_; }
+ TraversalDirection direction() const { return direction_; }
+
+ private:
+ Type type_;
+ Reason reason_;
+ TraversalDirection direction_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusEvent);
+};
+
+} // namespace ui
+
+#endif // UI_VIEWS_EVENTS_FOCUS_EVENT_H_