| 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 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" // OVERRIDE | 13 #include "base/compiler_specific.h" // OVERRIDE |
| 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/base/animation/animation_delegate.h" |
| 16 #include "ui/gfx/rect.h" |
| 14 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 15 | 18 |
| 16 class SkBitmap; | 19 class SkBitmap; |
| 17 namespace aura { | 20 namespace aura { |
| 18 class Window; | 21 class Window; |
| 19 } | 22 } |
| 20 namespace gfx { | 23 namespace gfx { |
| 21 class Canvas; | 24 class Canvas; |
| 22 class Font; | 25 class Font; |
| 23 class Rect; | |
| 24 class Point; | 26 class Point; |
| 25 class Size; | 27 class Size; |
| 26 } | 28 } |
| 29 namespace ui { |
| 30 class SlideAnimation; |
| 31 } |
| 27 namespace views { | 32 namespace views { |
| 28 class ImageButton; | 33 class ImageButton; |
| 29 class NonClientFrameView; | 34 class NonClientFrameView; |
| 30 class View; | 35 class View; |
| 31 class Widget; | 36 class Widget; |
| 32 } | 37 } |
| 33 | 38 |
| 34 namespace ash { | 39 namespace ash { |
| 35 | 40 |
| 36 // Helper class for painting window frames. Exists to share code between | 41 // Helper class for painting window frames. Exists to share code between |
| 37 // various implementations of views::NonClientFrameView. Canonical source of | 42 // various implementations of views::NonClientFrameView. Canonical source of |
| 38 // layout constants for Ash window frames. | 43 // layout constants for Ash window frames. |
| 39 class ASH_EXPORT FramePainter : public aura::WindowObserver { | 44 class ASH_EXPORT FramePainter : public aura::WindowObserver, |
| 45 public ui::AnimationDelegate { |
| 40 public: | 46 public: |
| 41 // 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. |
| 42 static int kActiveWindowOpacity; | 48 static int kActiveWindowOpacity; |
| 43 static int kInactiveWindowOpacity; | 49 static int kInactiveWindowOpacity; |
| 44 static int kSoloWindowOpacity; | 50 static int kSoloWindowOpacity; |
| 45 | 51 |
| 46 enum HeaderMode { | 52 enum HeaderMode { |
| 47 ACTIVE, | 53 ACTIVE, |
| 48 INACTIVE | 54 INACTIVE |
| 49 }; | 55 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Performs layout for the header based on whether we want the shorter | 97 // Performs layout for the header based on whether we want the shorter |
| 92 // |maximized_layout| appearance. | 98 // |maximized_layout| appearance. |
| 93 void LayoutHeader(views::NonClientFrameView* view, bool maximized_layout); | 99 void LayoutHeader(views::NonClientFrameView* view, bool maximized_layout); |
| 94 | 100 |
| 95 // aura::WindowObserver overrides: | 101 // aura::WindowObserver overrides: |
| 96 virtual void OnWindowPropertyChanged(aura::Window* window, | 102 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 97 const void* key, | 103 const void* key, |
| 98 intptr_t old) OVERRIDE; | 104 intptr_t old) OVERRIDE; |
| 99 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 105 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 100 | 106 |
| 107 // Overridden from ui::AnimationDelegate |
| 108 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 109 |
| 101 private: | 110 private: |
| 102 // Sets the images for a button base on IDs from the |frame_| theme provider. | 111 // Sets the images for a button base on IDs from the |frame_| theme provider. |
| 103 void SetButtonImages(views::ImageButton* button, | 112 void SetButtonImages(views::ImageButton* button, |
| 104 int normal_bitmap_id, | 113 int normal_bitmap_id, |
| 105 int hot_bitmap_id, | 114 int hot_bitmap_id, |
| 106 int pushed_bitmap_id); | 115 int pushed_bitmap_id); |
| 107 | 116 |
| 108 // Returns the offset between window left edge and title string. | 117 // Returns the offset between window left edge and title string. |
| 109 int GetTitleOffsetX() const; | 118 int GetTitleOffsetX() const; |
| 110 | 119 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 124 aura::Window* window_; | 133 aura::Window* window_; |
| 125 | 134 |
| 126 // Window frame header/caption parts. | 135 // Window frame header/caption parts. |
| 127 const SkBitmap* button_separator_; | 136 const SkBitmap* button_separator_; |
| 128 const SkBitmap* top_left_corner_; | 137 const SkBitmap* top_left_corner_; |
| 129 const SkBitmap* top_edge_; | 138 const SkBitmap* top_edge_; |
| 130 const SkBitmap* top_right_corner_; | 139 const SkBitmap* top_right_corner_; |
| 131 const SkBitmap* header_left_edge_; | 140 const SkBitmap* header_left_edge_; |
| 132 const SkBitmap* header_right_edge_; | 141 const SkBitmap* header_right_edge_; |
| 133 | 142 |
| 143 // Bitmap and opacity last used for painting header. |
| 144 const SkBitmap* previous_theme_frame_; |
| 145 int previous_opacity_; |
| 146 |
| 147 // Bitmap and opacity we are crossfading from. |
| 148 const SkBitmap* crossfade_theme_frame_; |
| 149 int crossfade_opacity_; |
| 150 |
| 151 gfx::Rect header_frame_bounds_; |
| 152 scoped_ptr<ui::SlideAnimation> crossfade_animation_; |
| 153 |
| 134 DISALLOW_COPY_AND_ASSIGN(FramePainter); | 154 DISALLOW_COPY_AND_ASSIGN(FramePainter); |
| 135 }; | 155 }; |
| 136 | 156 |
| 137 } // namespace ash | 157 } // namespace ash |
| 138 | 158 |
| 139 #endif // ASH_WM_FRAME_PAINTER_H_ | 159 #endif // ASH_WM_FRAME_PAINTER_H_ |
| OLD | NEW |