| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
| 13 #include "ui/gfx/color_utils.h" | 13 #include "ui/gfx/color_utils.h" |
| 14 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
| 15 #include "ui/views/controls/link_listener.h" | 15 #include "ui/views/controls/link_listener.h" |
| 16 #include "ui/views/events/event.h" | 16 #include "ui/views/events/event.h" |
| 17 | 17 |
| 18 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
| 19 #include "ui/aura/cursor.h" | 19 #include "ui/base/cursor/cursor.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 | 23 |
| 24 const char Link::kViewClassName[] = "views/Link"; | 24 const char Link::kViewClassName[] = "views/Link"; |
| 25 | 25 |
| 26 Link::Link() : Label(string16()) { | 26 Link::Link() : Label(string16()) { |
| 27 Init(); | 27 Init(); |
| 28 } | 28 } |
| 29 | 29 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::string Link::GetClassName() const { | 42 std::string Link::GetClassName() const { |
| 43 return kViewClassName; | 43 return kViewClassName; |
| 44 } | 44 } |
| 45 | 45 |
| 46 gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { | 46 gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { |
| 47 if (!enabled()) | 47 if (!enabled()) |
| 48 return gfx::kNullCursor; | 48 return gfx::kNullCursor; |
| 49 #if defined(USE_AURA) | 49 #if defined(USE_AURA) |
| 50 return aura::kCursorHand; | 50 return ui::kCursorHand; |
| 51 #elif defined(OS_WIN) | 51 #elif defined(OS_WIN) |
| 52 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); | 52 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); |
| 53 return g_hand_cursor; | 53 return g_hand_cursor; |
| 54 #endif | 54 #endif |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool Link::HitTest(const gfx::Point& l) const { | 57 bool Link::HitTest(const gfx::Point& l) const { |
| 58 // We need to allow clicks on the link. So we override the implementation in | 58 // We need to allow clicks on the link. So we override the implementation in |
| 59 // Label and use the default implementation of View. | 59 // Label and use the default implementation of View. |
| 60 return View::HitTest(l); | 60 return View::HitTest(l); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void Link::RecalculateFont() { | 181 void Link::RecalculateFont() { |
| 182 // The font should be underlined iff the link is enabled. | 182 // The font should be underlined iff the link is enabled. |
| 183 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) { | 183 if (enabled() == !(font().GetStyle() & gfx::Font::UNDERLINED)) { |
| 184 Label::SetFont(font().DeriveFont(0, enabled() ? | 184 Label::SetFont(font().DeriveFont(0, enabled() ? |
| 185 (font().GetStyle() | gfx::Font::UNDERLINED) : | 185 (font().GetStyle() | gfx::Font::UNDERLINED) : |
| 186 (font().GetStyle() & ~gfx::Font::UNDERLINED))); | 186 (font().GetStyle() & ~gfx::Font::UNDERLINED))); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace views | 190 } // namespace views |
| OLD | NEW |