protected virtual void Dispose(bool disposing) { if (_self != null) { cef_context_menu_handler_t.Free(_self); _self = null; } }
private int on_context_menu_command(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, int command_id, CefEventFlags event_flags) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); var mState = CefContextMenuParams.FromNative(@params); var result = OnContextMenuCommand(mBrowser, mFrame, mState, command_id, event_flags); mState.Dispose(); return(result ? 1 : 0); }
private void on_before_context_menu(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) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); var mState = CefContextMenuParams.FromNative(@params); var mModel = CefMenuModel.FromNative(model); OnBeforeContextMenu(mBrowser, mFrame, mState, mModel); mState.Dispose(); mModel.Dispose(); }
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)); }
private int run_context_menu(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, cef_run_context_menu_callback_t *callback) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); var mParameters = CefContextMenuParams.FromNative(@params); var mModel = CefMenuModel.FromNative(model); var mCallback = CefRunContextMenuCallback.FromNative(callback); var result = RunContextMenu(mBrowser, mFrame, mParameters, mModel, mCallback); mParameters.Dispose(); mModel.Dispose(); return(result ? 1 : 0); }
public CefContextMenuHandler() { cef_context_menu_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_before_context_menu = (void *)Marshal.GetFunctionPointerForDelegate(fnOnBeforeContextMenu); self->run_context_menu = (void *)Marshal.GetFunctionPointerForDelegate(fnRunContextMenu); self->on_context_menu_command = (void *)Marshal.GetFunctionPointerForDelegate(fnOnContextMenuCommand); self->on_context_menu_dismissed = (void *)Marshal.GetFunctionPointerForDelegate(fnOnContextMenuDismissed); #else self->on_before_context_menu = (delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, cef_context_menu_params_t *, cef_menu_model_t *, void >) & OnBeforeContextMenuImpl; self->run_context_menu = (delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, cef_context_menu_params_t *, cef_menu_model_t *, cef_run_context_menu_callback_t *, int >) & RunContextMenuImpl; self->on_context_menu_command = (delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, cef_context_menu_params_t *, int, CefEventFlags, int >) & OnContextMenuCommandImpl; self->on_context_menu_dismissed = (delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, void >) & OnContextMenuDismissedImpl; #endif }
protected CefContextMenuHandler() { _self = cef_context_menu_handler_t.Alloc(); _ds0 = new cef_context_menu_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_context_menu_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_context_menu_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_context_menu_handler_t.on_before_context_menu_delegate(on_before_context_menu); _self->_on_before_context_menu = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_context_menu_handler_t.on_context_menu_command_delegate(on_context_menu_command); _self->_on_context_menu_command = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_context_menu_handler_t.on_context_menu_dismissed_delegate(on_context_menu_dismissed); _self->_on_context_menu_dismissed = Marshal.GetFunctionPointerForDelegate(_ds5); }
protected CefContextMenuHandler() { _self = cef_context_menu_handler_t.Alloc(); _ds0 = new cef_context_menu_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_context_menu_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_context_menu_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_context_menu_handler_t.on_before_context_menu_delegate(on_before_context_menu); _self->_on_before_context_menu = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_context_menu_handler_t.on_context_menu_command_delegate(on_context_menu_command); _self->_on_context_menu_command = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_context_menu_handler_t.on_context_menu_dismissed_delegate(on_context_menu_dismissed); _self->_on_context_menu_dismissed = Marshal.GetFunctionPointerForDelegate(_ds5); }
internal static void Free(cef_context_menu_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private int has_at_least_one_ref(cef_context_menu_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
public CefContextMenuHandler(cef_context_menu_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
/// <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 abstract int OnContextMenuCommand(cef_browser_t* browser, cef_frame_t* frame, cef_context_menu_params_t* @params, int command_id, CefEventFlags event_flags); private void on_context_menu_dismissed(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefContextMenuHandler.OnContextMenuDismissed }
/// <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 abstract void OnBeforeContextMenu(cef_browser_t* browser, cef_frame_t* frame, cef_context_menu_params_t* @params, cef_menu_model_t* model); private int on_context_menu_command(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, int command_id, CefEventFlags event_flags) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefContextMenuHandler.OnContextMenuCommand }
private void on_before_context_menu(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) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefContextMenuHandler.OnBeforeContextMenu }
private int get_refct(cef_context_menu_handler_t *self) { return(_refct); }