/// <summary> /// Add a sub-menu to the menu. The new sub-menu is returned. /// </summary> public CefMenuModel AddSubMenu(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) )); } }
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); }
/// <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 parameters, CefMenuModel model, CefRunContextMenuCallback callback) { return(false); }
/// <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 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) )); }
/// <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) )); }