Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: ui/views/controls/link.cc

Issue 10824295: Rid the world of the last of views::Event types: TouchEvent, GestureEvent, MouseWheelEvent, ScrollE… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/link.h" 5 #include "ui/views/controls/link.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "ui/base/accessibility/accessible_view_state.h" 11 #include "ui/base/accessibility/accessible_view_state.h"
12 #include "ui/base/event.h" 12 #include "ui/base/event.h"
13 #include "ui/base/keycodes/keyboard_codes.h" 13 #include "ui/base/keycodes/keyboard_codes.h"
14 #include "ui/gfx/color_utils.h" 14 #include "ui/gfx/color_utils.h"
15 #include "ui/gfx/font.h" 15 #include "ui/gfx/font.h"
16 #include "ui/views/controls/link_listener.h" 16 #include "ui/views/controls/link_listener.h"
17 #include "ui/views/events/event.h"
18 17
19 #if defined(USE_AURA) 18 #if defined(USE_AURA)
20 #include "ui/base/cursor/cursor.h" 19 #include "ui/base/cursor/cursor.h"
21 #endif 20 #endif
22 21
23 namespace views { 22 namespace views {
24 23
25 const char Link::kViewClassName[] = "views/Link"; 24 const char Link::kViewClassName[] = "views/Link";
26 25
27 Link::Link() : Label(string16()) { 26 Link::Link() : Label(string16()) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 104
106 // Focus the link on key pressed. 105 // Focus the link on key pressed.
107 RequestFocus(); 106 RequestFocus();
108 107
109 if (listener_) 108 if (listener_)
110 listener_->LinkClicked(this, event.flags()); 109 listener_->LinkClicked(this, event.flags());
111 110
112 return true; 111 return true;
113 } 112 }
114 113
115 ui::GestureStatus Link::OnGestureEvent(const GestureEvent& event) { 114 ui::GestureStatus Link::OnGestureEvent(const ui::GestureEvent& event) {
116 if (!enabled()) 115 if (!enabled())
117 return ui::GESTURE_STATUS_UNKNOWN; 116 return ui::GESTURE_STATUS_UNKNOWN;
118 117
119 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { 118 if (event.type() == ui::ET_GESTURE_TAP_DOWN) {
120 SetPressed(true); 119 SetPressed(true);
121 } else if (event.type() == ui::ET_GESTURE_TAP) { 120 } else if (event.type() == ui::ET_GESTURE_TAP) {
122 RequestFocus(); 121 RequestFocus();
123 if (listener_) 122 if (listener_)
124 listener_->LinkClicked(this, event.flags()); 123 listener_->LinkClicked(this, event.flags());
125 } else { 124 } else {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void Link::RecalculateFont() { 198 void Link::RecalculateFont() {
200 // The font should be underlined iff the link is enabled. 199 // The font should be underlined iff the link is enabled.
201 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) { 200 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) {
202 Label::SetFont(font().DeriveFont(0, enabled() ? 201 Label::SetFont(font().DeriveFont(0, enabled() ?
203 (font().GetStyle() | gfx::Font::UNDERLINED) : 202 (font().GetStyle() | gfx::Font::UNDERLINED) :
204 (font().GetStyle() & ~gfx::Font::UNDERLINED))); 203 (font().GetStyle() & ~gfx::Font::UNDERLINED)));
205 } 204 }
206 } 205 }
207 206
208 } // namespace views 207 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/link.h ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698