Example #1
0
        private void menu_will_show(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model)
        {
            CheckSelf(self);

            var m_menuModel = CefMenuModel.FromNative(menu_model);

            MenuWillShow(m_menuModel);
        }
Example #2
0
        private void unhandled_close_submenu(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int is_rtl)
        {
            CheckSelf(self);

            var m_menuModel = CefMenuModel.FromNative(menu_model);

            UnhandledCloseSubmenu(m_menuModel, is_rtl != 0);
        }
Example #3
0
        private void menu_closed(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model)
        {
            CheckSelf(self);

            var m_menuModel = CefMenuModel.FromNative(menu_model);

            MenuClosed(m_menuModel);
        }
Example #4
0
        private void execute_command(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int command_id, CefEventFlags event_flags)
        {
            CheckSelf(self);

            var m_menuModel = CefMenuModel.FromNative(menu_model);

            ExecuteCommand(m_menuModel, command_id, event_flags);
        }
Example #5
0
        private void mouse_outside_menu(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_point_t *screen_point)
        {
            CheckSelf(self);

            var m_menuModel   = CefMenuModel.FromNative(menu_model);
            var m_screenPoint = new CefPoint(screen_point->x, screen_point->y);

            MouseOutsideMenu(m_menuModel, m_screenPoint);
        }
        /// <summary>
        /// Insert a sub-menu in the menu at the specified |index|. The new sub-menu
        /// is returned.
        /// </summary>
        public CefMenuModel InsertSubMenuAt(int index, int commandId, string label)
        {
            fixed(char *label_str = label)
            {
                var n_label = new cef_string_t(label_str, label.Length);

                return(CefMenuModel.FromNative(
                           cef_menu_model_t.add_sub_menu(_self, commandId, &n_label)
                           ));
            }
        }
Example #7
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 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);
        }
Example #9
0
        private int format_label(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_string_t *label)
        {
            CheckSelf(self);

            var m_menuModel = CefMenuModel.FromNative(menu_model);
            var m_label     = cef_string_t.ToString(label);

            if (FormatLabel(m_menuModel, ref m_label))
            {
                cef_string_t.Copy(m_label, label);
                return(1);
            }
            else
            {
                return(0);
            }
        }
 /// <summary>
 /// Create a new MenuModel with the specified |delegate|.
 /// </summary>
 public static CefMenuModel Create(CefMenuModelDelegate handler)
 {
     return(CefMenuModel.FromNative(
                cef_menu_model_t.create(handler.ToNative())
                ));
 }
Example #11
0
 protected override void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model)
 {
     // デフォルトのコンテキストメニューを無効化
     model.Clear();
 }
Example #12
0
 protected override void OnBeforeContextMenu( CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model )
 {
     model.Clear();
 }
Example #13
0
 /// <summary>
 /// The menu is about to show.
 /// </summary>
 protected abstract void MenuWillShow(CefMenuModel menuModel);
Example #14
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)
 {
 }
Example #15
0
 /// <summary>
 /// Called on unhandled close submenu keyboard commands. |is_rtl| will be true
 /// if the menu is displaying a right-to-left language.
 /// </summary>
 protected virtual void UnhandledCloseSubmenu(CefMenuModel menuModel, bool isRtl)
 {
 }
Example #16
0
 /// <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
 /// and execute |callback| either synchronously or asynchronously with the
 /// selected command ID. For default display return false. Do not keep
 /// references to |params| or |model| outside of this callback.
 /// </summary>
 protected virtual bool RunContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model, CefRunContextMenuCallback callback)
 {
     return(false);
 }
Example #17
0
 /// <summary>
 /// Called when the user moves the mouse outside the menu and over the owning
 /// window.
 /// </summary>
 protected virtual void MouseOutsideMenu(CefMenuModel menuModel, CefPoint screenPoint)
 {
 }
Example #18
0
 /// <summary>
 /// The menu has closed.
 /// </summary>
 protected abstract void MenuClosed(CefMenuModel menuModel);
Example #19
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)
 {
 }
 /// <summary>
 /// Returns the submenu for the specified |commandId| or empty if invalid.
 /// </summary>
 public CefMenuModel GetSubMenu(int commandId)
 {
     return(CefMenuModel.FromNativeOrNull(
                cef_menu_model_t.get_sub_menu(_self, commandId)
                ));
 }
Example #21
0
 /// <summary>
 /// Optionally modify a menu item label. Return true if |label| was modified.
 /// </summary>
 protected abstract bool FormatLabel(CefMenuModel menuModel, ref string label);
 /// <summary>
 /// Returns the submenu at the specified |index| or empty if invalid.
 /// </summary>
 public CefMenuModel GetSubMenuAt(int index)
 {
     return(CefMenuModel.FromNativeOrNull(
                cef_menu_model_t.get_sub_menu_at(_self, index)
                ));
 }
Example #23
0
 /// <summary>
 /// Perform the action associated with the specified |command_id| and
 /// optional |event_flags|.
 /// </summary>
 protected abstract void ExecuteCommand(CefMenuModel menuModel, int commandId, CefEventFlags eventFlags);