| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_AURA_WINDOW_DELEGATE_H_ | |
| 6 #define UI_AURA_WINDOW_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "ui/aura/aura_export.h" | |
| 11 #include "ui/events/event_constants.h" | |
| 12 #include "ui/events/event_handler.h" | |
| 13 #include "ui/gfx/native_widget_types.h" | |
| 14 | |
| 15 namespace gfx { | |
| 16 class Canvas; | |
| 17 class Path; | |
| 18 class Point; | |
| 19 class Rect; | |
| 20 class Size; | |
| 21 } | |
| 22 | |
| 23 namespace ui { | |
| 24 class GestureEvent; | |
| 25 class KeyEvent; | |
| 26 class Layer; | |
| 27 class MouseEvent; | |
| 28 class Texture; | |
| 29 class TouchEvent; | |
| 30 } | |
| 31 | |
| 32 namespace aura { | |
| 33 | |
| 34 // Delegate interface for aura::Window. | |
| 35 class AURA_EXPORT WindowDelegate : public ui::EventHandler { | |
| 36 public: | |
| 37 // Returns the window's minimum size, or size 0,0 if there is no limit. | |
| 38 virtual gfx::Size GetMinimumSize() const = 0; | |
| 39 | |
| 40 // Returns the window's maximum size, or size 0,0 if there is no limit. | |
| 41 virtual gfx::Size GetMaximumSize() const = 0; | |
| 42 | |
| 43 // Called when the Window's position and/or size changes. | |
| 44 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | |
| 45 const gfx::Rect& new_bounds) = 0; | |
| 46 | |
| 47 // Returns the native cursor for the specified point, in window coordinates, | |
| 48 // or NULL for the default cursor. | |
| 49 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; | |
| 50 | |
| 51 // Returns the non-client component (see hit_test.h) containing |point|, in | |
| 52 // window coordinates. | |
| 53 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | |
| 54 | |
| 55 // Returns true if event handling should descend into |child|. |location| is | |
| 56 // in terms of the Window. | |
| 57 virtual bool ShouldDescendIntoChildForEventHandling( | |
| 58 Window* child, | |
| 59 const gfx::Point& location) = 0; | |
| 60 | |
| 61 // Returns true of the window can be focused. | |
| 62 virtual bool CanFocus() = 0; | |
| 63 | |
| 64 // Invoked when mouse capture is lost on the window. | |
| 65 virtual void OnCaptureLost() = 0; | |
| 66 | |
| 67 // Asks the delegate to paint window contents into the supplied canvas. | |
| 68 virtual void OnPaint(gfx::Canvas* canvas) = 0; | |
| 69 | |
| 70 // Called when the window's device scale factor has changed. | |
| 71 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | |
| 72 | |
| 73 // Called from Window's destructor before OnWindowDestroyed and before the | |
| 74 // children have been destroyed and the window has been removed from its | |
| 75 // parent. | |
| 76 // This method takes the window because the delegate implementation may no | |
| 77 // longer have a route back to the window by the time this method is called. | |
| 78 virtual void OnWindowDestroying(Window* window) = 0; | |
| 79 | |
| 80 // Called when the Window has been destroyed (i.e. from its destructor). This | |
| 81 // is called after OnWindowDestroying and after the children have been | |
| 82 // deleted and the window has been removed from its parent. | |
| 83 // The delegate can use this as an opportunity to delete itself if necessary. | |
| 84 // This method takes the window because the delegate implementation may no | |
| 85 // longer have a route back to the window by the time this method is called. | |
| 86 virtual void OnWindowDestroyed(Window* window) = 0; | |
| 87 | |
| 88 // Called when the TargetVisibility() of a Window changes. |visible| | |
| 89 // corresponds to the target visibility of the window. See | |
| 90 // Window::TargetVisibility() for details. | |
| 91 virtual void OnWindowTargetVisibilityChanged(bool visible) = 0; | |
| 92 | |
| 93 // Called from Window::HitTest to check if the window has a custom hit test | |
| 94 // mask. It works similar to the views counterparts. That is, if the function | |
| 95 // returns true, GetHitTestMask below will be called to get the mask. | |
| 96 // Otherwise, Window will hit-test against its bounds. | |
| 97 virtual bool HasHitTestMask() const = 0; | |
| 98 | |
| 99 // Called from Window::HitTest to retrieve hit test mask when HasHitTestMask | |
| 100 // above returns true. | |
| 101 virtual void GetHitTestMask(gfx::Path* mask) const = 0; | |
| 102 | |
| 103 protected: | |
| 104 virtual ~WindowDelegate() {} | |
| 105 }; | |
| 106 | |
| 107 } // namespace aura | |
| 108 | |
| 109 #endif // UI_AURA_WINDOW_DELEGATE_H_ | |
| OLD | NEW |