Example #1
0
 /// <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);
     }
 }
Example #2
0
 /// <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();
 }
Example #3
0
 /// <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();
 }
Example #4
0
 /// <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
     };
 }
Example #5
0
File: CssBox.cs Project: ynkbt/moon
 /// <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
     };
 }
Example #6
0
File: CssBox.cs Project: dfr0/moon
 /// <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
     };
 }
Example #7
0
        /// <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);
        }
Example #8
0
 public HtmlPageControl(HtmlElement existingElement)
     : base(existingElement)
 {
     // Attempt to load these immediately
     try
     {
         HtmlControlBase body = Body;
         HtmlControlBase head = Header;
     }
     catch (InvalidOperationException)
     {
     }
 }
Example #9
0
 /// <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)
 {
 }
Example #10
0
 /// <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) { }
Example #11
0
 /// <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)
 {
 }
Example #12
0
 /// <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);
 }
Example #13
0
 /// <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;
 }
Example #14
0
        /// <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);
        }
Example #15
0
        /// <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;
        }
Example #16
0
 /// <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) { }
Example #17
0
 /// <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)
 {
 }
Example #18
0
 /// <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) { }
Example #19
0
 /// <summary>
 /// Initializes a FontInfo object.
 /// </summary>
 /// <param name="owner">The owning Control reference.</param>
 public FontInfo(HtmlControlBase owner)
 {
     _owner = owner;
 }
Example #20
0
 /// <summary>
 /// Initializes a FontInfo object.
 /// </summary>
 /// <param name="owner">The owning Control reference.</param>
 public FontInfo(HtmlControlBase owner) 
 {
     _owner = owner;
 }
Example #21
0
 /// <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) { }
Example #22
0
 /// <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);
     }
 }
Example #23
0
 /// <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);
 }
Example #24
0
 /// <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)
 {
 }