OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/button/text_button.h" | 5 #include "views/controls/button/text_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/throb_animation.h" | 9 #include "app/throb_animation.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "gfx/canvas.h" | 11 #include "gfx/canvas.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 void TextButton::SetShowHighlighted(bool show_highlighted) { | 236 void TextButton::SetShowHighlighted(bool show_highlighted) { |
237 show_highlighted_ = show_highlighted; | 237 show_highlighted_ = show_highlighted; |
238 } | 238 } |
239 | 239 |
240 void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 240 void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
241 if (!for_drag) { | 241 if (!for_drag) { |
242 PaintBackground(canvas); | 242 PaintBackground(canvas); |
243 | 243 |
244 if (show_highlighted_ && hover_animation_->IsAnimating()) { | 244 if (show_highlighted_ && hover_animation_->is_animating()) { |
245 // Draw the hover bitmap into an offscreen buffer, then blend it | 245 // Draw the hover bitmap into an offscreen buffer, then blend it |
246 // back into the current canvas. | 246 // back into the current canvas. |
247 canvas->saveLayerAlpha(NULL, | 247 canvas->saveLayerAlpha(NULL, |
248 static_cast<int>(hover_animation_->GetCurrentValue() * 255), | 248 static_cast<int>(hover_animation_->GetCurrentValue() * 255), |
249 SkCanvas::kARGB_NoClipLayer_SaveFlag); | 249 SkCanvas::kARGB_NoClipLayer_SaveFlag); |
250 canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 250 canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
251 PaintBorder(canvas); | 251 PaintBorder(canvas); |
252 canvas->restore(); | 252 canvas->restore(); |
253 } else if ((show_highlighted_ && | 253 } else if ((show_highlighted_ && |
254 (state_ == BS_HOT || state_ == BS_PUSHED)) || | 254 (state_ == BS_HOT || state_ == BS_PUSHED)) || |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 bool TextButton::OnMousePressed(const MouseEvent& e) { | 399 bool TextButton::OnMousePressed(const MouseEvent& e) { |
400 RequestFocus(); | 400 RequestFocus(); |
401 return true; | 401 return true; |
402 } | 402 } |
403 | 403 |
404 void TextButton::Paint(gfx::Canvas* canvas) { | 404 void TextButton::Paint(gfx::Canvas* canvas) { |
405 Paint(canvas, false); | 405 Paint(canvas, false); |
406 } | 406 } |
407 | 407 |
408 } // namespace views | 408 } // namespace views |
OLD | NEW |