Example #1
0
        /// <summary>
        /// Insert a sub-menu in the menu at the specified |index|. The new sub-menu is
        /// returned.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_menu_model_capi.h">cef/include/capi/cef_menu_model_capi.h</see>.
        /// </remarks>
        public CfxMenuModel InsertSubmenuAt(int index, int commandId, string label)
        {
            var label_pinned = new PinnedString(label);
            var __retval     = CfxApi.cfx_menu_model_insert_sub_menu_at(NativePtr, index, commandId, label_pinned.Obj.PinnedPtr, label_pinned.Length);

            label_pinned.Obj.Free();
            return(CfxMenuModel.Wrap(__retval));
        }
Example #2
0
        /// <summary>
        /// Add a sub-menu to the menu. The new sub-menu is returned.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_menu_model_capi.h">cef/include/capi/cef_menu_model_capi.h</see>.
        /// </remarks>
        public CfxMenuModel AddSubmenu(int commandId, string label)
        {
            var label_pinned = new PinnedString(label);
            var __retval     = CfxApi.cfx_menu_model_add_sub_menu(NativePtr, commandId, label_pinned.Obj.PinnedPtr, label_pinned.Length);

            label_pinned.Obj.Free();
            return(CfxMenuModel.Wrap(__retval));
        }
Example #3
0
 internal static CfxMenuModel Wrap(IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         return(null);
     }
     lock (weakCache) {
         var wrapper = (CfxMenuModel)weakCache.Get(nativePtr);
         if (wrapper == null)
         {
             wrapper = new CfxMenuModel(nativePtr);
             weakCache.Add(wrapper);
         }
         else
         {
             CfxApi.cfx_release(nativePtr);
         }
         return(wrapper);
     }
 }
Example #4
0
 /// <summary>
 /// Returns the submenu at the specified |index| or NULL if invalid.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_menu_model_capi.h">cef/include/capi/cef_menu_model_capi.h</see>.
 /// </remarks>
 public CfxMenuModel GetSubmenuAt(int index)
 {
     return(CfxMenuModel.Wrap(CfxApi.cfx_menu_model_get_sub_menu_at(NativePtr, index)));
 }
Example #5
0
 /// <summary>
 /// Returns the submenu for the specified |commandId| or NULL if invalid.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_menu_model_capi.h">cef/include/capi/cef_menu_model_capi.h</see>.
 /// </remarks>
 public CfxMenuModel GetSubmenu(int commandId)
 {
     return(CfxMenuModel.Wrap(CfxApi.cfx_menu_model_get_sub_menu(NativePtr, commandId)));
 }
Example #6
0
 /// <summary>
 /// Create a new MenuModel with the specified |delegate|.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_menu_model_capi.h">cef/include/capi/cef_menu_model_capi.h</see>.
 /// </remarks>
 public static CfxMenuModel Create(CfxMenuModelDelegate @delegate)
 {
     return(CfxMenuModel.Wrap(CfxApi.MenuModel.cfx_menu_model_create(CfxMenuModelDelegate.Unwrap(@delegate))));
 }
Example #7
0
 internal static CfxMenuModel Wrap(IntPtr nativePtr)
 {
     if(nativePtr == IntPtr.Zero) return null;
     lock(weakCache) {
         var wrapper = (CfxMenuModel)weakCache.Get(nativePtr);
         if(wrapper == null) {
             wrapper = new CfxMenuModel(nativePtr);
             weakCache.Add(wrapper);
         } else {
             CfxApi.cfx_release(nativePtr);
         }
         return wrapper;
     }
 }