| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 UI_AURA_WINDOW_H_ | 5 #ifndef UI_AURA_WINDOW_H_ |
| 6 #define UI_AURA_WINDOW_H_ | 6 #define UI_AURA_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace internal { | 34 namespace internal { |
| 35 class FocusManager; | 35 class FocusManager; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Aura window implementation. Interesting events are sent to the | 38 // Aura window implementation. Interesting events are sent to the |
| 39 // WindowDelegate. | 39 // WindowDelegate. |
| 40 // TODO(beng): resolve ownership. | 40 // TODO(beng): resolve ownership. |
| 41 class AURA_EXPORT Window : public ui::LayerDelegate { | 41 class AURA_EXPORT Window : public ui::LayerDelegate { |
| 42 public: | 42 public: |
| 43 typedef std::vector<Window*> Windows; |
| 44 |
| 43 enum Visibility { | 45 enum Visibility { |
| 44 // Don't display the window onscreen and don't let it receive mouse | 46 // Don't display the window onscreen and don't let it receive mouse |
| 45 // events. This is the default. | 47 // events. This is the default. |
| 46 VISIBILITY_HIDDEN = 1, | 48 VISIBILITY_HIDDEN = 1, |
| 47 | 49 |
| 48 // Display the window and let it receive mouse events. | 50 // Display the window and let it receive mouse events. |
| 49 VISIBILITY_SHOWN = 2, | 51 VISIBILITY_SHOWN = 2, |
| 50 | 52 |
| 51 // Display the window but prevent it from receiving mouse events. | 53 // Display the window but prevent it from receiving mouse events. |
| 52 VISIBILITY_SHOWN_NO_INPUT = 3, | 54 VISIBILITY_SHOWN_NO_INPUT = 3, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Move the specified child of this Window to the front of the z-order. | 97 // Move the specified child of this Window to the front of the z-order. |
| 96 // TODO(beng): this is (obviously) feeble. | 98 // TODO(beng): this is (obviously) feeble. |
| 97 void MoveChildToFront(Window* child); | 99 void MoveChildToFront(Window* child); |
| 98 | 100 |
| 99 // Tree operations. | 101 // Tree operations. |
| 100 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 102 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
| 101 // should change this. | 103 // should change this. |
| 102 void AddChild(Window* child); | 104 void AddChild(Window* child); |
| 103 void RemoveChild(Window* child); | 105 void RemoveChild(Window* child); |
| 104 | 106 |
| 107 const Windows& children() const { return children_; } |
| 108 |
| 105 static void ConvertPointToWindow(Window* source, | 109 static void ConvertPointToWindow(Window* source, |
| 106 Window* target, | 110 Window* target, |
| 107 gfx::Point* point); | 111 gfx::Point* point); |
| 108 | 112 |
| 109 // Window takes ownership of the EventFilter. | 113 // Window takes ownership of the EventFilter. |
| 110 void SetEventFilter(EventFilter* event_filter); | 114 void SetEventFilter(EventFilter* event_filter); |
| 111 | 115 |
| 112 // Handles a mouse event. Returns true if handled. | 116 // Handles a mouse event. Returns true if handled. |
| 113 bool OnMouseEvent(MouseEvent* event); | 117 bool OnMouseEvent(MouseEvent* event); |
| 114 | 118 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 | 134 |
| 131 // Returns the FocusManager for the Window, which may be attached to a parent | 135 // Returns the FocusManager for the Window, which may be attached to a parent |
| 132 // Window. Can return NULL if the Window has no FocusManager. | 136 // Window. Can return NULL if the Window has no FocusManager. |
| 133 virtual internal::FocusManager* GetFocusManager(); | 137 virtual internal::FocusManager* GetFocusManager(); |
| 134 | 138 |
| 135 // The Window does not own this object. | 139 // The Window does not own this object. |
| 136 void set_user_data(void* user_data) { user_data_ = user_data; } | 140 void set_user_data(void* user_data) { user_data_ = user_data; } |
| 137 void* user_data() const { return user_data_; } | 141 void* user_data() const { return user_data_; } |
| 138 | 142 |
| 139 private: | 143 private: |
| 140 typedef std::vector<Window*> Windows; | |
| 141 | |
| 142 // If SchedulePaint has been invoked on the Window the delegate is notified. | 144 // If SchedulePaint has been invoked on the Window the delegate is notified. |
| 143 void UpdateLayerCanvas(); | 145 void UpdateLayerCanvas(); |
| 144 | 146 |
| 145 // Schedules a paint for the Window's entire bounds. | 147 // Schedules a paint for the Window's entire bounds. |
| 146 void SchedulePaint(); | 148 void SchedulePaint(); |
| 147 | 149 |
| 148 // Overridden from ui::LayerDelegate: | 150 // Overridden from ui::LayerDelegate: |
| 149 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 151 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 150 | 152 |
| 151 WindowDelegate* delegate_; | 153 WindowDelegate* delegate_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 171 scoped_ptr<LayoutManager> layout_manager_; | 173 scoped_ptr<LayoutManager> layout_manager_; |
| 172 | 174 |
| 173 void* user_data_; | 175 void* user_data_; |
| 174 | 176 |
| 175 DISALLOW_COPY_AND_ASSIGN(Window); | 177 DISALLOW_COPY_AND_ASSIGN(Window); |
| 176 }; | 178 }; |
| 177 | 179 |
| 178 } // namespace aura | 180 } // namespace aura |
| 179 | 181 |
| 180 #endif // UI_AURA_WINDOW_H_ | 182 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |