| 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_SHADOW_H_ | 5 #ifndef ASH_WM_SHADOW_H_ |
| 6 #define ASH_WM_SHADOW_H_ | 6 #define ASH_WM_SHADOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ui/gfx/compositor/layer_animation_observer.h" | 12 #include "ui/gfx/compositor/layer_animation_observer.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 namespace aura { | |
| 16 class Window; | |
| 17 } // namespace aura | |
| 18 | |
| 19 namespace ui { | 15 namespace ui { |
| 20 class Layer; | 16 class Layer; |
| 21 } // namespace ui | 17 } // namespace ui |
| 22 | 18 |
| 23 namespace ash { | 19 namespace ash { |
| 24 namespace internal { | 20 namespace internal { |
| 25 | 21 |
| 26 class ImageGrid; | 22 class ImageGrid; |
| 27 | 23 |
| 28 // Simple class that draws a drop shadow around content at given bounds. | 24 // Simple class that draws a drop shadow around content at given bounds. |
| 29 class ASH_EXPORT Shadow : public ui::ImplicitAnimationObserver { | 25 class ASH_EXPORT Shadow : public ui::ImplicitAnimationObserver { |
| 30 public: | 26 public: |
| 31 enum Style { | 27 enum Style { |
| 32 // Active windows have more opaque shadows, shifted down to make the window | 28 // Active windows have more opaque shadows, shifted down to make the window |
| 33 // appear "higher". | 29 // appear "higher". |
| 34 STYLE_ACTIVE, | 30 STYLE_ACTIVE, |
| 35 | 31 |
| 36 // Inactive windows have less opaque shadows. | 32 // Inactive windows have less opaque shadows. |
| 37 STYLE_INACTIVE, | 33 STYLE_INACTIVE, |
| 38 | 34 |
| 39 // Small windows like tooltips and context menus have lighter, smaller | 35 // Small windows like tooltips and context menus have lighter, smaller |
| 40 // shadows. | 36 // shadows. |
| 41 STYLE_SMALL, | 37 STYLE_SMALL, |
| 42 }; | 38 }; |
| 43 | 39 |
| 44 Shadow(); | 40 Shadow(); |
| 45 virtual ~Shadow(); | 41 virtual ~Shadow(); |
| 46 | 42 |
| 47 // |window| is a possibly-arbitrary window that is drawn at the same DPI | 43 void Init(Style style); |
| 48 // (i.e. on the same monitor) as this shadow. The actual bounds for the | |
| 49 // shadow still has to be provided through |SetContentBounds()|. | |
| 50 // TODO(oshima): move scale factor to gfx/compositor and remove this. | |
| 51 void Init(aura::Window* window, Style style); | |
| 52 | 44 |
| 53 // Returns |image_grid_|'s ui::Layer. This is exposed so it can be added to | 45 // Returns |image_grid_|'s ui::Layer. This is exposed so it can be added to |
| 54 // the same layer as the content and stacked below it. SetContentBounds() | 46 // the same layer as the content and stacked below it. SetContentBounds() |
| 55 // should be used to adjust the shadow's size and position (rather than | 47 // should be used to adjust the shadow's size and position (rather than |
| 56 // applying transformations to this layer). | 48 // applying transformations to this layer). |
| 57 ui::Layer* layer() const; | 49 ui::Layer* layer() const; |
| 58 | 50 |
| 59 const gfx::Rect& content_bounds() const { return content_bounds_; } | 51 const gfx::Rect& content_bounds() const { return content_bounds_; } |
| 60 Style style() const { return style_; } | 52 Style style() const { return style_; } |
| 61 | 53 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 84 // Bounds of the content that the shadow encloses. | 76 // Bounds of the content that the shadow encloses. |
| 85 gfx::Rect content_bounds_; | 77 gfx::Rect content_bounds_; |
| 86 | 78 |
| 87 DISALLOW_COPY_AND_ASSIGN(Shadow); | 79 DISALLOW_COPY_AND_ASSIGN(Shadow); |
| 88 }; | 80 }; |
| 89 | 81 |
| 90 } // namespace internal | 82 } // namespace internal |
| 91 } // namespace ash | 83 } // namespace ash |
| 92 | 84 |
| 93 #endif // ASH_WM_SHADOW_H_ | 85 #endif // ASH_WM_SHADOW_H_ |
| OLD | NEW |