OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 5 #ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/frame/caption_buttons/caption_button_types.h" | 9 #include "ash/frame/caption_buttons/caption_button_types.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 int pressed_background_image_id); | 43 int pressed_background_image_id); |
44 | 44 |
45 // Returns true if the button is crossfading to new visuals set in | 45 // Returns true if the button is crossfading to new visuals set in |
46 // SetImages(). | 46 // SetImages(). |
47 bool IsAnimatingImageSwap() const; | 47 bool IsAnimatingImageSwap() const; |
48 | 48 |
49 // Sets the alpha to use for painting. Used to animate visibility changes. | 49 // Sets the alpha to use for painting. Used to animate visibility changes. |
50 void SetAlpha(int alpha); | 50 void SetAlpha(int alpha); |
51 | 51 |
52 // views::View overrides: | 52 // views::View overrides: |
53 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 53 virtual gfx::Size GetPreferredSize() const override; |
54 virtual const char* GetClassName() const OVERRIDE; | 54 virtual const char* GetClassName() const override; |
55 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 55 virtual void OnPaint(gfx::Canvas* canvas) override; |
56 | 56 |
57 void set_paint_as_active(bool paint_as_active) { | 57 void set_paint_as_active(bool paint_as_active) { |
58 paint_as_active_ = paint_as_active; | 58 paint_as_active_ = paint_as_active; |
59 } | 59 } |
60 | 60 |
61 CaptionButtonIcon icon() const { | 61 CaptionButtonIcon icon() const { |
62 return icon_; | 62 return icon_; |
63 } | 63 } |
64 | 64 |
65 protected: | 65 protected: |
66 // views::CustomButton override: | 66 // views::CustomButton override: |
67 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 67 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
68 | 68 |
69 private: | 69 private: |
70 // Returns the icon image to paint based on |paint_as_active_|. | 70 // Returns the icon image to paint based on |paint_as_active_|. |
71 const gfx::ImageSkia& GetIconImageToPaint() const; | 71 const gfx::ImageSkia& GetIconImageToPaint() const; |
72 | 72 |
73 // Paints |to_center| centered within the button with |alpha|. | 73 // Paints |to_center| centered within the button with |alpha|. |
74 void PaintCentered(gfx::Canvas* canvas, | 74 void PaintCentered(gfx::Canvas* canvas, |
75 const gfx::ImageSkia& to_center, | 75 const gfx::ImageSkia& to_center, |
76 int alpha); | 76 int alpha); |
77 | 77 |
(...skipping 22 matching lines...) Expand all Loading... |
100 // Crossfade animation started when the button's images are changed by | 100 // Crossfade animation started when the button's images are changed by |
101 // SetImages(). | 101 // SetImages(). |
102 scoped_ptr<gfx::SlideAnimation> swap_images_animation_; | 102 scoped_ptr<gfx::SlideAnimation> swap_images_animation_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); | 104 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace ash | 107 } // namespace ash |
108 | 108 |
109 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 109 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
OLD | NEW |