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" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Tell the window controls to reset themselves to the normal state. | 82 // Tell the window controls to reset themselves to the normal state. |
83 void ResetWindowControls(); | 83 void ResetWindowControls(); |
84 | 84 |
85 // 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 |
86 // 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 |
87 // be in the coordinates of the FrameCaptionButtonContainerView. | 87 // be in the coordinates of the FrameCaptionButtonContainerView. |
88 int NonClientHitTest(const gfx::Point& point) const; | 88 int NonClientHitTest(const gfx::Point& point) const; |
89 | 89 |
90 // 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 |
91 // maximized and if maximize mode is enabled. A parent view should relayout | 91 // maximized and if tablet mode is enabled. A parent view should relayout |
92 // to reflect the change in visibility. | 92 // to reflect the change in visibility. |
93 void UpdateSizeButtonVisibility(); | 93 void UpdateSizeButtonVisibility(); |
94 | 94 |
95 // Sets the size of the buttons in this container. | 95 // Sets the size of the buttons in this container. |
96 void SetButtonSize(const gfx::Size& size); | 96 void SetButtonSize(const gfx::Size& size); |
97 | 97 |
98 // views::View: | 98 // views::View: |
99 gfx::Size CalculatePreferredSize() const override; | 99 gfx::Size CalculatePreferredSize() const override; |
100 void Layout() override; | 100 void Layout() override; |
101 const char* GetClassName() const override; | 101 const char* GetClassName() const override; |
102 | 102 |
103 // gfx::AnimationDelegate: | 103 // gfx::AnimationDelegate: |
104 void AnimationEnded(const gfx::Animation* animation) override; | 104 void AnimationEnded(const gfx::Animation* animation) override; |
105 void AnimationProgressed(const gfx::Animation* animation) override; | 105 void AnimationProgressed(const gfx::Animation* animation) override; |
106 | 106 |
107 private: | 107 private: |
108 friend class FrameCaptionButtonContainerViewTest; | 108 friend class FrameCaptionButtonContainerViewTest; |
109 | 109 |
110 // Sets |button|'s icon to |icon|. If |animate| is ANIMATE_YES, the button | 110 // Sets |button|'s icon to |icon|. If |animate| is ANIMATE_YES, the button |
111 // will crossfade to the new icon. If |animate| is ANIMATE_NO and | 111 // will crossfade to the new icon. If |animate| is ANIMATE_NO and |
112 // |icon| == |button|->icon(), the crossfade animation is progressed to the | 112 // |icon| == |button|->icon(), the crossfade animation is progressed to the |
113 // end. | 113 // end. |
114 void SetButtonIcon(FrameCaptionButton* button, | 114 void SetButtonIcon(FrameCaptionButton* button, |
115 CaptionButtonIcon icon, | 115 CaptionButtonIcon icon, |
116 Animate animate); | 116 Animate animate); |
117 | 117 |
118 // Returns true if maximize mode is not enabled, and |frame_| widget delegate | 118 // Returns true if tablet mode is not enabled, and |frame_| widget delegate |
119 // can be maximized. | 119 // can be maximized. |
120 bool ShouldSizeButtonBeVisible() const; | 120 bool ShouldSizeButtonBeVisible() const; |
121 | 121 |
122 // views::ButtonListener: | 122 // views::ButtonListener: |
123 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 123 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
124 | 124 |
125 // FrameSizeButtonDelegate: | 125 // FrameSizeButtonDelegate: |
126 bool IsMinimizeButtonVisible() const override; | 126 bool IsMinimizeButtonVisible() const override; |
127 void SetButtonsToNormal(Animate animate) override; | 127 void SetButtonsToNormal(Animate animate) override; |
128 void SetButtonIcons(CaptionButtonIcon minimize_button_icon, | 128 void SetButtonIcons(CaptionButtonIcon minimize_button_icon, |
(...skipping 12 matching lines...) Expand all Loading... |
141 FrameCaptionButton* minimize_button_; | 141 FrameCaptionButton* minimize_button_; |
142 FrameCaptionButton* size_button_; | 142 FrameCaptionButton* size_button_; |
143 FrameCaptionButton* close_button_; | 143 FrameCaptionButton* close_button_; |
144 | 144 |
145 // Mapping of the image needed to paint a button for each of the values of | 145 // Mapping of the image needed to paint a button for each of the values of |
146 // CaptionButtonIcon. | 146 // CaptionButtonIcon. |
147 std::map<CaptionButtonIcon, const gfx::VectorIcon*> button_icon_map_; | 147 std::map<CaptionButtonIcon, const gfx::VectorIcon*> button_icon_map_; |
148 | 148 |
149 // Animation that affects the position of |minimize_button_| and the | 149 // Animation that affects the position of |minimize_button_| and the |
150 // visibility of |size_button_|. | 150 // visibility of |size_button_|. |
151 std::unique_ptr<gfx::SlideAnimation> maximize_mode_animation_; | 151 std::unique_ptr<gfx::SlideAnimation> tablet_mode_animation_; |
152 | 152 |
153 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); | 153 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace ash | 156 } // namespace ash |
157 | 157 |
158 #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 |