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_CONTAINER_VIEW_H_ | 5 #ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/frame/caption_buttons/frame_size_button_delegate.h" | 11 #include "ash/frame/caption_buttons/frame_size_button_delegate.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/gfx/animation/animation_delegate.h" | 13 #include "ui/gfx/animation/animation_delegate.h" |
14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class SlideAnimation; | 18 class SlideAnimation; |
| 19 enum class VectorIconId; |
19 } | 20 } |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 class Widget; | 23 class Widget; |
23 } | 24 } |
24 | 25 |
25 namespace ash { | 26 namespace ash { |
26 | 27 |
27 // Container view for the frame caption buttons. It performs the appropriate | 28 // Container view for the frame caption buttons. It performs the appropriate |
28 // action when a caption button is clicked. | 29 // action when a caption button is clicked. |
(...skipping 29 matching lines...) Expand all Loading... |
58 FrameCaptionButton* close_button() const { | 59 FrameCaptionButton* close_button() const { |
59 return container_view_->close_button_; | 60 return container_view_->close_button_; |
60 } | 61 } |
61 | 62 |
62 private: | 63 private: |
63 FrameCaptionButtonContainerView* container_view_; | 64 FrameCaptionButtonContainerView* container_view_; |
64 | 65 |
65 DISALLOW_COPY_AND_ASSIGN(TestApi); | 66 DISALLOW_COPY_AND_ASSIGN(TestApi); |
66 }; | 67 }; |
67 | 68 |
68 // Sets the resource id of the image to paint the button for |icon|. The | 69 // Sets the id of the vector image to paint the button for |icon|. The |
69 // FrameCaptionButtonContainerView will keep track of the image to use for | 70 // FrameCaptionButtonContainerView will keep track of the image to use for |
70 // |icon| even if none of the buttons currently use |icon|. | 71 // |icon| even if none of the buttons currently use |icon|. |
71 void SetButtonImage(CaptionButtonIcon icon, int icon_image_id); | 72 void SetButtonImage(CaptionButtonIcon icon, gfx::VectorIconId icon_image_id); |
72 | 73 |
73 // Sets whether the buttons should be painted as active. Does not schedule | 74 // Sets whether the buttons should be painted as active. Does not schedule |
74 // a repaint. | 75 // a repaint. |
75 void SetPaintAsActive(bool paint_as_active); | 76 void SetPaintAsActive(bool paint_as_active); |
76 | 77 |
| 78 // Sets whether the buttons should be painted in a lighter color (for use on |
| 79 // dark backgrounds). |
| 80 void SetUseLightImages(bool light); |
| 81 |
77 // Tell the window controls to reset themselves to the normal state. | 82 // Tell the window controls to reset themselves to the normal state. |
78 void ResetWindowControls(); | 83 void ResetWindowControls(); |
79 | 84 |
80 // Determines the window HT* code for the caption button at |point|. Returns | 85 // Determines the window HT* code for the caption button at |point|. Returns |
81 // HTNOWHERE if |point| is not over any of the caption buttons. |point| must | 86 // HTNOWHERE if |point| is not over any of the caption buttons. |point| must |
82 // be in the coordinates of the FrameCaptionButtonContainerView. | 87 // be in the coordinates of the FrameCaptionButtonContainerView. |
83 int NonClientHitTest(const gfx::Point& point) const; | 88 int NonClientHitTest(const gfx::Point& point) const; |
84 | 89 |
85 // Updates the size button's visibility based on whether |frame_| can be | 90 // Updates the size button's visibility based on whether |frame_| can be |
86 // maximized and if maximize mode is enabled. A parent view should relayout | 91 // maximized and if maximize mode is enabled. A parent view should relayout |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 views::Widget* frame_; | 137 views::Widget* frame_; |
133 | 138 |
134 // The buttons. In the normal button style, at most one of |minimize_button_| | 139 // The buttons. In the normal button style, at most one of |minimize_button_| |
135 // and |size_button_| is visible. | 140 // and |size_button_| is visible. |
136 FrameCaptionButton* minimize_button_; | 141 FrameCaptionButton* minimize_button_; |
137 FrameCaptionButton* size_button_; | 142 FrameCaptionButton* size_button_; |
138 FrameCaptionButton* close_button_; | 143 FrameCaptionButton* close_button_; |
139 | 144 |
140 // Mapping of the image ID needed to paint a button for each of the values of | 145 // Mapping of the image ID needed to paint a button for each of the values of |
141 // CaptionButtonIcon. | 146 // CaptionButtonIcon. |
142 std::map<CaptionButtonIcon, int> button_icon_id_map_; | 147 std::map<CaptionButtonIcon, gfx::VectorIconId> button_icon_id_map_; |
143 | 148 |
144 // Animation that affects the position of |minimize_button_| and the | 149 // Animation that affects the position of |minimize_button_| and the |
145 // visibility of |size_button_|. | 150 // visibility of |size_button_|. |
146 scoped_ptr<gfx::SlideAnimation> maximize_mode_animation_; | 151 scoped_ptr<gfx::SlideAnimation> maximize_mode_animation_; |
147 | 152 |
148 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); | 153 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); |
149 }; | 154 }; |
150 | 155 |
151 } // namespace ash | 156 } // namespace ash |
152 | 157 |
153 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 158 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
OLD | NEW |