/// <summary> /// Insert a sub-menu in the menu at the specified |index|. The new sub-menu is /// returned. /// </summary> public unsafe virtual CefMenuModel InsertSubMenuAt(int index, int commandId, string label) { fixed(char *s2 = label) { var cstr2 = new cef_string_t { Str = s2, Length = label != null ? label.Length : 0 }; return(SafeCall(CefMenuModel.Wrap(CefMenuModel.Create, NativeInstance->InsertSubMenuAt(index, commandId, &cstr2)))); } }
private static unsafe void ExecuteCommandImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int command_id, CefEventFlags event_flags) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidExecuteCommand()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.ExecuteCommand(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), command_id, event_flags); }
private static unsafe void UnhandledCloseSubmenuImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int is_rtl) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidUnhandledCloseSubmenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.UnhandledCloseSubmenu(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), is_rtl != 0); }
private static unsafe void MouseOutsideMenuImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_point_t *screen_point) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidMouseOutsideMenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.MouseOutsideMenu(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), *(CefPoint *)screen_point); }
private static unsafe void MenuClosedImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidMenuClosed()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.MenuClosed(CefMenuModel.Wrap(CefMenuModel.Create, menu_model)); }
/// <summary> /// Add a sub-menu to the menu. The new sub-menu is returned. /// </summary> public unsafe virtual CefMenuModel AddSubMenu(int commandId, string label) { fixed(char *s1 = label) { var cstr1 = new cef_string_t { Str = s1, Length = label != null ? label.Length : 0 }; return(SafeCall(CefMenuModel.Wrap(CefMenuModel.Create, NativeInstance->AddSubMenu(commandId, &cstr1)))); } }
/// <summary> /// Called on unhandled close submenu keyboard commands. |is_rtl| will be true /// (1) if the menu is displaying a right-to-left language. /// </summary> protected internal unsafe virtual void UnhandledCloseSubmenu(CefMenuModel menuModel, bool isRtl) { }
/// <summary> /// Called when the user moves the mouse outside the menu and over the owning /// window. /// </summary> protected internal unsafe virtual void MouseOutsideMenu(CefMenuModel menuModel, CefPoint screenPoint) { }
/// <summary> /// Returns the submenu at the specified |index| or NULL if invalid. /// </summary> public unsafe virtual CefMenuModel GetSubMenuAt(int index) { return(SafeCall(CefMenuModel.Wrap(CefMenuModel.Create, NativeInstance->GetSubMenuAt(index)))); }
/// <summary> /// The menu has closed. /// </summary> public unsafe virtual void MenuClosed(CefMenuModel menuModel) { }
// void (*)(_cef_context_menu_handler_t* self, _cef_browser_t* browser, _cef_frame_t* frame, _cef_context_menu_params_t* params, _cef_menu_model_t* model)* private static unsafe void OnBeforeContextMenuImpl(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model) { var instance = GetInstance((IntPtr)self) as CefContextMenuHandler; if (instance == null || ((ICefContextMenuHandlerPrivate)instance).AvoidOnBeforeContextMenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); ReleaseIfNonNull((cef_base_ref_counted_t *)@params); ReleaseIfNonNull((cef_base_ref_counted_t *)model); return; } instance.OnBeforeContextMenu(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), CefContextMenuParams.Wrap(CefContextMenuParams.Create, @params), CefMenuModel.Wrap(CefMenuModel.Create, model)); }
/// <summary> /// 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 /// (1) and execute |callback| either synchronously or asynchronously with the /// selected command ID. For default display return false (0). Do not keep /// references to |params| or |model| outside of this callback. /// </summary> protected internal unsafe virtual bool RunContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams @params, CefMenuModel model, CefRunContextMenuCallback callback) { return(default);
/// <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 internal unsafe virtual void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams @params, CefMenuModel model) { }
/// <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> public unsafe virtual void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams @params, CefMenuModel model) { }
/// <summary> /// Perform the action associated with the specified |command_id| and optional /// |event_flags|. /// </summary> public unsafe virtual void ExecuteCommand(CefMenuModel menuModel, int commandId, CefEventFlags eventFlags) { }
/// <summary> /// Optionally modify a menu item label. Return true (1) if |label| was /// modified. /// </summary> public unsafe virtual bool FormatLabel(CefMenuModel menuModel, ref string label) { return(default);
/// <summary> /// The menu is about to show. /// </summary> protected internal unsafe virtual void MenuWillShow(CefMenuModel menuModel) { }
/// <summary> /// Perform the action associated with the specified |command_id| and optional /// |event_flags|. /// </summary> protected internal unsafe virtual void ExecuteCommand(CefMenuModel menuModel, int commandId, CefEventFlags eventFlags) { }
/// <summary> /// The menu has closed. /// </summary> protected internal unsafe virtual void MenuClosed(CefMenuModel menuModel) { }
/// <summary> /// Called on unhandled close submenu keyboard commands. |is_rtl| will be true /// (1) if the menu is displaying a right-to-left language. /// </summary> public unsafe virtual void UnhandledCloseSubmenu(CefMenuModel menuModel, bool isRtl) { }
/// <summary> /// Optionally modify a menu item label. Return true (1) if |label| was /// modified. /// </summary> protected internal unsafe virtual bool FormatLabel(CefMenuModel menuModel, ref string label) { return(default);
/// <summary> /// The menu is about to show. /// </summary> public unsafe virtual void MenuWillShow(CefMenuModel menuModel) { }
/// <summary> /// Returns the submenu for the specified |command_id| or NULL if invalid. /// </summary> public unsafe virtual CefMenuModel GetSubMenu(int commandId) { return(SafeCall(CefMenuModel.Wrap(CefMenuModel.Create, NativeInstance->GetSubMenu(commandId)))); }
/// <summary> /// Called when the user moves the mouse outside the menu and over the owning /// window. /// </summary> public unsafe virtual void MouseOutsideMenu(CefMenuModel menuModel, CefPoint screenPoint) { }