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 UI_VIEWS_EVENTS_CONTEXT_MENU_CONTROLLER_H_ |
| 6 #define UI_VIEWS_EVENTS_CONTEXT_MENU_CONTROLLER_H_ |
| 7 #pragma once |
| 8 |
| 9 namespace gfx { |
| 10 class Point; |
| 11 } |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 class View; |
| 16 |
| 17 // ContextMenuController is responsible for showing the context menu for a |
| 18 // View. To use a ContextMenuController invoke SetContextMenuController on a |
| 19 // View. When the appropriate user gesture occurs ShowContextMenu is invoked |
| 20 // on the ContextMenuController. |
| 21 // |
| 22 // Setting a ContextMenuController on a View makes the View process mouse |
| 23 // events. |
| 24 // |
| 25 // It is up to subclasses that do their own mouse processing to invoke |
| 26 // the appropriate ContextMenuController method, typically by invoking super's |
| 27 // implementation for mouse processing. |
| 28 // |
| 29 class ContextMenuController { |
| 30 public: |
| 31 // Invoked to show the context menu for the source view. If |is_mouse_gesture| |
| 32 // is true, |point| is the location of the mouse. If |is_mouse_gesture| is |
| 33 // false, this method was not invoked by a mouse gesture and |point| is the |
| 34 // recommended location to show the menu at. |
| 35 // |
| 36 // |point| is in screen coordinates. |
| 37 virtual void ShowContextMenu(View* source, |
| 38 const gfx::Point& point, |
| 39 bool is_mouse_gesture) = 0; |
| 40 |
| 41 protected: |
| 42 virtual ~ContextMenuController() {} |
| 43 }; |
| 44 |
| 45 } // namespace ui |
| 46 |
| 47 #endif // UI_VIEWS_EVENTS_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |