OLD | NEW |
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" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void Link::GetAccessibleState(ui::AccessibleViewState* state) { | 141 void Link::GetAccessibleState(ui::AccessibleViewState* state) { |
142 Label::GetAccessibleState(state); | 142 Label::GetAccessibleState(state); |
143 state->role = ui::AccessibilityTypes::ROLE_LINK; | 143 state->role = ui::AccessibilityTypes::ROLE_LINK; |
144 } | 144 } |
145 | 145 |
146 void Link::OnEnabledChanged() { | 146 void Link::OnEnabledChanged() { |
147 RecalculateFont(); | 147 RecalculateFont(); |
148 View::OnEnabledChanged(); | 148 View::OnEnabledChanged(); |
149 } | 149 } |
150 | 150 |
151 void Link::OnPaint(gfx::Canvas* canvas) { | |
152 Label::OnPaint(canvas); | |
153 | |
154 if (HasFocus()) | |
155 canvas->DrawFocusRect(GetLocalBounds()); | |
156 } | |
157 | |
158 void Link::OnFocus() { | 151 void Link::OnFocus() { |
159 Label::OnFocus(); | 152 Label::OnFocus(); |
160 // We render differently focused. | 153 // We render differently focused. |
161 SchedulePaint(); | 154 SchedulePaint(); |
162 } | 155 } |
163 | 156 |
164 void Link::OnBlur() { | 157 void Link::OnBlur() { |
165 Label::OnBlur(); | 158 Label::OnBlur(); |
166 // We render differently focused. | 159 // We render differently focused. |
167 SchedulePaint(); | 160 SchedulePaint(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 const int style = font_list().GetFontStyle(); | 229 const int style = font_list().GetFontStyle(); |
237 const int intended_style = (enabled() && underline_) ? | 230 const int intended_style = (enabled() && underline_) ? |
238 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE); | 231 (style | gfx::Font::UNDERLINE) : (style & ~gfx::Font::UNDERLINE); |
239 if (style != intended_style) { | 232 if (style != intended_style) { |
240 Label::SetFontList( | 233 Label::SetFontList( |
241 font_list().DeriveFontListWithSizeDeltaAndStyle(0, intended_style)); | 234 font_list().DeriveFontListWithSizeDeltaAndStyle(0, intended_style)); |
242 } | 235 } |
243 } | 236 } |
244 | 237 |
245 } // namespace views | 238 } // namespace views |
OLD | NEW |