| 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_DELEGATE_H_ | 5 #ifndef UI_AURA_WINDOW_DELEGATE_H_ |
| 6 #define UI_AURA_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_WINDOW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
| 10 #include "ui/base/events/event_constants.h" | 10 #include "ui/base/events/event_constants.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 virtual gfx::Size GetMinimumSize() const = 0; | 35 virtual gfx::Size GetMinimumSize() const = 0; |
| 36 | 36 |
| 37 // Called when the Window's position and/or size changes. | 37 // Called when the Window's position and/or size changes. |
| 38 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 38 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 39 const gfx::Rect& new_bounds) = 0; | 39 const gfx::Rect& new_bounds) = 0; |
| 40 | 40 |
| 41 // Sent to the Window's delegate when the Window gains or loses focus. | 41 // Sent to the Window's delegate when the Window gains or loses focus. |
| 42 virtual void OnFocus(aura::Window* old_focused_window) = 0; | 42 virtual void OnFocus(aura::Window* old_focused_window) = 0; |
| 43 virtual void OnBlur() = 0; | 43 virtual void OnBlur() = 0; |
| 44 | 44 |
| 45 virtual bool OnKeyEvent(ui::KeyEvent* event) = 0; | |
| 46 | |
| 47 // Returns the native cursor for the specified point, in window coordinates, | 45 // Returns the native cursor for the specified point, in window coordinates, |
| 48 // or NULL for the default cursor. | 46 // or NULL for the default cursor. |
| 49 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; | 47 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; |
| 50 | 48 |
| 51 // Returns the non-client component (see hit_test.h) containing |point|, in | 49 // Returns the non-client component (see hit_test.h) containing |point|, in |
| 52 // window coordinates. | 50 // window coordinates. |
| 53 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | 51 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; |
| 54 | 52 |
| 55 // Returns true if event handling should descend into |child|. |location| is | 53 // Returns true if event handling should descend into |child|. |location| is |
| 56 // in terms of the Window. | 54 // in terms of the Window. |
| 57 virtual bool ShouldDescendIntoChildForEventHandling( | 55 virtual bool ShouldDescendIntoChildForEventHandling( |
| 58 Window* child, | 56 Window* child, |
| 59 const gfx::Point& location) = 0; | 57 const gfx::Point& location) = 0; |
| 60 | 58 |
| 61 virtual bool OnMouseEvent(ui::MouseEvent* event) = 0; | |
| 62 | |
| 63 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) = 0; | |
| 64 | |
| 65 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) = 0; | |
| 66 | |
| 67 // Returns true of the window can be focused. | 59 // Returns true of the window can be focused. |
| 68 virtual bool CanFocus() = 0; | 60 virtual bool CanFocus() = 0; |
| 69 | 61 |
| 70 // Invoked when mouse capture is lost on the window. | 62 // Invoked when mouse capture is lost on the window. |
| 71 virtual void OnCaptureLost() = 0; | 63 virtual void OnCaptureLost() = 0; |
| 72 | 64 |
| 73 // Asks the delegate to paint window contents into the supplied canvas. | 65 // Asks the delegate to paint window contents into the supplied canvas. |
| 74 virtual void OnPaint(gfx::Canvas* canvas) = 0; | 66 virtual void OnPaint(gfx::Canvas* canvas) = 0; |
| 75 | 67 |
| 76 // Called when the window's device scale factor has changed. | 68 // Called when the window's device scale factor has changed. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 // Otherwise, Window will hit-test against its bounds. | 90 // Otherwise, Window will hit-test against its bounds. |
| 99 virtual bool HasHitTestMask() const = 0; | 91 virtual bool HasHitTestMask() const = 0; |
| 100 | 92 |
| 101 // Called from Window::HitTest to retrieve hit test mask when HasHitTestMask | 93 // Called from Window::HitTest to retrieve hit test mask when HasHitTestMask |
| 102 // above returns true. | 94 // above returns true. |
| 103 virtual void GetHitTestMask(gfx::Path* mask) const = 0; | 95 virtual void GetHitTestMask(gfx::Path* mask) const = 0; |
| 104 | 96 |
| 105 protected: | 97 protected: |
| 106 virtual ~WindowDelegate() {} | 98 virtual ~WindowDelegate() {} |
| 107 | 99 |
| 108 virtual ui::EventResult OnKeyEvent(ui::EventTarget* target, | 100 // Overridden from ui::EventHandler: |
| 109 ui::KeyEvent* event) OVERRIDE; | 101 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
| 110 virtual ui::EventResult OnMouseEvent(ui::EventTarget* target, | |
| 111 ui::MouseEvent* event) OVERRIDE; | |
| 112 virtual ui::EventResult OnScrollEvent(ui::EventTarget* target, | |
| 113 ui::ScrollEvent* event) OVERRIDE; | |
| 114 virtual ui::TouchStatus OnTouchEvent(ui::EventTarget* target, | |
| 115 ui::TouchEvent* event) OVERRIDE; | |
| 116 virtual ui::EventResult OnGestureEvent(ui::EventTarget* target, | |
| 117 ui::GestureEvent* event) OVERRIDE; | |
| 118 }; | 102 }; |
| 119 | 103 |
| 120 } // namespace aura | 104 } // namespace aura |
| 121 | 105 |
| 122 #endif // UI_AURA_WINDOW_DELEGATE_H_ | 106 #endif // UI_AURA_WINDOW_DELEGATE_H_ |
| OLD | NEW |