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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/frame/caption_buttons/caption_button_types.h" | 11 #include "ash/frame/caption_buttons/caption_button_types.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 #include "ui/views/controls/button/custom_button.h" | 14 #include "ui/views/controls/button/custom_button.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class SlideAnimation; | 17 class SlideAnimation; |
18 enum class VectorIconId; | 18 enum class VectorIconId; |
19 } | 19 } |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 | 22 |
23 // Base class for the window caption buttons (minimize, maximize, restore, | 23 // Base class for the window caption buttons (minimize, maximize, restore, |
24 // close). | 24 // close). |
25 class ASH_EXPORT FrameCaptionButton : public views::CustomButton { | 25 class ASH_EXPORT FrameCaptionButton : public views::CustomButton { |
26 public: | 26 public: |
27 enum Animate { | 27 enum Animate { ANIMATE_YES, ANIMATE_NO }; |
28 ANIMATE_YES, | |
29 ANIMATE_NO | |
30 }; | |
31 | 28 |
32 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
33 | 30 |
34 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon); | 31 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon); |
35 ~FrameCaptionButton() override; | 32 ~FrameCaptionButton() override; |
36 | 33 |
37 // Sets the image to use to paint the button. If |animate| is ANIMATE_YES, | 34 // Sets the image to use to paint the button. If |animate| is ANIMATE_YES, |
38 // the button crossfades to the new visuals. If the image id matches the one | 35 // the button crossfades to the new visuals. If the image id matches the one |
39 // currently used by the button and |animate| is ANIMATE_NO, the crossfade | 36 // currently used by the button and |animate| is ANIMATE_NO, the crossfade |
40 // animation is progressed to the end. | 37 // animation is progressed to the end. |
(...skipping 12 matching lines...) Expand all Loading... |
53 gfx::Size GetPreferredSize() const override; | 50 gfx::Size GetPreferredSize() const override; |
54 const char* GetClassName() const override; | 51 const char* GetClassName() const override; |
55 void OnPaint(gfx::Canvas* canvas) override; | 52 void OnPaint(gfx::Canvas* canvas) override; |
56 | 53 |
57 void set_paint_as_active(bool paint_as_active) { | 54 void set_paint_as_active(bool paint_as_active) { |
58 paint_as_active_ = paint_as_active; | 55 paint_as_active_ = paint_as_active; |
59 } | 56 } |
60 | 57 |
61 void set_use_light_images(bool light) { use_light_images_ = light; } | 58 void set_use_light_images(bool light) { use_light_images_ = light; } |
62 | 59 |
63 CaptionButtonIcon icon() const { | 60 CaptionButtonIcon icon() const { return icon_; } |
64 return icon_; | |
65 } | |
66 | 61 |
67 gfx::VectorIconId icon_image_id() const { return icon_image_id_; } | 62 gfx::VectorIconId icon_image_id() const { return icon_image_id_; } |
68 | 63 |
69 void set_size(const gfx::Size& size) { size_ = size; } | 64 void set_size(const gfx::Size& size) { size_ = size; } |
70 | 65 |
71 protected: | 66 protected: |
72 // views::CustomButton override: | 67 // views::CustomButton override: |
73 void OnGestureEvent(ui::GestureEvent* event) override; | 68 void OnGestureEvent(ui::GestureEvent* event) override; |
74 | 69 |
75 private: | 70 private: |
(...skipping 28 matching lines...) Expand all Loading... |
104 // Crossfade animation started when the button's images are changed by | 99 // Crossfade animation started when the button's images are changed by |
105 // SetImage(). | 100 // SetImage(). |
106 std::unique_ptr<gfx::SlideAnimation> swap_images_animation_; | 101 std::unique_ptr<gfx::SlideAnimation> swap_images_animation_; |
107 | 102 |
108 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); | 103 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); |
109 }; | 104 }; |
110 | 105 |
111 } // namespace ash | 106 } // namespace ash |
112 | 107 |
113 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 108 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
OLD | NEW |