| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FRAME_PAINTER_H_ | 5 #ifndef ASH_WM_FRAME_PAINTER_H_ |
| 6 #define ASH_WM_FRAME_PAINTER_H_ | 6 #define ASH_WM_FRAME_PAINTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Opacity values for the window header in various states, from 0 to 255. | 47 // Opacity values for the window header in various states, from 0 to 255. |
| 48 static int kActiveWindowOpacity; | 48 static int kActiveWindowOpacity; |
| 49 static int kInactiveWindowOpacity; | 49 static int kInactiveWindowOpacity; |
| 50 static int kSoloWindowOpacity; | 50 static int kSoloWindowOpacity; |
| 51 | 51 |
| 52 enum HeaderMode { | 52 enum HeaderMode { |
| 53 ACTIVE, | 53 ACTIVE, |
| 54 INACTIVE | 54 INACTIVE |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // What happens when the |size_button_| is pressed. |
| 58 enum SizeButtonBehavior { |
| 59 SIZE_BUTTON_MINIMIZES, |
| 60 SIZE_BUTTON_MAXIMIZES |
| 61 }; |
| 62 |
| 57 FramePainter(); | 63 FramePainter(); |
| 58 virtual ~FramePainter(); | 64 virtual ~FramePainter(); |
| 59 | 65 |
| 60 // |frame| and buttons are used for layout and are not owned. | 66 // |frame| and buttons are used for layout and are not owned. |
| 61 void Init(views::Widget* frame, | 67 void Init(views::Widget* frame, |
| 62 views::View* window_icon, | 68 views::View* window_icon, |
| 63 views::ImageButton* maximize_button, | 69 views::ImageButton* size_button, |
| 64 views::ImageButton* close_button); | 70 views::ImageButton* close_button, |
| 71 SizeButtonBehavior behavior); |
| 65 | 72 |
| 66 // Helpers for views::NonClientFrameView implementations. | 73 // Helpers for views::NonClientFrameView implementations. |
| 67 gfx::Rect GetBoundsForClientView(int top_height, | 74 gfx::Rect GetBoundsForClientView(int top_height, |
| 68 const gfx::Rect& window_bounds) const; | 75 const gfx::Rect& window_bounds) const; |
| 69 gfx::Rect GetWindowBoundsForClientBounds( | 76 gfx::Rect GetWindowBoundsForClientBounds( |
| 70 int top_height, | 77 int top_height, |
| 71 const gfx::Rect& client_bounds) const; | 78 const gfx::Rect& client_bounds) const; |
| 72 int NonClientHitTest(views::NonClientFrameView* view, | 79 int NonClientHitTest(views::NonClientFrameView* view, |
| 73 const gfx::Point& point); | 80 const gfx::Point& point); |
| 74 gfx::Size GetMinimumSize(views::NonClientFrameView* view); | 81 gfx::Size GetMinimumSize(views::NonClientFrameView* view); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // default window container, in which case we should paint a transparent | 128 // default window container, in which case we should paint a transparent |
| 122 // window header. Does not count window |ignore|. Pass NULL for |ignore| | 129 // window header. Does not count window |ignore|. Pass NULL for |ignore| |
| 123 // to check all windows. | 130 // to check all windows. |
| 124 bool UseSoloWindowHeader(aura::Window* ignore) const; | 131 bool UseSoloWindowHeader(aura::Window* ignore) const; |
| 125 | 132 |
| 126 static std::set<FramePainter*>* instances_; | 133 static std::set<FramePainter*>* instances_; |
| 127 | 134 |
| 128 // Not owned | 135 // Not owned |
| 129 views::Widget* frame_; | 136 views::Widget* frame_; |
| 130 views::View* window_icon_; // May be NULL. | 137 views::View* window_icon_; // May be NULL. |
| 131 views::ImageButton* maximize_button_; | 138 views::ImageButton* size_button_; |
| 132 views::ImageButton* close_button_; | 139 views::ImageButton* close_button_; |
| 133 aura::Window* window_; | 140 aura::Window* window_; |
| 134 | 141 |
| 135 // Window frame header/caption parts. | 142 // Window frame header/caption parts. |
| 136 const SkBitmap* button_separator_; | 143 const SkBitmap* button_separator_; |
| 137 const SkBitmap* top_left_corner_; | 144 const SkBitmap* top_left_corner_; |
| 138 const SkBitmap* top_edge_; | 145 const SkBitmap* top_edge_; |
| 139 const SkBitmap* top_right_corner_; | 146 const SkBitmap* top_right_corner_; |
| 140 const SkBitmap* header_left_edge_; | 147 const SkBitmap* header_left_edge_; |
| 141 const SkBitmap* header_right_edge_; | 148 const SkBitmap* header_right_edge_; |
| 142 | 149 |
| 143 // Bitmap and opacity last used for painting header. | 150 // Bitmap and opacity last used for painting header. |
| 144 const SkBitmap* previous_theme_frame_; | 151 const SkBitmap* previous_theme_frame_; |
| 145 int previous_opacity_; | 152 int previous_opacity_; |
| 146 | 153 |
| 147 // Bitmap and opacity we are crossfading from. | 154 // Bitmap and opacity we are crossfading from. |
| 148 const SkBitmap* crossfade_theme_frame_; | 155 const SkBitmap* crossfade_theme_frame_; |
| 149 int crossfade_opacity_; | 156 int crossfade_opacity_; |
| 150 | 157 |
| 151 gfx::Rect header_frame_bounds_; | 158 gfx::Rect header_frame_bounds_; |
| 152 scoped_ptr<ui::SlideAnimation> crossfade_animation_; | 159 scoped_ptr<ui::SlideAnimation> crossfade_animation_; |
| 153 | 160 |
| 161 SizeButtonBehavior size_button_behavior_; |
| 162 |
| 154 DISALLOW_COPY_AND_ASSIGN(FramePainter); | 163 DISALLOW_COPY_AND_ASSIGN(FramePainter); |
| 155 }; | 164 }; |
| 156 | 165 |
| 157 } // namespace ash | 166 } // namespace ash |
| 158 | 167 |
| 159 #endif // ASH_WM_FRAME_PAINTER_H_ | 168 #endif // ASH_WM_FRAME_PAINTER_H_ |
| OLD | NEW |