/// <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()); } }
/// <summary> /// Creates a new instance of the <see cref="ElementRef"/> class /// </summary> internal ElementRef(Element he, ElementRefType rt) : this(he, rt, false) { }
/// <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)); }
/// <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); }