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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "ui/aura/aura_export.h" | 17 #include "ui/aura/aura_export.h" |
18 #include "ui/aura/client/window_types.h" | 18 #include "ui/aura/client/window_types.h" |
19 #include "ui/base/events.h" | 19 #include "ui/base/events.h" |
20 #include "ui/base/gestures/gesture_types.h" | 20 #include "ui/base/gestures/gesture_types.h" |
21 #include "ui/compositor/layer_animator.h" | 21 #include "ui/compositor/layer_animator.h" |
22 #include "ui/compositor/layer_delegate.h" | 22 #include "ui/compositor/layer_delegate.h" |
23 #include "ui/compositor/layer_owner.h" | 23 #include "ui/compositor/layer_owner.h" |
24 #include "ui/compositor/layer_type.h" | 24 #include "ui/compositor/layer_type.h" |
25 #include "ui/gfx/insets.h" | 25 #include "ui/gfx/insets.h" |
26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 | 28 |
29 class SkCanvas; | 29 class SkCanvas; |
30 class SkRegion; | |
30 | 31 |
31 namespace gfx { | 32 namespace gfx { |
32 class Display; | 33 class Display; |
33 } | 34 } |
34 | 35 |
35 namespace ui { | 36 namespace ui { |
36 class Layer; | 37 class Layer; |
37 class Texture; | 38 class Texture; |
38 class Transform; | 39 class Transform; |
39 } | 40 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 // Sets the window to grab hits for an area extending |insets| pixels inside | 258 // Sets the window to grab hits for an area extending |insets| pixels inside |
258 // its bounds (even if that inner region overlaps a child window). This can be | 259 // its bounds (even if that inner region overlaps a child window). This can be |
259 // used to create an invisible non-client area that overlaps the client area. | 260 // used to create an invisible non-client area that overlaps the client area. |
260 void set_hit_test_bounds_override_inner(const gfx::Insets& insets) { | 261 void set_hit_test_bounds_override_inner(const gfx::Insets& insets) { |
261 hit_test_bounds_override_inner_ = insets; | 262 hit_test_bounds_override_inner_ = insets; |
262 } | 263 } |
263 gfx::Insets hit_test_bounds_override_inner() const { | 264 gfx::Insets hit_test_bounds_override_inner() const { |
264 return hit_test_bounds_override_inner_; | 265 return hit_test_bounds_override_inner_; |
265 } | 266 } |
266 | 267 |
268 // The region specified can be used to drag the window. | |
269 // The window will take the ownership of the specified region. | |
270 void SetDraggableRegion(SkRegion* region); | |
Ben Goodger (Google)
2012/08/17 17:10:24
Aura is agnostic of things that relate specificall
| |
271 | |
267 // Returns true if the |point_in_root| in root window's coordinate falls | 272 // Returns true if the |point_in_root| in root window's coordinate falls |
268 // within this window's bounds. Returns false if the window is detached | 273 // within this window's bounds. Returns false if the window is detached |
269 // from root window. | 274 // from root window. |
270 bool ContainsPointInRoot(const gfx::Point& point_in_root) const; | 275 bool ContainsPointInRoot(const gfx::Point& point_in_root) const; |
271 | 276 |
272 // Returns true if relative-to-this-Window's-origin |local_point| falls | 277 // Returns true if relative-to-this-Window's-origin |local_point| falls |
273 // within this Window's bounds. | 278 // within this Window's bounds. |
274 bool ContainsPoint(const gfx::Point& local_point) const; | 279 bool ContainsPoint(const gfx::Point& local_point) const; |
275 | 280 |
276 // Returns true if the mouse pointer at relative-to-this-Window's-origin | 281 // Returns true if the mouse pointer at relative-to-this-Window's-origin |
277 // |local_point| can trigger an event for this Window. | 282 // |local_point| can trigger an event for this Window. |
278 // TODO(beng): A Window can supply a hit-test mask to cause some portions of | 283 // TODO(beng): A Window can supply a hit-test mask to cause some portions of |
279 // itself to not trigger events, causing the events to fall through to the | 284 // itself to not trigger events, causing the events to fall through to the |
280 // Window behind. | 285 // Window behind. |
281 bool HitTest(const gfx::Point& local_point); | 286 bool HitTest(const gfx::Point& local_point); |
282 | 287 |
283 // Returns the Window that most closely encloses |local_point| for the | 288 // Returns the Window that most closely encloses |local_point| for the |
284 // purposes of event targeting. | 289 // purposes of event targeting. |
285 Window* GetEventHandlerForPoint(const gfx::Point& local_point); | 290 Window* GetEventHandlerForPoint(const gfx::Point& local_point, |
291 ui::EventType event_type); | |
286 | 292 |
287 // Returns the topmost Window with a delegate containing |local_point|. | 293 // Returns the topmost Window with a delegate containing |local_point|. |
288 Window* GetTopWindowContainingPoint(const gfx::Point& local_point); | 294 Window* GetTopWindowContainingPoint(const gfx::Point& local_point); |
289 | 295 |
290 // Returns this window's toplevel window (the highest-up-the-tree anscestor | 296 // Returns this window's toplevel window (the highest-up-the-tree anscestor |
291 // that has a delegate set). The toplevel window may be |this|. | 297 // that has a delegate set). The toplevel window may be |this|. |
292 Window* GetToplevelWindow(); | 298 Window* GetToplevelWindow(); |
293 | 299 |
294 // Claims or relinquishes the claim to focus. | 300 // Claims or relinquishes the claim to focus. |
295 void Focus(); | 301 void Focus(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 // Updates the visible state of the layer, but does not make visible-state | 380 // Updates the visible state of the layer, but does not make visible-state |
375 // specific changes. Called from Show()/Hide(). | 381 // specific changes. Called from Show()/Hide(). |
376 void SetVisible(bool visible); | 382 void SetVisible(bool visible); |
377 | 383 |
378 // Schedules a paint for the Window's entire bounds. | 384 // Schedules a paint for the Window's entire bounds. |
379 void SchedulePaint(); | 385 void SchedulePaint(); |
380 | 386 |
381 // Gets a Window (either this one or a subwindow) containing |local_point|. | 387 // Gets a Window (either this one or a subwindow) containing |local_point|. |
382 // If |return_tightest| is true, returns the tightest-containing (i.e. | 388 // If |return_tightest| is true, returns the tightest-containing (i.e. |
383 // furthest down the hierarchy) Window containing the point; otherwise, | 389 // furthest down the hierarchy) Window containing the point; otherwise, |
384 // returns the loosest. If |for_event_handling| is true, then hit-test masks | 390 // returns the loosest. If |event_type| is provided (!ET_UNKNOWN), then |
385 // are honored; otherwise, only bounds checks are performed. | 391 // hit-test masks are honored; otherwise, only bounds checks are performed. |
386 Window* GetWindowForPoint(const gfx::Point& local_point, | 392 Window* GetWindowForPoint(const gfx::Point& local_point, |
387 bool return_tightest, | 393 bool return_tightest, |
388 bool for_event_handling); | 394 ui::EventType event_type); |
389 | 395 |
390 // Implementation of RemoveChild(). If |child| is being removed as the result | 396 // Implementation of RemoveChild(). If |child| is being removed as the result |
391 // of an add, |new_parent| is the new parent |child| is going to be parented | 397 // of an add, |new_parent| is the new parent |child| is going to be parented |
392 // to. | 398 // to. |
393 void RemoveChildImpl(Window* child, Window* new_parent); | 399 void RemoveChildImpl(Window* child, Window* new_parent); |
394 | 400 |
395 // Called when this window's parent has changed. | 401 // Called when this window's parent has changed. |
396 void OnParentChanged(); | 402 void OnParentChanged(); |
397 | 403 |
398 // Determines the real location for stacking |child| and invokes | 404 // Determines the real location for stacking |child| and invokes |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 void* user_data_; | 480 void* user_data_; |
475 | 481 |
476 // Makes the window pass all events through to any windows behind it. | 482 // Makes the window pass all events through to any windows behind it. |
477 bool ignore_events_; | 483 bool ignore_events_; |
478 | 484 |
479 // See set_hit_test_outer_override(). | 485 // See set_hit_test_outer_override(). |
480 gfx::Insets hit_test_bounds_override_outer_mouse_; | 486 gfx::Insets hit_test_bounds_override_outer_mouse_; |
481 gfx::Insets hit_test_bounds_override_outer_touch_; | 487 gfx::Insets hit_test_bounds_override_outer_touch_; |
482 gfx::Insets hit_test_bounds_override_inner_; | 488 gfx::Insets hit_test_bounds_override_inner_; |
483 | 489 |
490 // Region that can be used to drag the window. | |
491 scoped_ptr<SkRegion> draggable_region_; | |
492 | |
484 ObserverList<WindowObserver> observers_; | 493 ObserverList<WindowObserver> observers_; |
485 | 494 |
486 // Value struct to keep the name and deallocator for this property. | 495 // Value struct to keep the name and deallocator for this property. |
487 // Key cannot be used for this purpose because it can be char* or | 496 // Key cannot be used for this purpose because it can be char* or |
488 // WindowProperty<>. | 497 // WindowProperty<>. |
489 struct Value { | 498 struct Value { |
490 const char* name; | 499 const char* name; |
491 intptr_t value; | 500 intptr_t value; |
492 PropertyDeallocator deallocator; | 501 PropertyDeallocator deallocator; |
493 }; | 502 }; |
494 | 503 |
495 std::map<const void*, Value> prop_map_; | 504 std::map<const void*, Value> prop_map_; |
496 | 505 |
497 DISALLOW_COPY_AND_ASSIGN(Window); | 506 DISALLOW_COPY_AND_ASSIGN(Window); |
498 }; | 507 }; |
499 | 508 |
500 } // namespace aura | 509 } // namespace aura |
501 | 510 |
502 #endif // UI_AURA_WINDOW_H_ | 511 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |