コード例 #1
0
        public static bool RemovePage(StackedDialogPage page)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);
            var result  = UnsafeNativeMethods.IRhinoOptionsPage_Remove(pointer);

            return(result);
        }
コード例 #2
0
        public static bool GetSetIsPageModified(StackedDialogPage page, bool set, bool value)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);
            var result  = UnsafeNativeMethods.IRhinoOptionsPage_GetSetModified(pointer, set, value);

            return(result);
        }
コード例 #3
0
        public static bool SetActiveOptionsPage(StackedDialogPage page, string englishPageName, bool documentPropertiesPage)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);
            var result  = UnsafeNativeMethods.IRhinoOptionsPage_SetActiveOptionsPage(pointer, englishPageName, documentPropertiesPage);

            return(result);
        }
コード例 #4
0
 /// <summary>
 /// Construct IRhinoOptionsPage unmanaged pointers for OptionsDialogPage
 /// child pages.
 /// </summary>
 /// <param name="collectionItem"></param>
 /// <param name="page"></param>
 /// <param name="rhinoDocSn"></param>
 private static void ConstructIChildren(IntPtr collectionItem, StackedDialogPage page, uint rhinoDocSn)
 {
     if (collectionItem == IntPtr.Zero)
     {
         return;
     }
     foreach (var child in page.Children)
     {
         AddNewIOptionsPageToCollection(collectionItem, child, rhinoDocSn, true);
     }
 }
コード例 #5
0
        public static IntPtr PageCollectionWindowHandle(StackedDialogPage page)
        {
            if (Rhino.Runtime.HostUtils.RunningOnOSX)
            {
                return(IntPtr.Zero);
            }
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);
            var result  = UnsafeNativeMethods.IRhinoOptionsPage_HostWindowHandle(pointer);

            return(result);
        }
コード例 #6
0
        public static void SetGetTreeItemColor(StackedDialogPage page, ref System.Drawing.Color value, bool set)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);
            var argb    = value.ToArgb();
            var unset   = value == System.Drawing.Color.Empty;

            UnsafeNativeMethods.IRhinoOptionsPage_SetGetTreeItemColor(pointer, set, ref argb, ref unset);
            if (!set)
            {
                value = unset ? System.Drawing.Color.Empty : System.Drawing.ColorTranslator.FromWin32(argb);
            }
        }
コード例 #7
0
        public static IntPtr NewIRhinoOptionsPagePointer(StackedDialogPage page, uint rhinoDocRuntimeSn)
        {
            SetRhinoOptionsPageHooks();
            var id = Guid.Empty;
            // Appending the EnglishPageTitle to the end of the class name allows
            // a plug-in page class to get used more than once in the same options host,
            // this is the case in the Commands plug-in, there is a generic host that
            // creates specific panels for each page.
            var pointer = UnsafeNativeMethods.IRhinoOptionsPage_New(rhinoDocRuntimeSn, $"{page.GetType().FullName}.{page.EnglishPageTitle}", ref id);

            if (pointer != IntPtr.Zero)
            {
                g_irhino_page_dictionary.Add(id, new RhinoPageInsnce(page, pointer, null, rhinoDocRuntimeSn));
            }
            return(pointer);
        }
コード例 #8
0
        /// <summary>
        /// Allocate new IRhinoOptionsPage unmanaged pointers for a OptionsDialogPage
        /// and all of its children.
        /// </summary>
        /// <param name="collection"></param>
        /// <param name="page"></param>
        /// <param name="rhinoDocSn"></param>
        /// <param name="isChild"></param>
        /// <returns></returns>
        internal static IntPtr AddNewIOptionsPageToCollection(IntPtr collection, StackedDialogPage page, uint rhinoDocSn, bool isChild)
        {
            var page_pointer = NewIRhinoOptionsPagePointer(page, rhinoDocSn);

            if (page_pointer == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }
            var item_pointer = isChild
        ? UnsafeNativeMethods.CRhinoOptionsPageCollectionItem_AddPage(collection, page_pointer)
        : UnsafeNativeMethods.CRhinoOptionsPageCollection_AddPage(collection, page_pointer);

            if (item_pointer == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }
            ConstructIChildren(item_pointer, page, rhinoDocSn);
            return(page_pointer);
        }
コード例 #9
0
        /// <summary>
        /// Currently only supported on Windows.  Call this method to add a child
        /// page to a page after the parent dialog has been created.
        /// </summary>
        /// <param name="pageToAdd"></param>
        /// <since>6.0</since>
        public void AddChildPage(StackedDialogPage pageToAdd)
        {
            if (!Runtime.HostUtils.RunningOnWindows)
            {
                return;
            }
            var unmanaged_pointer = RhinoPageHooks.UnmanagedIRhinoPagePointerFromPage(this);

            if (unmanaged_pointer == IntPtr.Zero)
            {
                // The page array has not been processed yet so just append the page
                // to the end of the children list
                Children.Add(pageToAdd);
                return;
            }
            //
            // Unmanaged page has been created so create and add the new child page
            //
            // Use new IRhinoOptionsPageHost unmanaged interface to add the child page
            // Only allow adding child pages to OptionsDialogPages
            var pointer = pageToAdd is OptionsDialogPage
        ? RhinoPageHooks.NewIRhinoOptionsPagePointer(pageToAdd, RhinoPageHooks.RhinoDocRuntimeSerialNumberFromPage(this))
        : IntPtr.Zero;

            // Not a OptionsDialogPage or was unable to allocate a unmanaged pointer
            if (pointer == IntPtr.Zero)
            {
                return;
            }
            // Add the child page to this objects IRhinoOptionsPageHost
            if (!RhinoPageHooks.AddChildPage(unmanaged_pointer, pointer))
            {
                UnsafeNativeMethods.IRhinoOptionsPage_Delete(pointer);
                return;
            }
            // Put the new child page in the child array
            Children.Add(pageToAdd);
        }
コード例 #10
0
 public static bool UnmanagedPointerCreated(StackedDialogPage page)
 {
     return(page != null && g_irhino_page_dictionary.Any(item => item.Value.PageObject == page));
 }
コード例 #11
0
 public static IntPtr PageControlPointerFromPage(StackedDialogPage page)
 {
     return(page == null ? IntPtr.Zero : (from item in g_irhino_page_dictionary where item.Value.PageObject == page select item.Value.PageControlPointer).FirstOrDefault());
 }
コード例 #12
0
        // IRhinoOptionsPage_SetGetTreeItemBold
        public static void SetGetTreeItemBold(StackedDialogPage page, ref bool value, bool set)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);

            UnsafeNativeMethods.IRhinoOptionsPage_SetGetTreeItemBold(pointer, set, ref value);
        }
コード例 #13
0
        public static void MakeActivePage(StackedDialogPage page)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);

            UnsafeNativeMethods.IRhinoOptionsPage_MakeAcitvePage(pointer);
        }
コード例 #14
0
        public static void RefreshPageTitle(StackedDialogPage page)
        {
            var pointer = UnmanagedIRhinoPagePointerFromPage(page);

            UnsafeNativeMethods.IRhinoOptionsPage_RefreshPageTitle(pointer);
        }