| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AURA_WINDOW_DELEGATE_H_ | |
| 6 #define AURA_WINDOW_DELEGATE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 namespace gfx { | |
| 10 class Canvas; | |
| 11 class Point; | |
| 12 } | |
| 13 | |
| 14 namespace aura { | |
| 15 | |
| 16 class KeyEvent; | |
| 17 class MouseEvent; | |
| 18 | |
| 19 // Delegate interface for aura::Window. | |
| 20 class WindowDelegate { | |
| 21 public: | |
| 22 // Sent to the Window's delegate when the Window gains or loses focus. | |
| 23 virtual void OnFocus() = 0; | |
| 24 virtual void OnBlur() = 0; | |
| 25 | |
| 26 virtual bool OnKeyEvent(KeyEvent* event) = 0; | |
| 27 | |
| 28 // Returns the non-client component (see hit_test.h) containing |point|, in | |
| 29 // window coordinates. | |
| 30 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | |
| 31 | |
| 32 virtual bool OnMouseEvent(MouseEvent* event) = 0; | |
| 33 | |
| 34 // Asks the delegate to paint window contents into the supplied canvas. | |
| 35 virtual void OnPaint(gfx::Canvas* canvas) = 0; | |
| 36 | |
| 37 // Called from Window's destructor before OnWindowDestroyed and before the | |
| 38 // children have been destroyed. | |
| 39 virtual void OnWindowDestroying() = 0; | |
| 40 | |
| 41 // Called when the Window has been destroyed (i.e. from its destructor). This | |
| 42 // is called after OnWindowDestroying and after the children have been | |
| 43 // deleted. | |
| 44 // The delegate can use this as an opportunity to delete itself if necessary. | |
| 45 virtual void OnWindowDestroyed() = 0; | |
| 46 | |
| 47 protected: | |
| 48 virtual ~WindowDelegate() {} | |
| 49 }; | |
| 50 | |
| 51 } // namespace aura | |
| 52 | |
| 53 #endif // AURA_WINDOW_DELEGATE_H_ | |
| OLD | NEW |