| 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 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 gfx::NativeCursor GetCursor(const gfx::Point& point) const; | 211 gfx::NativeCursor GetCursor(const gfx::Point& point) const; |
| 212 | 212 |
| 213 // Window takes ownership of the EventFilter. | 213 // Window takes ownership of the EventFilter. |
| 214 void SetEventFilter(EventFilter* event_filter); | 214 void SetEventFilter(EventFilter* event_filter); |
| 215 EventFilter* event_filter() { return event_filter_.get(); } | 215 EventFilter* event_filter() { return event_filter_.get(); } |
| 216 | 216 |
| 217 // Add/remove observer. | 217 // Add/remove observer. |
| 218 void AddObserver(WindowObserver* observer); | 218 void AddObserver(WindowObserver* observer); |
| 219 void RemoveObserver(WindowObserver* observer); | 219 void RemoveObserver(WindowObserver* observer); |
| 220 | 220 |
| 221 // When set to true, this Window will stop propagation of all events targeted | |
| 222 // at Windows below it in the z-order, but only if this Window has children. | |
| 223 // This is used to implement lock-screen type functionality where we do not | |
| 224 // want events to be sent to running logged-in windows when the lock screen is | |
| 225 // displayed. | |
| 226 void set_stops_event_propagation(bool stops_event_propagation) { | |
| 227 stops_event_propagation_ = stops_event_propagation; | |
| 228 } | |
| 229 | |
| 230 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } | 221 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } |
| 231 | 222 |
| 232 // Sets the window to grab hits for an area extending |outer| pixels outside | 223 // Sets the window to grab hits for an area extending |outer| pixels outside |
| 233 // its bounds and |inner| pixels inside its bounds (even if that inner region | 224 // its bounds and |inner| pixels inside its bounds (even if that inner region |
| 234 // overlaps a child window). This can be used to create an invisible non- | 225 // overlaps a child window). This can be used to create an invisible non- |
| 235 // client area, for example if your windows have no visible frames but still | 226 // client area, for example if your windows have no visible frames but still |
| 236 // need to have resize edges. Both |outer| and |inner| must be >= 0. | 227 // need to have resize edges. Both |outer| and |inner| must be >= 0. |
| 237 void SetHitTestBoundsOverride(int outer, int inner); | 228 void SetHitTestBoundsOverride(int outer, int inner); |
| 238 | 229 |
| 239 // Returns the hit test bounds override set above. | 230 // Returns the hit test bounds override set above. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Does a mouse capture on the window. This does nothing if the window isn't | 278 // Does a mouse capture on the window. This does nothing if the window isn't |
| 288 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. | 279 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. |
| 289 void SetCapture(); | 280 void SetCapture(); |
| 290 | 281 |
| 291 // Releases a mouse capture. | 282 // Releases a mouse capture. |
| 292 void ReleaseCapture(); | 283 void ReleaseCapture(); |
| 293 | 284 |
| 294 // Returns true if this window has a mouse capture. | 285 // Returns true if this window has a mouse capture. |
| 295 bool HasCapture(); | 286 bool HasCapture(); |
| 296 | 287 |
| 297 // Returns true if this window is currently stopping event | |
| 298 // propagation for any windows behind it in the z-order. | |
| 299 bool StopsEventPropagation() const; | |
| 300 | |
| 301 // Suppresses painting window content by disgarding damaged rect and ignoring | 288 // Suppresses painting window content by disgarding damaged rect and ignoring |
| 302 // new paint requests. | 289 // new paint requests. |
| 303 void SuppressPaint(); | 290 void SuppressPaint(); |
| 304 | 291 |
| 305 // Sets the |value| of the given window |property|. Setting to the default | 292 // Sets the |value| of the given window |property|. Setting to the default |
| 306 // value (e.g., NULL) removes the property. The caller is responsible for the | 293 // value (e.g., NULL) removes the property. The caller is responsible for the |
| 307 // lifetime of any object set as a property on the Window. | 294 // lifetime of any object set as a property on the Window. |
| 308 template<typename T> | 295 template<typename T> |
| 309 void SetProperty(const WindowProperty<T>* property, T value); | 296 void SetProperty(const WindowProperty<T>* property, T value); |
| 310 | 297 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // specific changes. Called from Show()/Hide(). | 338 // specific changes. Called from Show()/Hide(). |
| 352 void SetVisible(bool visible); | 339 void SetVisible(bool visible); |
| 353 | 340 |
| 354 // Schedules a paint for the Window's entire bounds. | 341 // Schedules a paint for the Window's entire bounds. |
| 355 void SchedulePaint(); | 342 void SchedulePaint(); |
| 356 | 343 |
| 357 // Gets a Window (either this one or a subwindow) containing |local_point|. | 344 // Gets a Window (either this one or a subwindow) containing |local_point|. |
| 358 // If |return_tightest| is true, returns the tightest-containing (i.e. | 345 // If |return_tightest| is true, returns the tightest-containing (i.e. |
| 359 // furthest down the hierarchy) Window containing the point; otherwise, | 346 // furthest down the hierarchy) Window containing the point; otherwise, |
| 360 // returns the loosest. If |for_event_handling| is true, then hit-test masks | 347 // returns the loosest. If |for_event_handling| is true, then hit-test masks |
| 361 // and StopsEventPropagation() are honored; otherwise, only bounds checks are | 348 // are honored; otherwise, only bounds checks are performed. |
| 362 // performed. | |
| 363 Window* GetWindowForPoint(const gfx::Point& local_point, | 349 Window* GetWindowForPoint(const gfx::Point& local_point, |
| 364 bool return_tightest, | 350 bool return_tightest, |
| 365 bool for_event_handling); | 351 bool for_event_handling); |
| 366 | 352 |
| 367 // Called when this window's parent has changed. | 353 // Called when this window's parent has changed. |
| 368 void OnParentChanged(); | 354 void OnParentChanged(); |
| 369 | 355 |
| 370 // Determines the real location for stacking |child| and invokes | 356 // Determines the real location for stacking |child| and invokes |
| 371 // StackChildRelativeToImpl(). | 357 // StackChildRelativeToImpl(). |
| 372 void StackChildRelativeTo(Window* child, | 358 void StackChildRelativeTo(Window* child, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 385 // Window has been added or is about to be removed from a RootWindow. | 371 // Window has been added or is about to be removed from a RootWindow. |
| 386 void NotifyAddedToRootWindow(); | 372 void NotifyAddedToRootWindow(); |
| 387 void NotifyRemovingFromRootWindow(); | 373 void NotifyRemovingFromRootWindow(); |
| 388 | 374 |
| 389 // Overridden from ui::LayerDelegate: | 375 // Overridden from ui::LayerDelegate: |
| 390 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 376 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 391 | 377 |
| 392 // Updates the layer name with a name based on the window's name and id. | 378 // Updates the layer name with a name based on the window's name and id. |
| 393 void UpdateLayerName(const std::string& name); | 379 void UpdateLayerName(const std::string& name); |
| 394 | 380 |
| 395 // Returns true if this window is behind a window that stops event | |
| 396 // propagation. | |
| 397 bool IsBehindStopEventsWindow() const; | |
| 398 | |
| 399 client::WindowType type_; | 381 client::WindowType type_; |
| 400 | 382 |
| 401 WindowDelegate* delegate_; | 383 WindowDelegate* delegate_; |
| 402 | 384 |
| 403 // The Window will own its layer unless ownership is relinquished via a call | 385 // The Window will own its layer unless ownership is relinquished via a call |
| 404 // to AcquireLayer(). After that moment |layer_| will still be valid but | 386 // to AcquireLayer(). After that moment |layer_| will still be valid but |
| 405 // |layer_owner_| will be NULL. The reason for releasing ownership is that | 387 // |layer_owner_| will be NULL. The reason for releasing ownership is that |
| 406 // the client may wish to animate the window's layer beyond the lifetime of | 388 // the client may wish to animate the window's layer beyond the lifetime of |
| 407 // the window, e.g. fading it out when it is destroyed. | 389 // the window, e.g. fading it out when it is destroyed. |
| 408 scoped_ptr<ui::Layer> layer_owner_; | 390 scoped_ptr<ui::Layer> layer_owner_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 430 string16 title_; | 412 string16 title_; |
| 431 | 413 |
| 432 // Whether layer is initialized as non-opaque. | 414 // Whether layer is initialized as non-opaque. |
| 433 bool transparent_; | 415 bool transparent_; |
| 434 | 416 |
| 435 scoped_ptr<EventFilter> event_filter_; | 417 scoped_ptr<EventFilter> event_filter_; |
| 436 scoped_ptr<LayoutManager> layout_manager_; | 418 scoped_ptr<LayoutManager> layout_manager_; |
| 437 | 419 |
| 438 void* user_data_; | 420 void* user_data_; |
| 439 | 421 |
| 440 // When true, events are not sent to windows behind this one in the z-order, | |
| 441 // provided this window has children. See set_stops_event_propagation(). | |
| 442 bool stops_event_propagation_; | |
| 443 | |
| 444 // Makes the window pass all events through to any windows behind it. | 422 // Makes the window pass all events through to any windows behind it. |
| 445 bool ignore_events_; | 423 bool ignore_events_; |
| 446 | 424 |
| 447 // See SetHitTestBoundsOverride(). | 425 // See SetHitTestBoundsOverride(). |
| 448 int hit_test_bounds_override_outer_; | 426 int hit_test_bounds_override_outer_; |
| 449 int hit_test_bounds_override_inner_; | 427 int hit_test_bounds_override_inner_; |
| 450 | 428 |
| 451 ObserverList<WindowObserver> observers_; | 429 ObserverList<WindowObserver> observers_; |
| 452 | 430 |
| 453 // Value struct to keep the name and deallocator for this property. | 431 // Value struct to keep the name and deallocator for this property. |
| 454 // Key cannot be used for this purpose because it can be char* or | 432 // Key cannot be used for this purpose because it can be char* or |
| 455 // WindowProperty<>. | 433 // WindowProperty<>. |
| 456 struct Value { | 434 struct Value { |
| 457 const char* name; | 435 const char* name; |
| 458 intptr_t value; | 436 intptr_t value; |
| 459 PropertyDeallocator deallocator; | 437 PropertyDeallocator deallocator; |
| 460 }; | 438 }; |
| 461 | 439 |
| 462 std::map<const void*, Value> prop_map_; | 440 std::map<const void*, Value> prop_map_; |
| 463 | 441 |
| 464 DISALLOW_COPY_AND_ASSIGN(Window); | 442 DISALLOW_COPY_AND_ASSIGN(Window); |
| 465 }; | 443 }; |
| 466 | 444 |
| 467 } // namespace aura | 445 } // namespace aura |
| 468 | 446 |
| 469 #endif // UI_AURA_WINDOW_H_ | 447 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |