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

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

Issue 248863002: MacViews: Introduce native_cursor.h to provide cursor "literals" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « no previous file | ui/views/controls/resize_area.cc » ('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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "ui/accessibility/ax_view_state.h" 11 #include "ui/accessibility/ax_view_state.h"
12 #include "ui/base/cursor/cursor.h" 12 #include "ui/base/cursor/cursor.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/events/keycodes/keyboard_codes.h" 14 #include "ui/events/keycodes/keyboard_codes.h"
15 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/color_utils.h" 16 #include "ui/gfx/color_utils.h"
17 #include "ui/gfx/font_list.h" 17 #include "ui/gfx/font_list.h"
18 #include "ui/views/controls/link_listener.h" 18 #include "ui/views/controls/link_listener.h"
19 #include "ui/views/native_cursor.h"
19 20
20 namespace views { 21 namespace views {
21 22
22 const char Link::kViewClassName[] = "Link"; 23 const char Link::kViewClassName[] = "Link";
23 24
24 Link::Link() : Label(base::string16()) { 25 Link::Link() : Label(base::string16()) {
25 Init(); 26 Init();
26 } 27 }
27 28
28 Link::Link(const base::string16& title) : Label(title) { 29 Link::Link(const base::string16& title) : Label(title) {
(...skipping 11 matching lines...) Expand all
40 #endif 41 #endif
41 } 42 }
42 43
43 const char* Link::GetClassName() const { 44 const char* Link::GetClassName() const {
44 return kViewClassName; 45 return kViewClassName;
45 } 46 }
46 47
47 gfx::NativeCursor Link::GetCursor(const ui::MouseEvent& event) { 48 gfx::NativeCursor Link::GetCursor(const ui::MouseEvent& event) {
48 if (!enabled()) 49 if (!enabled())
49 return gfx::kNullCursor; 50 return gfx::kNullCursor;
50 return ui::kCursorHand; 51 return GetNativeHandCursor();
51 } 52 }
52 53
53 bool Link::HitTestRect(const gfx::Rect& rect) const { 54 bool Link::HitTestRect(const gfx::Rect& rect) const {
54 // We need to allow clicks on the link. So we override the implementation in 55 // We need to allow clicks on the link. So we override the implementation in
55 // Label and use the default implementation of View. 56 // Label and use the default implementation of View.
56 return View::HitTestRect(rect); 57 return View::HitTestRect(rect);
57 } 58 }
58 59
59 bool Link::OnMousePressed(const ui::MouseEvent& event) { 60 bool Link::OnMousePressed(const ui::MouseEvent& event) {
60 if (!enabled() || 61 if (!enabled() ||
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 void Link::RecalculateFont() { 220 void Link::RecalculateFont() {
220 // Underline the link iff it is enabled and |underline_| is true. 221 // Underline the link iff it is enabled and |underline_| is true.
221 const int style = font_list().GetFontStyle(); 222 const int style = font_list().GetFontStyle();
222 const int intended_style = (enabled() && underline_) ? 223 const int intended_style = (enabled() && underline_) ?
223 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE); 224 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE);
224 if (style != intended_style) 225 if (style != intended_style)
225 Label::SetFontList(font_list().DeriveWithStyle(intended_style)); 226 Label::SetFontList(font_list().DeriveWithStyle(intended_style));
226 } 227 }
227 228
228 } // namespace views 229 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/resize_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698