protected override bool OnContextMenuCommand(CefBrowser browser, CefFrame frame, CefContextMenuParams state, int commandId, CefEventFlags eventFlags)
 {
     foreach (CommandItem commItem in commandItems)
     {
         if (commItem.id == commandId)
         {
             commItem.item.PerformClick();
             break;
         }
     }
     return base.OnContextMenuCommand(browser, frame, state, commandId, eventFlags);
 }
 protected override void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model)
 {
     if (!webBrowser.menuVisible)
         model.Clear();
     int commandId = 1001;
     if (webBrowser.ContextMenu != null)
     {
         foreach (MenuItem item in webBrowser.ContextMenu.MenuItems)
         {
             if (item.Text == "-")
                 model.AddSeparator();
             else
                 model.AddItem(commandId, item.Text);
             CommandItem commandItem = new CommandItem();
             commandItem.id = commandId;
             commandItem.item = item;
             commandItems.Add(commandItem);
             commandId++;
         }
     }
     
     base.OnBeforeContextMenu(browser, frame, state, model);
     
 }
 /// <summary>
 /// 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.
 /// </summary>
 protected virtual bool OnContextMenuCommand(CefBrowser browser, CefFrame frame, CefContextMenuParams state, int commandId, CefEventFlags eventFlags)
 {
     return false;
 }
 /// <summary>
 /// 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.
 /// </summary>
 protected virtual void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// 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.
 /// </summary>
 protected virtual bool OnContextMenuCommand(CefBrowser browser, CefFrame frame, CefContextMenuParams state, int commandId, CefEventFlags eventFlags)
 {
     return(false);
 }
Esempio n. 6
0
 /// <summary>
 /// 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.
 /// </summary>
 protected virtual void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model)
 {
 }