summaryrefslogtreecommitdiffstats
path: root/views/widget/native_widget_delegate.h
blob: e5e3752a696372902af269b88cadce9d40614629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef VIEWS_WIDGET_NATIVE_WIDGET_DELEGATE_H_
#define VIEWS_WIDGET_NATIVE_WIDGET_DELEGATE_H_
#pragma once

namespace gfx {
class Canvas;
class Size;
}

namespace views {
namespace internal {

////////////////////////////////////////////////////////////////////////////////
// NativeWidgetDelegate
//
//  An interface implemented by the object that handles events sent by a
//  NativeWidget implementation.
//
class NativeWidgetDelegate {
 public:
  virtual ~NativeWidgetDelegate() {}

  // Called when native focus moves from one native view to another.
  virtual void OnNativeFocus(gfx::NativeView focused_view) = 0;
  virtual void OnNativeBlur(gfx::NativeView focused_view) = 0;

  // Called when the native widget is created.
  virtual void OnNativeWidgetCreated() = 0;

  // Called when the NativeWidget changed size to |new_size|.
  virtual void OnSizeChanged(const gfx::Size& new_size) = 0;

  // Returns true if the delegate has a FocusManager.
  virtual bool HasFocusManager() const = 0;

  // Paints the rootview in the canvas. This will also refresh the compositor
  // tree if necessary when accelerated painting is enabled.
  virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) = 0;

  // MouseEvent handlers.
  virtual bool OnMouseEvent(const MouseEvent& event) = 0;
  virtual void OnMouseCaptureLost() = 0;
};

}  // namespace internal
}  // namespace views

#endif  // VIEWS_WIDGET_NATIVE_WIDGET_DELEGATE_H_