Chromium Embedded Framework (CEF)  126.2.0+g5c56e98+chromium-126.0.6478.62
CefContextMenuHandler Class Reference

Implement this interface to handle context menu events. More...

#include "include/cef_context_menu_handler.h"

Inheritance diagram for CefContextMenuHandler:
CefBaseRefCounted

Public Types

typedef cef_event_flags_t EventFlags
 
typedef cef_quick_menu_edit_state_flags_t QuickMenuEditStateFlags
 

Public Member Functions

virtual void OnBeforeContextMenu (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefContextMenuParams > params, CefRefPtr< CefMenuModel > model)
 Called before a context menu is displayed. More...
 
virtual bool RunContextMenu (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefContextMenuParams > params, CefRefPtr< CefMenuModel > model, CefRefPtr< CefRunContextMenuCallback > callback)
 Called to allow custom display of the context menu. More...
 
virtual bool OnContextMenuCommand (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefContextMenuParams > params, int command_id, EventFlags event_flags)
 Called to execute a command selected from the context menu. More...
 
virtual void OnContextMenuDismissed (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame)
 Called when the context menu is dismissed irregardless of whether the menu was canceled or a command was selected. More...
 
virtual bool RunQuickMenu (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, const CefPoint &location, const CefSize &size, QuickMenuEditStateFlags edit_state_flags, CefRefPtr< CefRunQuickMenuCallback > callback)
 Called to allow custom display of the quick menu for a windowless browser. More...
 
virtual bool OnQuickMenuCommand (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, int command_id, EventFlags event_flags)
 Called to execute a command selected from the quick menu for a windowless browser. More...
 
virtual void OnQuickMenuDismissed (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame)
 Called when the quick menu for a windowless browser is dismissed irregardless of whether the menu was canceled or a command was selected. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Implement this interface to handle context menu events.

The methods of this class will be called on the UI thread.

Member Typedef Documentation

◆ EventFlags

◆ QuickMenuEditStateFlags

Member Function Documentation

◆ OnBeforeContextMenu()

virtual void CefContextMenuHandler::OnBeforeContextMenu ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefContextMenuParams params,
CefRefPtr< CefMenuModel model 
)
inlinevirtual

Called before a context menu is displayed.

|params| provides information about the context menu state. |model| initially contains the default context menu. The |model| can be cleared to show no context menu or modified to show a custom menu. Do not keep references to |params| or |model| outside of this callback.

◆ OnContextMenuCommand()

virtual bool CefContextMenuHandler::OnContextMenuCommand ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefContextMenuParams params,
int  command_id,
EventFlags  event_flags 
)
inlinevirtual

Called to execute a command selected from the context menu.

Return true if the command was handled or false for the default implementation. See cef_menu_id_t for the command ids that have default implementations. All user-defined command ids should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. |params| will have the same values as what was passed to OnBeforeContextMenu(). Do not keep a reference to |params| outside of this callback.

◆ OnContextMenuDismissed()

virtual void CefContextMenuHandler::OnContextMenuDismissed ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame 
)
inlinevirtual

Called when the context menu is dismissed irregardless of whether the menu was canceled or a command was selected.

◆ OnQuickMenuCommand()

virtual bool CefContextMenuHandler::OnQuickMenuCommand ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
int  command_id,
EventFlags  event_flags 
)
inlinevirtual

Called to execute a command selected from the quick menu for a windowless browser.

Return true if the command was handled or false for the default implementation. See cef_menu_id_t for command IDs that have default implementations.

◆ OnQuickMenuDismissed()

virtual void CefContextMenuHandler::OnQuickMenuDismissed ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame 
)
inlinevirtual

Called when the quick menu for a windowless browser is dismissed irregardless of whether the menu was canceled or a command was selected.

◆ RunContextMenu()

virtual bool CefContextMenuHandler::RunContextMenu ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
CefRefPtr< CefContextMenuParams params,
CefRefPtr< CefMenuModel model,
CefRefPtr< CefRunContextMenuCallback callback 
)
inlinevirtual

Called to allow custom display of the context menu.

|params| provides information about the context menu state. |model| contains the context menu model resulting from OnBeforeContextMenu. For custom display return true and execute |callback| either synchronously or asynchronously with the selected command ID. For default display return false. Do not keep references to |params| or |model| outside of this callback.

◆ RunQuickMenu()

virtual bool CefContextMenuHandler::RunQuickMenu ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefFrame frame,
const CefPoint location,
const CefSize size,
QuickMenuEditStateFlags  edit_state_flags,
CefRefPtr< CefRunQuickMenuCallback callback 
)
inlinevirtual

Called to allow custom display of the quick menu for a windowless browser.

|location| is the top left corner of the selected region. |size| is the size of the selected region. |edit_state_flags| is a combination of flags that represent the state of the quick menu. Return true if the menu will be handled and execute |callback| either synchronously or asynchronously with the selected command ID. Return false to cancel the menu.


The documentation for this class was generated from the following file: