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