Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AURA_WINDOW_H_ | |
| 6 #define AURA_WINDOW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/gfx/native_widget_types.h" | |
| 12 #include "ui/gfx/rect.h" | |
| 13 | |
| 14 class SkCanvas; | |
| 15 | |
| 16 namespace ui { | |
| 17 class Layer; | |
| 18 } | |
| 19 | |
| 20 namespace aura { | |
| 21 | |
| 22 class Desktop; | |
| 23 class WindowDelegate; | |
| 24 | |
| 25 // Aura window implementation. Interesting events are sent to the | |
| 26 // WindowDelegate. | |
| 27 class Window { | |
| 28 public: | |
| 29 enum Visibility { | |
| 30 // Don't display the window onscreen and don't let it receive mouse | |
| 31 // events. This is the default. | |
| 32 VISIBILITY_HIDDEN = 1, | |
| 33 | |
| 34 // Display the window and let it receive mouse events. | |
| 35 VISIBILITY_SHOWN = 2, | |
| 36 | |
| 37 // Display the window but prevent it from receiving mouse events. | |
| 38 VISIBILITY_SHOWN_NO_INPUT = 3, | |
| 39 }; | |
| 40 | |
| 41 explicit Window(Desktop* desktop); | |
| 42 ~Window(); | |
| 43 | |
| 44 void set_delegate(WindowDelegate* d) { delegate_ = d; } | |
| 45 | |
| 46 // Changes the visbility of the window. | |
| 47 void SetVisibility(Visibility visibility); | |
| 48 Visibility visibility() const { return visibility_; } | |
| 49 | |
| 50 // Changes the bounds of the window. | |
| 51 void SetBounds(const gfx::Rect& bounds, int anim_ms); | |
| 52 const gfx::Rect& bounds() const { return bounds_; } | |
| 53 | |
| 54 // Marks the window as needing to be painted. | |
| 55 void SchedulePaint(const gfx::Rect& bounds); | |
| 56 | |
| 57 // Sets the contents of the window. | |
| 58 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | |
| 59 | |
| 60 // If the window is visible its layer is drawn. | |
| 61 void Draw(); | |
| 62 | |
| 63 // If SchedulePaint has been invoked on the Window the delegate is notified. | |
| 64 void UpdateLayerCanvas(); | |
| 65 | |
| 66 private: | |
| 67 // The desktop we're in. | |
| 68 Desktop* desktop_; | |
| 69 | |
| 70 WindowDelegate* delegate_; | |
| 71 | |
| 72 Visibility visibility_; | |
| 73 | |
| 74 scoped_ptr<ui::Layer> layer_; | |
| 75 | |
| 76 // Union of regions passed to SchedulePaint. Cleaned when UpdateLayerCanvas is | |
| 77 // invoked. | |
| 78 gfx::Rect dirty_rect_; | |
| 79 | |
| 80 // If true UpdateLayerCanvas paints all. This is set when the window is first | |
| 81 // created to trigger painting the complete bounds. | |
| 82 bool needs_paint_all_; | |
| 83 | |
| 84 // Bounds of the window in the desktops coordinate system. | |
|
Daniel Erat
2011/07/28 23:00:37
s/desktops/desktop's/
| |
| 85 gfx::Rect bounds_; | |
| 86 | |
| 87 DISALLOW_COPY_AND_ASSIGN(Window); | |
| 88 }; | |
| 89 | |
| 90 } // namespace aura | |
| 91 | |
| 92 #endif // AURA_WINDOW_H_ | |
| OLD | NEW |