| 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 "views/controls/link.h" | 5 #include "views/controls/link.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(TOOLKIT_USES_GTK) | 9 #if defined(TOOLKIT_USES_GTK) |
| 10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/utf_string_conversions.h" | |
| 15 #include "ui/base/accessibility/accessible_view_state.h" | 14 #include "ui/base/accessibility/accessible_view_state.h" |
| 16 #include "ui/base/keycodes/keyboard_codes.h" | 15 #include "ui/base/keycodes/keyboard_codes.h" |
| 17 #include "ui/gfx/color_utils.h" | 16 #include "ui/gfx/color_utils.h" |
| 18 #include "ui/gfx/font.h" | 17 #include "ui/gfx/font.h" |
| 19 #include "views/controls/link_listener.h" | 18 #include "views/controls/link_listener.h" |
| 20 #include "views/events/event.h" | 19 #include "views/events/event.h" |
| 21 | 20 |
| 22 #if defined(TOOLKIT_USES_GTK) | 21 #if defined(TOOLKIT_USES_GTK) |
| 23 #include "ui/gfx/gtk_util.h" | 22 #include "ui/gfx/gtk_util.h" |
| 24 #endif | 23 #endif |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 *disabled_color = kDisabledColor; | 58 *disabled_color = kDisabledColor; |
| 60 *normal_color = kNormalColor; | 59 *normal_color = kNormalColor; |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 65 namespace views { | 64 namespace views { |
| 66 | 65 |
| 67 const char Link::kViewClassName[] = "views/Link"; | 66 const char Link::kViewClassName[] = "views/Link"; |
| 68 | 67 |
| 69 Link::Link() | 68 Link::Link() : Label(L""), |
| 70 : Label(string16()), | 69 listener_(NULL), |
| 71 listener_(NULL), | 70 highlighted_(false) { |
| 72 highlighted_(false) { | |
| 73 Init(); | 71 Init(); |
| 74 set_focusable(true); | 72 set_focusable(true); |
| 75 } | 73 } |
| 76 | 74 |
| 77 Link::Link(const string16& title) | 75 Link::Link(const std::wstring& title) : Label(title), |
| 78 : Label(title), | 76 listener_(NULL), |
| 79 listener_(NULL), | 77 highlighted_(false) { |
| 80 highlighted_(false) { | |
| 81 Init(); | 78 Init(); |
| 82 set_focusable(true); | 79 set_focusable(true); |
| 83 } | 80 } |
| 84 | 81 |
| 85 void Link::Init() { | 82 void Link::Init() { |
| 86 GetColors(NULL, &highlighted_color_, &disabled_color_, &normal_color_); | 83 GetColors(NULL, &highlighted_color_, &disabled_color_, &normal_color_); |
| 87 SetColor(normal_color_); | 84 SetColor(normal_color_); |
| 88 ValidateStyle(); | 85 ValidateStyle(); |
| 89 } | 86 } |
| 90 | 87 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } else { | 222 } else { |
| 226 if (font().GetStyle() & gfx::Font::UNDERLINED) { | 223 if (font().GetStyle() & gfx::Font::UNDERLINED) { |
| 227 Label::SetFont( | 224 Label::SetFont( |
| 228 font().DeriveFont(0, font().GetStyle() & ~gfx::Font::UNDERLINED)); | 225 font().DeriveFont(0, font().GetStyle() & ~gfx::Font::UNDERLINED)); |
| 229 } | 226 } |
| 230 Label::SetColor(disabled_color_); | 227 Label::SetColor(disabled_color_); |
| 231 } | 228 } |
| 232 } | 229 } |
| 233 | 230 |
| 234 } // namespace views | 231 } // namespace views |
| OLD | NEW |