/// <summary> /// Sets the managed HtmlControlBase parent, if it exists and is /// registered, for an HtmlElement. /// </summary> /// <param name="parentHtmlElement">The parent HtmlElement.</param> private void SetParentIfExists(HtmlElement parentHtmlElement) { if (parentHtmlElement != null && _parent == null && _allControls.HasControl(parentHtmlElement)) { _parent = _allControls.GetControl(parentHtmlElement); } }
/// <summary> /// Used by an extension method on System.Windows.Browser.HtmlElement to /// hook a managed control up by creating a real underlying element. /// </summary> /// <param name="parent">The HtmlElement to append the managed /// HtmlControl to.</param> /// <param name="control">The managed HtmlControlBase or HtmlControl to /// append, Initialize, and create with a real element.</param> internal static void AppendAndInitialize(HtmlElement parent, HtmlControlBase control) { // If the control is already out there with live and active // elements, the net effect of these calls is simply to initialize // any children of the control. control.CreateAndAppend(parent); control.Initialize(); }
/// <summary> /// Initializes a new CssSize. /// </summary> /// <param name="element">The element.</param> /// <param name="width">The width CSS property.</param> /// <param name="height">The height CSS property.</param> public CssSize(HtmlControlBase element, CssAttribute width, CssAttribute height) : base() { _mhe = element; _cssProperties = new CssAttribute[] { width, height }; }
/// <summary> /// Initializes a new CssBox type with the specified CSS property names. /// </summary> /// <param name="element">The parent managed HTML element.</param> /// <param name="top">The top property.</param> /// <param name="right">The right property.</param> /// <param name="bottom">The bottom property.</param> /// <param name="left">The left property.</param> public CssBox(HtmlControlBase element, CssAttribute top, CssAttribute right, CssAttribute bottom, CssAttribute left) : base() { _mhe = element; _cssProperties = new CssAttribute[] { top, right, bottom, left }; }
/// <summary> /// Retrieves a managed control instance, if any, for the HTML element. /// </summary> /// <param name="element">The HTML element.</param> /// <returns>Returns the managed control for an HTML element.</returns> public HtmlControlBase GetControl(HtmlElement element) { WeakReference key = GetKey(element); HtmlControlBase value = null; if (key != null && _managedControls.ContainsKey(key)) { value = _managedControls[key]; } return(value); }
public HtmlPageControl(HtmlElement existingElement) : base(existingElement) { // Attempt to load these immediately try { HtmlControlBase body = Body; HtmlControlBase head = Header; } catch (InvalidOperationException) { } }
/// <summary> /// Initializes a new margin type for the control. /// </summary> /// <param name="element">The owning element.</param> public CssMargin(HtmlControlBase element) : base(element, CssAttribute.MarginTop, CssAttribute.MarginRight, CssAttribute.MarginBottom, CssAttribute.MarginLeft) { }
/// <summary> /// Initializes a new position type. /// </summary> /// <param name="element">The owning element.</param> public CssPosition(HtmlControlBase element) : base(element, CssAttribute.Top, CssAttribute.Right, CssAttribute.Bottom, CssAttribute.Left) { }
/// <summary> /// Initializes a new padding type. /// </summary> /// <param name="element">The owning element.</param> public CssPadding(HtmlControlBase element) : base(element, CssAttribute.PaddingTop, CssAttribute.PaddingRight, CssAttribute.PaddingBottom, CssAttribute.PaddingLeft) { }
/// <summary> /// Append the managed HtmlControl to the HtmlElement. Extension method /// for HtmlElement. /// </summary> /// <param name="element">The HtmlElement.</param> /// <param name="control">The managed HtmlControlBase / HtmlControl.</param> public static void AppendChild(this HtmlElement element, HtmlControlBase control) { HtmlControlBase.AppendAndInitialize(element, control); }
/// <summary> /// Register a managed HTML element control with the collection. /// </summary> /// <param name="control">The Control object.</param> public void RegisterControl(HtmlControlBase control) { WeakReference wr = new WeakReference(control.HtmlElement); _managedControls[wr] = control; }
/// <summary> /// Check if the HtmlElement has a known managed control. /// </summary> /// <param name="element">The element object.</param> /// <returns>Returns whether the element has an attached control.</returns> public bool HasControl(HtmlElement element) { HtmlControlBase hcb = GetControl(element); return(hcb != null); }
/// <summary> /// Initializes a new attached CSS border for a managed HtmlElement. /// </summary> /// <param name="element">The owner of the border.</param> public CssBorder(HtmlControlBase element) : base(element, CssAttribute.BorderTop, CssAttribute.BorderRight, CssAttribute.BorderBottom, CssAttribute.BorderLeft) { }
/// <summary> /// Initializes a FontInfo object. /// </summary> /// <param name="owner">The owning Control reference.</param> public FontInfo(HtmlControlBase owner) { _owner = owner; }