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.
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"
25 // Aura window implementation. Interesting events are sent to the
30 // Don't display the window onscreen and don't let it receive mouse
31 // events. This is the default.
32 VISIBILITY_HIDDEN
= 1,
34 // Display the window and let it receive mouse events.
37 // Display the window but prevent it from receiving mouse events.
38 VISIBILITY_SHOWN_NO_INPUT
= 3,
41 explicit Window(Desktop
* desktop
);
44 void set_delegate(WindowDelegate
* d
) { delegate_
= d
; }
46 // Changes the visbility of the window.
47 void SetVisibility(Visibility visibility
);
48 Visibility
visibility() const { return visibility_
; }
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_
; }
54 // Marks the window as needing to be painted.
55 void SchedulePaint(const gfx::Rect
& bounds
);
57 // Sets the contents of the window.
58 void SetCanvas(const SkCanvas
& canvas
, const gfx::Point
& origin
);
60 // If the window is visible its layer is drawn.
63 // If SchedulePaint has been invoked on the Window the delegate is notified.
64 void UpdateLayerCanvas();
67 // The desktop we're in.
70 WindowDelegate
* delegate_
;
72 Visibility visibility_
;
74 scoped_ptr
<ui::Layer
> layer_
;
76 // Union of regions passed to SchedulePaint. Cleaned when UpdateLayerCanvas is
78 gfx::Rect dirty_rect_
;
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_
;
84 // Bounds of the window in the desktop's coordinate system.
87 DISALLOW_COPY_AND_ASSIGN(Window
);
92 #endif // AURA_WINDOW_H_