OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MASH_WM_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 6 #define MASH_WM_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "base/macros.h" |
9 #include "ash/frame/caption_buttons/caption_button_types.h" | |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mash/wm/frame/caption_buttons/caption_button_types.h" |
11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
12 #include "ui/views/controls/button/custom_button.h" | 12 #include "ui/views/controls/button/custom_button.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class SlideAnimation; | 15 class SlideAnimation; |
16 } | 16 } |
17 | 17 |
18 namespace ash { | 18 namespace mash { |
| 19 namespace wm { |
19 | 20 |
20 // Base class for the window caption buttons (minimize, maximize, restore, | 21 // Base class for the window caption buttons (minimize, maximize, restore, |
21 // close). | 22 // close). |
22 class ASH_EXPORT FrameCaptionButton : public views::CustomButton { | 23 class FrameCaptionButton : public views::CustomButton { |
23 public: | 24 public: |
24 enum Animate { | 25 enum Animate { ANIMATE_YES, ANIMATE_NO }; |
25 ANIMATE_YES, | |
26 ANIMATE_NO | |
27 }; | |
28 | 26 |
29 static const char kViewClassName[]; | 27 static const char kViewClassName[]; |
30 | 28 |
31 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon); | 29 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon); |
32 ~FrameCaptionButton() override; | 30 ~FrameCaptionButton() override; |
33 | 31 |
34 // Sets the images to use to paint the button. If |animate| is ANIMATE_YES, | 32 // Sets the images to use to paint the button. If |animate| is ANIMATE_YES, |
35 // the button crossfades to the new visuals. If the image ids match those | 33 // the button crossfades to the new visuals. If the image ids match those |
36 // currently used by the button and |animate| is ANIMATE_NO the crossfade | 34 // currently used by the button and |animate| is ANIMATE_NO the crossfade |
37 // animation is progressed to the end. | 35 // animation is progressed to the end. |
(...skipping 12 matching lines...) Expand all Loading... |
50 | 48 |
51 // views::View overrides: | 49 // views::View overrides: |
52 gfx::Size GetPreferredSize() const override; | 50 gfx::Size GetPreferredSize() const override; |
53 const char* GetClassName() const override; | 51 const char* GetClassName() const override; |
54 void OnPaint(gfx::Canvas* canvas) override; | 52 void OnPaint(gfx::Canvas* canvas) override; |
55 | 53 |
56 void set_paint_as_active(bool paint_as_active) { | 54 void set_paint_as_active(bool paint_as_active) { |
57 paint_as_active_ = paint_as_active; | 55 paint_as_active_ = paint_as_active; |
58 } | 56 } |
59 | 57 |
60 CaptionButtonIcon icon() const { | 58 CaptionButtonIcon icon() const { return icon_; } |
61 return icon_; | |
62 } | |
63 | 59 |
64 int icon_image_id() const { return icon_image_id_; } | 60 int icon_image_id() const { return icon_image_id_; } |
65 | 61 |
66 protected: | 62 protected: |
67 // views::CustomButton override: | 63 // views::CustomButton override: |
68 void OnGestureEvent(ui::GestureEvent* event) override; | 64 void OnGestureEvent(ui::GestureEvent* event) override; |
69 | 65 |
70 private: | 66 private: |
71 // Paints |to_center| centered within the button with |alpha|. | 67 // Paints |to_center| centered within the button with |alpha|. |
72 void PaintCentered(gfx::Canvas* canvas, | 68 void PaintCentered(gfx::Canvas* canvas, |
(...skipping 20 matching lines...) Expand all Loading... |
93 // The icon image to crossfade from. | 89 // The icon image to crossfade from. |
94 gfx::ImageSkia crossfade_icon_image_; | 90 gfx::ImageSkia crossfade_icon_image_; |
95 | 91 |
96 // Crossfade animation started when the button's images are changed by | 92 // Crossfade animation started when the button's images are changed by |
97 // SetImages(). | 93 // SetImages(). |
98 scoped_ptr<gfx::SlideAnimation> swap_images_animation_; | 94 scoped_ptr<gfx::SlideAnimation> swap_images_animation_; |
99 | 95 |
100 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); | 96 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); |
101 }; | 97 }; |
102 | 98 |
103 } // namespace ash | 99 } // namespace wm |
| 100 } // namespace mash |
104 | 101 |
105 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ | 102 #endif // MASH_WM_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ |
OLD | NEW |