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(OS_LINUX) | 9 #if defined(OS_LINUX) |
10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 void Link::Init() { | 82 void Link::Init() { |
83 GetColors(NULL, &highlighted_color_, &disabled_color_, &normal_color_); | 83 GetColors(NULL, &highlighted_color_, &disabled_color_, &normal_color_); |
84 SetColor(normal_color_); | 84 SetColor(normal_color_); |
85 ValidateStyle(); | 85 ValidateStyle(); |
86 } | 86 } |
87 | 87 |
88 Link::~Link() { | 88 Link::~Link() { |
89 } | 89 } |
90 | 90 |
91 void Link::SetEnabled(bool flag) { | 91 void Link::OnEnabledChanged() { |
92 if (flag != enabled_) { | 92 ValidateStyle(); |
93 enabled_ = flag; | 93 SchedulePaint(); |
94 ValidateStyle(); | |
95 SchedulePaint(); | |
96 } | |
97 } | 94 } |
98 | 95 |
99 std::string Link::GetClassName() const { | 96 std::string Link::GetClassName() const { |
100 return kViewClassName; | 97 return kViewClassName; |
101 } | 98 } |
102 | 99 |
103 gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { | 100 gfx::NativeCursor Link::GetCursor(const MouseEvent& event) { |
104 if (!enabled_) | 101 if (!enabled_) |
105 return NULL; | 102 return NULL; |
106 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } else { | 211 } else { |
215 if (font().GetStyle() & gfx::Font::UNDERLINED) { | 212 if (font().GetStyle() & gfx::Font::UNDERLINED) { |
216 Label::SetFont( | 213 Label::SetFont( |
217 font().DeriveFont(0, font().GetStyle() & ~gfx::Font::UNDERLINED)); | 214 font().DeriveFont(0, font().GetStyle() & ~gfx::Font::UNDERLINED)); |
218 } | 215 } |
219 Label::SetColor(disabled_color_); | 216 Label::SetColor(disabled_color_); |
220 } | 217 } |
221 } | 218 } |
222 | 219 |
223 } // namespace views | 220 } // namespace views |
OLD | NEW |