summaryrefslogtreecommitdiffstats
path: root/ui/views/context_menu_controller.h
blob: dd137a993c567f4505f3250b3b3358382247f8c0 (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
// Copyright (c) 2012 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 UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_
#define UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_

#include "ui/base/ui_base_types.h"
#include "ui/views/views_export.h"

namespace gfx {
class Point;
}

namespace views {
class View;

// ContextMenuController is responsible for showing the context menu for a
// View. To use a ContextMenuController invoke set_context_menu_controller on a
// View. When the appropriate user gesture occurs ShowContextMenu is invoked
// on the ContextMenuController.
//
// Setting a ContextMenuController on a view makes the view process mouse
// events.
//
// It is up to subclasses that do their own mouse processing to invoke
// the appropriate ContextMenuController method, typically by invoking super's
// implementation for mouse processing.
class VIEWS_EXPORT ContextMenuController {
 public:
  // Invoked to show the context menu for |source|.
  // |point| is in screen coordinates.
  virtual void ShowContextMenuForView(View* source,
                                      const gfx::Point& point,
                                      ui::MenuSourceType source_type) = 0;

 protected:
  virtual ~ContextMenuController() {}
};

}  // namespace views

#endif  // UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_