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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // HTNOWHERE if |point| is not over any of the caption buttons. |point| must | 94 // HTNOWHERE if |point| is not over any of the caption buttons. |point| must |
95 // be in the coordinates of the FrameCaptionButtonContainerView. | 95 // be in the coordinates of the FrameCaptionButtonContainerView. |
96 int NonClientHitTest(const gfx::Point& point) const; | 96 int NonClientHitTest(const gfx::Point& point) const; |
97 | 97 |
98 // Updates the size button's visibility based on whether |frame_| can be | 98 // Updates the size button's visibility based on whether |frame_| can be |
99 // maximized and if maximize mode is enabled. A parent view should relayout | 99 // maximized and if maximize mode is enabled. A parent view should relayout |
100 // to reflect the change in visibility. | 100 // to reflect the change in visibility. |
101 void UpdateSizeButtonVisibility(); | 101 void UpdateSizeButtonVisibility(); |
102 | 102 |
103 // views::View: | 103 // views::View: |
104 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 104 virtual gfx::Size GetPreferredSize() const override; |
105 virtual void Layout() OVERRIDE; | 105 virtual void Layout() override; |
106 virtual const char* GetClassName() const OVERRIDE; | 106 virtual const char* GetClassName() const override; |
107 | 107 |
108 // Overridden from gfx::AnimationDelegate: | 108 // Overridden from gfx::AnimationDelegate: |
109 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 109 virtual void AnimationEnded(const gfx::Animation* animation) override; |
110 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 110 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
111 | 111 |
112 private: | 112 private: |
113 friend class FrameCaptionButtonContainerViewTest; | 113 friend class FrameCaptionButtonContainerViewTest; |
114 | 114 |
115 struct ButtonIconIds { | 115 struct ButtonIconIds { |
116 ButtonIconIds(); | 116 ButtonIconIds(); |
117 ButtonIconIds(int icon_id, | 117 ButtonIconIds(int icon_id, |
118 int inactive_icon_id, | 118 int inactive_icon_id, |
119 int hovered_background_id, | 119 int hovered_background_id, |
120 int pressed_background_id); | 120 int pressed_background_id); |
(...skipping 12 matching lines...) Expand all Loading... |
133 void SetButtonIcon(FrameCaptionButton* button, | 133 void SetButtonIcon(FrameCaptionButton* button, |
134 CaptionButtonIcon icon, | 134 CaptionButtonIcon icon, |
135 Animate animate); | 135 Animate animate); |
136 | 136 |
137 // Returns true if maximize mode is not enabled, and |frame_| widget delegate | 137 // Returns true if maximize mode is not enabled, and |frame_| widget delegate |
138 // can be maximized. | 138 // can be maximized. |
139 bool ShouldSizeButtonBeVisible() const; | 139 bool ShouldSizeButtonBeVisible() const; |
140 | 140 |
141 // views::ButtonListener: | 141 // views::ButtonListener: |
142 virtual void ButtonPressed(views::Button* sender, | 142 virtual void ButtonPressed(views::Button* sender, |
143 const ui::Event& event) OVERRIDE; | 143 const ui::Event& event) override; |
144 | 144 |
145 // FrameSizeButtonDelegate: | 145 // FrameSizeButtonDelegate: |
146 virtual bool IsMinimizeButtonVisible() const OVERRIDE; | 146 virtual bool IsMinimizeButtonVisible() const override; |
147 virtual void SetButtonsToNormal(Animate animate) OVERRIDE; | 147 virtual void SetButtonsToNormal(Animate animate) override; |
148 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, | 148 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, |
149 CaptionButtonIcon close_button_icon, | 149 CaptionButtonIcon close_button_icon, |
150 Animate animate) OVERRIDE; | 150 Animate animate) override; |
151 virtual const FrameCaptionButton* GetButtonClosestTo( | 151 virtual const FrameCaptionButton* GetButtonClosestTo( |
152 const gfx::Point& position_in_screen) const OVERRIDE; | 152 const gfx::Point& position_in_screen) const override; |
153 virtual void SetHoveredAndPressedButtons( | 153 virtual void SetHoveredAndPressedButtons( |
154 const FrameCaptionButton* to_hover, | 154 const FrameCaptionButton* to_hover, |
155 const FrameCaptionButton* to_press) OVERRIDE; | 155 const FrameCaptionButton* to_press) override; |
156 | 156 |
157 // The widget that the buttons act on. | 157 // The widget that the buttons act on. |
158 views::Widget* frame_; | 158 views::Widget* frame_; |
159 | 159 |
160 // The buttons. In the normal button style, at most one of |minimize_button_| | 160 // The buttons. In the normal button style, at most one of |minimize_button_| |
161 // and |size_button_| is visible. | 161 // and |size_button_| is visible. |
162 FrameCaptionButton* minimize_button_; | 162 FrameCaptionButton* minimize_button_; |
163 FrameCaptionButton* size_button_; | 163 FrameCaptionButton* size_button_; |
164 FrameCaptionButton* close_button_; | 164 FrameCaptionButton* close_button_; |
165 | 165 |
166 // Mapping of the images needed to paint a button for each of the values of | 166 // Mapping of the images needed to paint a button for each of the values of |
167 // CaptionButtonIcon. | 167 // CaptionButtonIcon. |
168 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; | 168 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; |
169 | 169 |
170 // Animation that affects the position of |minimize_button_| and the | 170 // Animation that affects the position of |minimize_button_| and the |
171 // visibility of |size_button_|. | 171 // visibility of |size_button_|. |
172 scoped_ptr<gfx::SlideAnimation> maximize_mode_animation_; | 172 scoped_ptr<gfx::SlideAnimation> maximize_mode_animation_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); | 174 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace ash | 177 } // namespace ash |
178 | 178 |
179 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 179 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
OLD | NEW |