| 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 <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Claims or relinquishes the claim to focus. | 213 // Claims or relinquishes the claim to focus. |
| 214 void Focus(); | 214 void Focus(); |
| 215 void Blur(); | 215 void Blur(); |
| 216 | 216 |
| 217 // Returns true if the Window is currently the focused window. | 217 // Returns true if the Window is currently the focused window. |
| 218 bool HasFocus() const; | 218 bool HasFocus() const; |
| 219 | 219 |
| 220 // Returns true if the Window can be focused. | 220 // Returns true if the Window can be focused. |
| 221 virtual bool CanFocus() const; | 221 virtual bool CanFocus() const; |
| 222 | 222 |
| 223 // Returns true if the Window can receive events. |
| 224 virtual bool CanReceiveEvents() const; |
| 225 |
| 223 // Returns the FocusManager for the Window, which may be attached to a parent | 226 // Returns the FocusManager for the Window, which may be attached to a parent |
| 224 // Window. Can return NULL if the Window has no FocusManager. | 227 // Window. Can return NULL if the Window has no FocusManager. |
| 225 virtual internal::FocusManager* GetFocusManager(); | 228 virtual internal::FocusManager* GetFocusManager(); |
| 226 virtual const internal::FocusManager* GetFocusManager() const; | 229 virtual const internal::FocusManager* GetFocusManager() const; |
| 227 | 230 |
| 228 // Does a mouse capture on the window. This does nothing if the window isn't | 231 // Does a mouse capture on the window. This does nothing if the window isn't |
| 229 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. | 232 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. |
| 230 void SetCapture(); | 233 void SetCapture(); |
| 231 | 234 |
| 232 // Releases a mouse capture. | 235 // Releases a mouse capture. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 243 void SetIntProperty(const char* name, int value); | 246 void SetIntProperty(const char* name, int value); |
| 244 | 247 |
| 245 // Returns the window property for given |name|. Returns NULL or 0 if | 248 // Returns the window property for given |name|. Returns NULL or 0 if |
| 246 // the property does not exist. | 249 // the property does not exist. |
| 247 // TODO(oshima): Returning 0 for non existing property is problematic. | 250 // TODO(oshima): Returning 0 for non existing property is problematic. |
| 248 // Fix ViewProp to be able to tell if the property exists and | 251 // Fix ViewProp to be able to tell if the property exists and |
| 249 // change it to -1. | 252 // change it to -1. |
| 250 void* GetProperty(const char* name) const; | 253 void* GetProperty(const char* name) const; |
| 251 int GetIntProperty(const char* name) const; | 254 int GetIntProperty(const char* name) const; |
| 252 | 255 |
| 256 // Returns true if this window is currently stopping event |
| 257 // propagation for any windows behind it in the z-order. |
| 258 bool StopsEventPropagation() const; |
| 259 |
| 253 protected: | 260 protected: |
| 254 // Returns the root window or NULL if we aren't yet attached to the root | 261 // Returns the root window or NULL if we aren't yet attached to the root |
| 255 // window. | 262 // window. |
| 256 virtual RootWindow* GetRootWindow(); | 263 virtual RootWindow* GetRootWindow(); |
| 257 | 264 |
| 258 // Called when the |window| is detached from the root window by being removed | 265 // Called when the |window| is detached from the root window by being removed |
| 259 // from its parent. | 266 // from its parent. |
| 260 virtual void WindowDetachedFromRootWindow(aura::Window* window); | 267 virtual void WindowDetachedFromRootWindow(aura::Window* window); |
| 261 | 268 |
| 262 private: | 269 private: |
| 263 friend class LayoutManager; | 270 friend class LayoutManager; |
| 264 | 271 |
| 265 // Changes the bounds of the window without condition. | 272 // Changes the bounds of the window without condition. |
| 266 void SetBoundsInternal(const gfx::Rect& new_bounds); | 273 void SetBoundsInternal(const gfx::Rect& new_bounds); |
| 267 | 274 |
| 268 // Updates the visible state of the layer, but does not make visible-state | 275 // Updates the visible state of the layer, but does not make visible-state |
| 269 // specific changes. Called from Show()/Hide(). | 276 // specific changes. Called from Show()/Hide(). |
| 270 void SetVisible(bool visible); | 277 void SetVisible(bool visible); |
| 271 | 278 |
| 272 // Schedules a paint for the Window's entire bounds. | 279 // Schedules a paint for the Window's entire bounds. |
| 273 void SchedulePaint(); | 280 void SchedulePaint(); |
| 274 | 281 |
| 275 // This window is currently stopping event propagation for any windows behind | |
| 276 // it in the z-order. | |
| 277 bool StopsEventPropagation() const; | |
| 278 | |
| 279 // Gets a Window (either this one or a subwindow) containing |local_point|. | 282 // Gets a Window (either this one or a subwindow) containing |local_point|. |
| 280 // If |return_tightest| is true, returns the tightest-containing (i.e. | 283 // If |return_tightest| is true, returns the tightest-containing (i.e. |
| 281 // furthest down the hierarchy) Window containing the point; otherwise, | 284 // furthest down the hierarchy) Window containing the point; otherwise, |
| 282 // returns the loosest. If |for_event_handling| is true, then hit-test masks | 285 // returns the loosest. If |for_event_handling| is true, then hit-test masks |
| 283 // and StopsEventPropagation() are honored; otherwise, only bounds checks are | 286 // and StopsEventPropagation() are honored; otherwise, only bounds checks are |
| 284 // performed. | 287 // performed. |
| 285 Window* GetWindowForPoint(const gfx::Point& local_point, | 288 Window* GetWindowForPoint(const gfx::Point& local_point, |
| 286 bool return_tightest, | 289 bool return_tightest, |
| 287 bool for_event_handling); | 290 bool for_event_handling); |
| 288 | 291 |
| 289 // Called when this window's parent has changed. | 292 // Called when this window's parent has changed. |
| 290 void OnParentChanged(); | 293 void OnParentChanged(); |
| 291 | 294 |
| 292 // Called when this window's stacking order among its siblings is changed. | 295 // Called when this window's stacking order among its siblings is changed. |
| 293 void OnStackingChanged(); | 296 void OnStackingChanged(); |
| 294 | 297 |
| 295 // Overridden from ui::LayerDelegate: | 298 // Overridden from ui::LayerDelegate: |
| 296 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 299 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 297 | 300 |
| 298 // Updates the layer name with a name based on the window's name and id. | 301 // Updates the layer name with a name based on the window's name and id. |
| 299 void UpdateLayerName(const std::string& name); | 302 void UpdateLayerName(const std::string& name); |
| 300 | 303 |
| 304 // Returns true if this window is behind a window that stops event |
| 305 // propagation. |
| 306 bool IsBehindStopEventsWindow() const; |
| 307 |
| 301 client::WindowType type_; | 308 client::WindowType type_; |
| 302 | 309 |
| 303 WindowDelegate* delegate_; | 310 WindowDelegate* delegate_; |
| 304 | 311 |
| 305 scoped_ptr<ui::Layer> layer_; | 312 scoped_ptr<ui::Layer> layer_; |
| 306 | 313 |
| 307 // The Window's parent. | 314 // The Window's parent. |
| 308 Window* parent_; | 315 Window* parent_; |
| 309 | 316 |
| 310 // Child windows. Topmost is last. | 317 // Child windows. Topmost is last. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 340 // TODO(oshima): Consolidcate ViewProp and aura::window property | 347 // TODO(oshima): Consolidcate ViewProp and aura::window property |
| 341 // implementation. | 348 // implementation. |
| 342 std::map<const char*, void*> prop_map_; | 349 std::map<const char*, void*> prop_map_; |
| 343 | 350 |
| 344 DISALLOW_COPY_AND_ASSIGN(Window); | 351 DISALLOW_COPY_AND_ASSIGN(Window); |
| 345 }; | 352 }; |
| 346 | 353 |
| 347 } // namespace aura | 354 } // namespace aura |
| 348 | 355 |
| 349 #endif // UI_AURA_WINDOW_H_ | 356 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |