Пример #1
0
        internal static void on_context_menu_command(IntPtr gcHandlePtr, out int __retval, IntPtr browser, out int browser_release, IntPtr frame, out int frame_release, IntPtr parameters, out int params_release, int command_id, int event_flags)
        {
            var self = (CfxContextMenuHandler)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null || self.CallbacksDisabled)
            {
                __retval        = default(int);
                browser_release = 1;
                frame_release   = 1;
                params_release  = 1;
                return;
            }
            var e = new CfxOnContextMenuCommandEventArgs();

            e.m_browser     = browser;
            e.m_frame       = frame;
            e.m_params      = parameters;
            e.m_command_id  = command_id;
            e.m_event_flags = event_flags;
            self.m_OnContextMenuCommand?.Invoke(self, e);
            e.m_isInvalid   = true;
            browser_release = e.m_browser_wrapped == null? 1 : 0;
            frame_release   = e.m_frame_wrapped == null? 1 : 0;
            params_release  = e.m_params_wrapped == null? 1 : 0;
            __retval        = e.m_returnValue ? 1 : 0;
        }
Пример #2
0
        internal static void on_context_menu_command(IntPtr gcHandlePtr, out int __retval, IntPtr browser, IntPtr frame, IntPtr parameters, int command_id, int event_flags)
        {
            var self = (CfxContextMenuHandler)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null)
            {
                __retval = default(int);
                return;
            }
            var e            = new CfxOnContextMenuCommandEventArgs(browser, frame, parameters, command_id, event_flags);
            var eventHandler = self.m_OnContextMenuCommand;

            if (eventHandler != null)
            {
                eventHandler(self, e);
            }
            e.m_isInvalid = true;
            if (e.m_browser_wrapped == null)
            {
                CfxApi.cfx_release(e.m_browser);
            }
            if (e.m_frame_wrapped == null)
            {
                CfxApi.cfx_release(e.m_frame);
            }
            if (e.m_params_wrapped == null)
            {
                CfxApi.cfx_release(e.m_params);
            }
            __retval = e.m_returnValue ? 1 : 0;
        }
        private void RaiseOnContextMenuCommand(object sender, CfxOnContextMenuCommandEventArgs e)
        {
            var handler = m_OnContextMenuCommand;

            if (handler != null)
            {
                InvokeCallback(() => { handler(this, e); });
            }
        }
Пример #4
0
        private void ContextMenuHandler_OnContextMenuCommand(object sender, CfxOnContextMenuCommandEventArgs e)
        {
            if (!CfxContextMenu.IsUserDefined(e.CommandId))
            {
                return;
            }

            var command = _Commands[e.CommandId - (int)ContextMenuId.MENU_ID_USER_FIRST].Command;

            command.Invoke();
        }
Пример #5
0
 private void RaiseOnContextMenuCommand(object sender, CfxOnContextMenuCommandEventArgs e)
 {
     var handler = m_OnContextMenuCommand;
     if (handler != null)
     {
         InvokeCallback(() => { handler(this, e); });
     }
 }