Пример #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ElementRef"/> class
        /// </summary>
        /// <param name="he">element handle</param>
        /// <param name="rt">reference text</param>
        /// <param name="attach">uses existing handle</param>
        private ElementRef(Element he, ElementRefType rt, bool attach)
        {
            Debug.Assert(rt != ElementRefType.Weak || !attach, "Weak handle cannot be attached");

            _referenceType = rt;
            switch (_referenceType)
            {
                case ElementRefType.Weak:
                    GC.SuppressFinalize(this);

                    _elementHwnd = SciterDomApi.GetElementHwnd(he, true);
                    _element = new IntPtr(SciterDomApi.GetElementUID(he));
                    break;
                case ElementRefType.Normal:
                    _element = he.Handle;

                    if (!attach)
                    {
                        SciterDomApi.UseElement(he.Handle);
                    }

                    break;
                default:
                    throw new ArgumentOutOfRangeException("rt", rt.ToString());
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="ElementRef"/> class
        /// </summary>
        /// <param name="he">element handle</param>
        /// <param name="rt">reference text</param>
        /// <param name="attach">uses existing handle</param>
        private ElementRef(Element he, ElementRefType rt, bool attach)
        {
            Debug.Assert(rt != ElementRefType.Weak || !attach, "Weak handle cannot be attached");

            _referenceType = rt;
            switch (_referenceType)
            {
            case ElementRefType.Weak:
                GC.SuppressFinalize(this);

                _elementHwnd = SciterDomApi.GetElementHwnd(he, true);
                _element     = new IntPtr(SciterDomApi.GetElementUID(he));
                break;

            case ElementRefType.Normal:
                _element = he.Handle;

                if (!attach)
                {
                    SciterDomApi.UseElement(he.Handle);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException("rt", rt.ToString());
            }
        }
Пример #3
0
 /// <summary>
 /// Creates a new instance of the <see cref="ElementRef"/> class
 /// </summary>
 internal ElementRef(Element he, ElementRefType rt)
     : this(he, rt, false)
 {
 }
Пример #4
0
 /// <summary>
 /// Allocates reference to the element
 /// </summary>
 /// <remarks>
 /// Element references uses ref counting and allowed to use between calls
 /// </remarks>
 public ElementRef Use(ElementRefType elementRefType)
 {
     return(new ElementRef(this, elementRefType));
 }
Пример #5
0
 /// <summary>
 /// Allocates reference to the element
 /// </summary>
 /// <remarks>
 /// Element references uses ref counting and allowed to use between calls
 /// </remarks>
 public ElementRef Use(ElementRefType elementRefType)
 {
     return new ElementRef(this, elementRefType);
 }
Пример #6
0
 /// <summary>
 /// Creates a new instance of the <see cref="ElementRef"/> class
 /// </summary>
 internal ElementRef(Element he, ElementRefType rt)
     : this(he, rt, false)
 {
 }