Example #1
0
 public void Dispose()
 {
     if (_self != null)
     {
         Release();
         _self = null;
     }
     GC.SuppressFinalize(this);
 }
        public static cef_string_userfree *get_page_url(cef_context_menu_params_t *self)
        {
            get_page_url_delegate d;
            var p = self->_get_page_url;

            if (p == _pa)
            {
                d = _da;
            }
            else
            {
                d = (get_page_url_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_page_url_delegate));
                if (_pa == IntPtr.Zero)
                {
                    _da = d; _pa = p;
                }
            }
            return(d(self));
        }
        public static cef_string_userfree *get_frame_charset(cef_context_menu_params_t *self)
        {
            get_frame_charset_delegate d;
            var p = self->_get_frame_charset;

            if (p == _pc)
            {
                d = _dc;
            }
            else
            {
                d = (get_frame_charset_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_frame_charset_delegate));
                if (_pc == IntPtr.Zero)
                {
                    _dc = d; _pc = p;
                }
            }
            return(d(self));
        }
        public static CefContextMenuTypeFlags get_type_flags(cef_context_menu_params_t *self)
        {
            get_type_flags_delegate d;
            var p = self->_get_type_flags;

            if (p == _p5)
            {
                d = _d5;
            }
            else
            {
                d = (get_type_flags_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_type_flags_delegate));
                if (_p5 == IntPtr.Zero)
                {
                    _d5 = d; _p5 = p;
                }
            }
            return(d(self));
        }
        public static int has_image_contents(cef_context_menu_params_t *self)
        {
            has_image_contents_delegate d;
            var p = self->_has_image_contents;

            if (p == _p9)
            {
                d = _d9;
            }
            else
            {
                d = (has_image_contents_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_image_contents_delegate));
                if (_p9 == IntPtr.Zero)
                {
                    _d9 = d; _p9 = p;
                }
            }
            return(d(self));
        }
        public static int has_one_ref(cef_context_menu_params_t *self)
        {
            has_one_ref_delegate d;
            var p = self->_base._has_one_ref;

            if (p == _p2)
            {
                d = _d2;
            }
            else
            {
                d = (has_one_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_one_ref_delegate));
                if (_p2 == IntPtr.Zero)
                {
                    _d2 = d; _p2 = p;
                }
            }
            return(d(self));
        }
        public static int get_ycoord(cef_context_menu_params_t *self)
        {
            get_ycoord_delegate d;
            var p = self->_get_ycoord;

            if (p == _p4)
            {
                d = _d4;
            }
            else
            {
                d = (get_ycoord_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_ycoord_delegate));
                if (_p4 == IntPtr.Zero)
                {
                    _d4 = d; _p4 = p;
                }
            }
            return(d(self));
        }
        public static void add_ref(cef_context_menu_params_t *self)
        {
            add_ref_delegate d;
            var p = self->_base._add_ref;

            if (p == _p0)
            {
                d = _d0;
            }
            else
            {
                d = (add_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_ref_delegate));
                if (_p0 == IntPtr.Zero)
                {
                    _d0 = d; _p0 = p;
                }
            }
            d(self);
        }
        public static int release(cef_context_menu_params_t *self)
        {
            release_delegate d;
            var p = self->_base._release;

            if (p == _p1)
            {
                d = _d1;
            }
            else
            {
                d = (release_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(release_delegate));
                if (_p1 == IntPtr.Zero)
                {
                    _d1 = d; _p1 = p;
                }
            }
            return(d(self));
        }
Example #10
0
        public static int is_pepper_menu(cef_context_menu_params_t *self)
        {
            is_pepper_menu_delegate d;
            var p = self->_is_pepper_menu;

            if (p == _p17)
            {
                d = _d17;
            }
            else
            {
                d = (is_pepper_menu_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_pepper_menu_delegate));
                if (_p17 == IntPtr.Zero)
                {
                    _d17 = d; _p17 = p;
                }
            }
            return(d(self));
        }
Example #11
0
        public static int is_spell_check_enabled(cef_context_menu_params_t *self)
        {
            is_spell_check_enabled_delegate d;
            var p = self->_is_spell_check_enabled;

            if (p == _p14)
            {
                d = _d14;
            }
            else
            {
                d = (is_spell_check_enabled_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_spell_check_enabled_delegate));
                if (_p14 == IntPtr.Zero)
                {
                    _d14 = d; _p14 = p;
                }
            }
            return(d(self));
        }
Example #12
0
        public static int is_editable(cef_context_menu_params_t *self)
        {
            is_editable_delegate d;
            var p = self->_is_editable;

            if (p == _p13)
            {
                d = _d13;
            }
            else
            {
                d = (is_editable_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(is_editable_delegate));
                if (_p13 == IntPtr.Zero)
                {
                    _d13 = d; _p13 = p;
                }
            }
            return(d(self));
        }
Example #13
0
        public static int get_dictionary_suggestions(cef_context_menu_params_t *self, cef_string_list *suggestions)
        {
            get_dictionary_suggestions_delegate d;
            var p = self->_get_dictionary_suggestions;

            if (p == _p12)
            {
                d = _d12;
            }
            else
            {
                d = (get_dictionary_suggestions_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_dictionary_suggestions_delegate));
                if (_p12 == IntPtr.Zero)
                {
                    _d12 = d; _p12 = p;
                }
            }
            return(d(self, suggestions));
        }
        public static CefContextMenuMediaType get_media_type(cef_context_menu_params_t *self)
        {
            get_media_type_delegate d;
            var p = self->_get_media_type;

            if (p == _pd)
            {
                d = _dd;
            }
            else
            {
                d = (get_media_type_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_media_type_delegate));
                if (_pd == IntPtr.Zero)
                {
                    _dd = d; _pd = p;
                }
            }
            return(d(self));
        }
Example #15
0
        public static cef_string_userfree *get_misspelled_word(cef_context_menu_params_t *self)
        {
            get_misspelled_word_delegate d;
            var p = self->_get_misspelled_word;

            if (p == _p11)
            {
                d = _d11;
            }
            else
            {
                d = (get_misspelled_word_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(get_misspelled_word_delegate));
                if (_p11 == IntPtr.Zero)
                {
                    _d11 = d; _p11 = p;
                }
            }
            return(d(self));
        }
Example #16
0
        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);
        }
Example #17
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();
        }
Example #18
0
        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 mState    = CefContextMenuParams.FromNative(@params);
            var mModel    = CefMenuModel.FromNative(model);
            var mCallback = CefRunContextMenuCallback.FromNative(callback);

            var result = RunContextMenu(mBrowser, mFrame, mState, mModel, mCallback);

            mState.Dispose();
            mModel.Dispose();

            return(result ? 1 : 0);
        }
Example #19
0
 private CefContextMenuParams(cef_context_menu_params_t* ptr)
 {
     if (ptr == null) throw new ArgumentNullException("ptr");
     _self = ptr;
 }
Example #20
0
        // 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));
        }
Example #21
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 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
        }
Example #22
0
 public CefContextMenuParams(cef_context_menu_params_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
Example #23
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);
     throw new NotImplementedException(); // TODO: CefContextMenuHandler.OnBeforeContextMenu
 }
 public unsafe int OnContextMenuCommand(cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, int command_id, CefEventFlags event_flags)
 {
     fixed(cef_context_menu_handler_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, cef_context_menu_params_t *, int, CefEventFlags, int >)on_context_menu_command)(self, browser, frame, @params, command_id, event_flags));
     }
 }
 public unsafe void OnBeforeContextMenu(cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model)
 {
     fixed(cef_context_menu_handler_t *self = &this)
     {
         ((delegate * unmanaged[Stdcall] < cef_context_menu_handler_t *, cef_browser_t *, cef_frame_t *, cef_context_menu_params_t *, cef_menu_model_t *, void >)on_before_context_menu)(self, browser, frame, @params, model);
     }
 }
Example #26
0
 public unsafe extern int OnContextMenuCommand(cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, int command_id, CefEventFlags event_flags);
Example #27
0
 public unsafe extern int RunContextMenu(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);
Example #28
0
 internal static CefContextMenuParams FromNative(cef_context_menu_params_t *ptr)
 {
     return(new CefContextMenuParams(ptr));
 }
Example #29
0
 public unsafe extern void OnBeforeContextMenu(cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model);