| 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_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 5 #ifndef ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
| 6 #define ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 6 #define ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/wm/caption_buttons/alternate_frame_size_button_delegate.h" | 9 #include "ash/wm/caption_buttons/alternate_frame_size_button_delegate.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Returns the size button if using the old caption button style, returns NULL | 70 // Returns the size button if using the old caption button style, returns NULL |
| 71 // otherwise. | 71 // otherwise. |
| 72 FrameMaximizeButton* GetOldStyleSizeButton(); | 72 FrameMaximizeButton* GetOldStyleSizeButton(); |
| 73 | 73 |
| 74 // Sets the resource ids of the images to paint the button for |icon|. The | 74 // Sets the resource ids of the images to paint the button for |icon|. The |
| 75 // FrameCaptionButtonContainerView will keep track of the images to use for | 75 // FrameCaptionButtonContainerView will keep track of the images to use for |
| 76 // |icon| even if none of the buttons currently use |icon|. | 76 // |icon| even if none of the buttons currently use |icon|. |
| 77 void SetButtonImages(CaptionButtonIcon icon, | 77 void SetButtonImages(CaptionButtonIcon icon, |
| 78 int normal_image_id, | 78 int icon_image_id, |
| 79 int hovered_image_id, | 79 int inactive_icon_image_id, |
| 80 int pressed_image_id); | 80 int hovered_background_image_id, |
| 81 int pressed_background_image_id); |
| 82 |
| 83 // Sets whether the buttons should be painted as active. Does not schedule |
| 84 // a repaint. |
| 85 void SetPaintAsActive(bool paint_as_active); |
| 81 | 86 |
| 82 // Tell the window controls to reset themselves to the normal state. | 87 // Tell the window controls to reset themselves to the normal state. |
| 83 void ResetWindowControls(); | 88 void ResetWindowControls(); |
| 84 | 89 |
| 85 // Determines the window HT* code for the caption button at |point|. Returns | 90 // 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 | 91 // HTNOWHERE if |point| is not over any of the caption buttons. |point| must |
| 87 // be in the coordinates of the FrameCaptionButtonContainerView. | 92 // be in the coordinates of the FrameCaptionButtonContainerView. |
| 88 int NonClientHitTest(const gfx::Point& point) const; | 93 int NonClientHitTest(const gfx::Point& point) const; |
| 89 | 94 |
| 90 // views::View overrides: | 95 // views::View overrides: |
| 91 virtual gfx::Size GetPreferredSize() OVERRIDE; | 96 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 92 virtual void Layout() OVERRIDE; | 97 virtual void Layout() OVERRIDE; |
| 93 virtual const char* GetClassName() const OVERRIDE; | 98 virtual const char* GetClassName() const OVERRIDE; |
| 94 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 95 | 99 |
| 96 private: | 100 private: |
| 97 friend class FrameCaptionButtonContainerViewTest; | 101 friend class FrameCaptionButtonContainerViewTest; |
| 98 | 102 |
| 99 struct ButtonIconIds { | 103 struct ButtonIconIds { |
| 100 ButtonIconIds(); | 104 ButtonIconIds(); |
| 101 ButtonIconIds(int normal_id, int hovered_id, int pressed_id); | 105 ButtonIconIds(int icon_id, |
| 106 int inactive_icon_id, |
| 107 int hovered_background_id, |
| 108 int pressed_background_id); |
| 102 ~ButtonIconIds(); | 109 ~ButtonIconIds(); |
| 103 | 110 |
| 104 int normal_image_id; | 111 int icon_image_id; |
| 105 int hovered_image_id; | 112 int inactive_icon_image_id; |
| 106 int pressed_image_id; | 113 int hovered_background_image_id; |
| 114 int pressed_background_image_id; |
| 107 }; | 115 }; |
| 108 | 116 |
| 109 // Sets |button|'s icon to |icon|. The button will crossfade to the new icon | 117 // Sets |button|'s icon to |icon|. The button will crossfade to the new icon |
| 110 // if |animate| is ANIMATE_YES. | 118 // if |animate| is ANIMATE_YES. |
| 111 void SetButtonIcon(FrameCaptionButton* button, | 119 void SetButtonIcon(FrameCaptionButton* button, |
| 112 CaptionButtonIcon icon, | 120 CaptionButtonIcon icon, |
| 113 Animate animate); | 121 Animate animate); |
| 114 | 122 |
| 115 // views::ButtonListener override: | 123 // views::ButtonListener override: |
| 116 virtual void ButtonPressed(views::Button* sender, | 124 virtual void ButtonPressed(views::Button* sender, |
| 117 const ui::Event& event) OVERRIDE; | 125 const ui::Event& event) OVERRIDE; |
| 118 | 126 |
| 119 // AlternateFrameSizeButton::Delegate overrides: | 127 // AlternateFrameSizeButton::Delegate overrides: |
| 120 virtual bool IsMinimizeButtonVisible() const OVERRIDE; | 128 virtual bool IsMinimizeButtonVisible() const OVERRIDE; |
| 121 virtual void SetButtonsToNormal(Animate animate) OVERRIDE; | 129 virtual void SetButtonsToNormal(Animate animate) OVERRIDE; |
| 122 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, | 130 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, |
| 123 CaptionButtonIcon close_button_icon, | 131 CaptionButtonIcon close_button_icon, |
| 124 Animate animate) OVERRIDE; | 132 Animate animate) OVERRIDE; |
| 125 virtual const FrameCaptionButton* PressButtonAt( | 133 virtual const FrameCaptionButton* PressButtonAt( |
| 126 const gfx::Point& position_in_screen, | 134 const gfx::Point& position_in_screen, |
| 127 const gfx::Insets& pressed_hittest_outer_insets) const OVERRIDE; | 135 const gfx::Insets& pressed_hittest_outer_insets) const OVERRIDE; |
| 128 | 136 |
| 129 // The widget that the buttons act on. | 137 // The widget that the buttons act on. |
| 130 views::Widget* frame_; | 138 views::Widget* frame_; |
| 131 | 139 |
| 132 // The close button separator. | |
| 133 gfx::ImageSkia button_separator_; | |
| 134 | |
| 135 // The buttons. In the normal button style, at most one of |minimize_button_| | 140 // The buttons. In the normal button style, at most one of |minimize_button_| |
| 136 // and |size_button_| is visible. | 141 // and |size_button_| is visible. |
| 137 FrameCaptionButton* minimize_button_; | 142 FrameCaptionButton* minimize_button_; |
| 138 FrameCaptionButton* size_button_; | 143 FrameCaptionButton* size_button_; |
| 139 FrameCaptionButton* close_button_; | 144 FrameCaptionButton* close_button_; |
| 140 | 145 |
| 141 // Mapping of the images needed to paint a button for each of the values of | 146 // Mapping of the images needed to paint a button for each of the values of |
| 142 // CaptionButtonIcon. | 147 // CaptionButtonIcon. |
| 143 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; | 148 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; |
| 144 | 149 |
| 145 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); | 150 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); |
| 146 }; | 151 }; |
| 147 | 152 |
| 148 } // namesapace ash | 153 } // namesapace ash |
| 149 | 154 |
| 150 #endif // ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 155 #endif // ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
| OLD | NEW |