/// <summary>
        /// Gets a list of the detail view objects associated with this layout.
        /// </summary>
        /// <returns>A detail view object array. This can be null, but not empty.</returns>
        public Rhino.DocObjects.DetailViewObject[] GetDetailViews()
        {
            IntPtr pList = UnsafeNativeMethods.CRhinoDetailViewArray_New();
            IntPtr ptr   = NonConstPointer();
            int    count = UnsafeNativeMethods.CRhinoPageView_GetDetailViewObjects(ptr, pList);

            if (count < 1)
            {
                UnsafeNativeMethods.CRhinoDetailViewArray_Delete(pList);
                return(null);
            }

            Rhino.DocObjects.DetailViewObject[] rc = new Rhino.DocObjects.DetailViewObject[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr pDetail = UnsafeNativeMethods.CRhinoDetailViewArray_Item(pList, i);
                if (pDetail != IntPtr.Zero)
                {
                    uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(pDetail);
                    rc[i] = new Rhino.DocObjects.DetailViewObject(sn);
                }
            }
            UnsafeNativeMethods.CRhinoDetailViewArray_Delete(pList);
            return(rc);
        }
        /// <summary>
        /// Creates a detail view object that is displayed on this page and adds it to the doc.
        /// </summary>
        /// <param name="title">The detail view title.</param>
        /// <param name="corner0">Corners of the detail view in world coordinates.</param>
        /// <param name="corner1">Corners of the detail view in world coordinates.</param>
        /// <param name="initialProjection">The defined initial projection type.</param>
        /// <returns>Newly created detail view on success. null on error.</returns>
        /// <example>
        /// <code source='examples\vbnet\ex_addlayout.vb' lang='vbnet'/>
        /// <code source='examples\cs\ex_addlayout.cs' lang='cs'/>
        /// <code source='examples\py\ex_addlayout.py' lang='py'/>
        /// </example>
        public Rhino.DocObjects.DetailViewObject AddDetailView(string title,
                                                               Rhino.Geometry.Point2d corner0,
                                                               Rhino.Geometry.Point2d corner1,
                                                               DefinedViewportProjection initialProjection)
        {
            IntPtr pThis   = NonConstPointer();
            IntPtr pDetail = UnsafeNativeMethods.CRhinoPageView_AddDetailView(pThis, corner0, corner1, title, (int)initialProjection);

            Rhino.DocObjects.DetailViewObject rc = null;
            if (pDetail != IntPtr.Zero)
            {
                uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(pDetail);
                rc = new Rhino.DocObjects.DetailViewObject(sn);
            }
            return(rc);
        }
 internal RhinoViewport(Rhino.DocObjects.DetailViewObject detail)
 {
   m_parent_detail = detail;
 }
    /// <summary>
    /// Gets a list of the detail view objects associated with this layout.
    /// </summary>
    /// <returns>A detail view object array. This can be null, but not empty.</returns>
    public Rhino.DocObjects.DetailViewObject[] GetDetailViews()
    {
      IntPtr pList = UnsafeNativeMethods.CRhinoDetailViewArray_New();
      IntPtr ptr = NonConstPointer();
      int count = UnsafeNativeMethods.CRhinoPageView_GetDetailViewObjects(ptr, pList);
      if (count < 1)
      {
        UnsafeNativeMethods.CRhinoDetailViewArray_Delete(pList);
        return null;
      }

      Rhino.DocObjects.DetailViewObject[] rc = new Rhino.DocObjects.DetailViewObject[count];
      for (int i = 0; i < count; i++)
      {
        IntPtr pDetail = UnsafeNativeMethods.CRhinoDetailViewArray_Item(pList, i);
        if (pDetail != IntPtr.Zero)
        {
          uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(pDetail);
          rc[i] = new Rhino.DocObjects.DetailViewObject(sn);
        }
      }
      UnsafeNativeMethods.CRhinoDetailViewArray_Delete(pList);
      return rc;
    }
 /// <summary>
 /// Creates a detail view object that is displayed on this page and adds it to the doc.
 /// </summary>
 /// <param name="title">The detail view title.</param>
 /// <param name="corner0">Corners of the detail view in world coordinates.</param>
 /// <param name="corner1">Corners of the detail view in world coordinates.</param>
 /// <param name="initialProjection">The defined initial projection type.</param>
 /// <returns>Newly created detail view on success. null on error.</returns>
 /// <example>
 /// <code source='examples\vbnet\ex_addlayout.vb' lang='vbnet'/>
 /// <code source='examples\cs\ex_addlayout.cs' lang='cs'/>
 /// <code source='examples\py\ex_addlayout.py' lang='py'/>
 /// </example>
 public Rhino.DocObjects.DetailViewObject AddDetailView(string title,
   Rhino.Geometry.Point2d corner0,
   Rhino.Geometry.Point2d corner1,
   DefinedViewportProjection initialProjection)
 {
   IntPtr pThis = NonConstPointer();
   IntPtr pDetail = UnsafeNativeMethods.CRhinoPageView_AddDetailView(pThis, corner0, corner1, title, (int)initialProjection);
   Rhino.DocObjects.DetailViewObject rc = null;
   if (pDetail != IntPtr.Zero)
   {
     uint sn = UnsafeNativeMethods.CRhinoObject_RuntimeSN(pDetail);
     rc = new Rhino.DocObjects.DetailViewObject(sn);
   }
   return rc;
 }