public static void InheritStyles(BoxSpec target, BoxSpec source)
        {
            //----------------------------------------
            if (source == null)
            {
                return;
            }
            //---------------------------------------
            //only inheritable feautures 
            target._fontFeats = source._fontFeats;
            target._listFeats = source._listFeats;
            //--------------------------------------- 
            target._lineHeight = source._lineHeight;
            target._textIndent = source._textIndent;
            target._actualColor = source._actualColor;
            target._emptyCells = source._emptyCells;
            //--------------------------------------- 
            target._textAlign = source._textAlign;
            target._verticalAlign = source._verticalAlign;
            target._visibility = source._visibility;
            target._whitespace = source._whitespace;
            target._wordBreak = source._wordBreak;
            target._cssDirection = source._cssDirection;
            //--------------------------------------- 

        }
Ejemplo n.º 2
0
        public override LayoutFarm.HtmlBoxes.CssBox CreateCssBox(
            DomElement domE,
            LayoutFarm.HtmlBoxes.CssBox parentBox,
            BoxSpec spec,
            HtmlHost host)
        {
            switch (domE.Name)
            {
            case "input":
            {
                var inputBox = CreateInputBox(domE, parentBox, spec, myHost.RootGfx, host);
                if (inputBox != null)
                {
                    return(inputBox);
                }
            }
            break;

            case "canvas":
            {
                //test only
                //TODO: review here
                var canvas     = new LayoutFarm.CustomWidgets.MiniAggCanvasBox(400, 400);
                var wrapperBox = CreateWrapper(
                    canvas,
                    canvas.GetPrimaryRenderElement(myHost.RootGfx),
                    spec, true);
                parentBox.AppendChild(wrapperBox);
                return(wrapperBox);
            }
            }

            //default unknown
            var simpleBox = new LayoutFarm.CustomWidgets.Box(100, 20);

            simpleBox.BackColor = PixelFarm.Drawing.Color.LightGray;
            var wrapperBox2 = CreateWrapper(
                simpleBox,
                simpleBox.GetPrimaryRenderElement(myHost.RootGfx),
                spec, false);

            parentBox.AppendChild(wrapperBox2);
            return(wrapperBox2);
        }
Ejemplo n.º 3
0
        public CssBox(BoxSpec spec)
        {
            _aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (__aa_dbugId == 13)
            //{
            //}
            //if (!spec.IsFreezed)
            //{
            //    //must be freezed
            //    throw new NotSupportedException();
            //}
#endif

            //assign spec
            _myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Ejemplo n.º 4
0
        public CssBox(BoxSpec spec, IRootGraphics rootgfx)
        {
            this.rootgfx   = rootgfx;
            this._aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (this.__aa_dbugId == 6)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec
            this._myspec = spec;
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Ejemplo n.º 5
0
        public static CssBox CreateCssWrapper(HtmlHost htmlhost,
                                              object owner,
                                              RenderElement renderElement,
                                              BoxSpec spec,
                                              ISubDomExtender subDomExtender,
                                              bool isInline)
        {
            if (!(owner is IEventPortal portalEvent))
            {
                portalEvent = new RenderElementEventPortal(renderElement);
            }

            if (isInline)
            {
                return(new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperInlineCssBox(htmlhost, portalEvent, spec, renderElement.Root, renderElement, subDomExtender));
            }
            else
            {
                return(new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperBlockCssBox(htmlhost, portalEvent, spec, renderElement, subDomExtender));
            }
        }
        public static CssBox CreateWrapper(HtmlHost htmlhost,
                                           object owner,
                                           RenderElement renderElement,
                                           BoxSpec spec,
                                           bool isInline)
        {
            var portalEvent = owner as IEventPortal;

            if (portalEvent == null)
            {
                portalEvent = new RenderElementEventPortal(renderElement);
            }

            if (isInline)
            {
                return(new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperInlineCssBox(htmlhost, portalEvent, spec, renderElement.Root, renderElement));
            }
            else
            {
                return(new LayoutFarm.HtmlBoxes.InternalWrappers.WrapperBlockCssBox(htmlhost, portalEvent, spec, renderElement));
            }
        }
Ejemplo n.º 7
0
        public CssBox(BoxSpec spec, CssDisplay displayType)
        {
            _aa_boxes = new CssBoxCollection();
#if DEBUG
            //if (__aa_dbugId == 13)
            //{
            //}
            if (!spec.IsFreezed)
            {
                //must be freezed
                throw new NotSupportedException();
            }
#endif

            //assign spec
            _boxCompactFlags |= BoxFlags.DONT_CHANGE_DISPLAY_TYPE;
            _cssDisplay       = displayType;
            _myspec           = spec;
            //----------------------------
            EvaluateSpec(spec);
            ChangeDisplayType(this, _myspec.CssDisplay);
        }
Ejemplo n.º 8
0
 static void SetBackgroundPosition(this BoxSpec box, WebDom.CssCodeValueExpression value)
 {
     //TODO: implement background position from combination value
     throw new NotSupportedException();
 }
Ejemplo n.º 9
0
 public static void AddRunList(CssBox toBox, BoxSpec spec, HtmlTextNode textnode)
 {
     AddRunList(toBox, spec, textnode.InternalGetRuns(), textnode.GetOriginalBuffer(), textnode.IsWhiteSpace);
 }
Ejemplo n.º 10
0
        static void SetFontSize(this BoxSpec box, WebDom.CssCodeValueExpression value)
        {
            //number + value
            WebDom.CssCodePrimitiveExpression primValue = value as WebDom.CssCodePrimitiveExpression;
            if (primValue == null)
            {
                return;
            }
            switch (primValue.Hint)
            {
            case WebDom.CssValueHint.Number:
            {
                //has unit or not
                //?
                //or percent ?

                CssLength len = UserMapUtil.AsLength(primValue);
                if (len.HasError)
                {
                    len = CssLength.FontSizeMedium;
                }
                box.FontSize = len;
            }
            break;

            case WebDom.CssValueHint.Iden:
            {
                switch (primValue.GetTranslatedStringValue())
                {
                default:
                {
                    throw new NotSupportedException();
                }

                case CssConstants.Medium:
                    box.FontSize = CssLength.FontSizeMedium;
                    break;

                case CssConstants.Small:
                    box.FontSize = CssLength.FontSizeSmall;
                    break;

                case CssConstants.XSmall:
                    box.FontSize = CssLength.FontSizeXSmall;
                    break;

                case CssConstants.XXSmall:
                    box.FontSize = CssLength.FontSizeXXSmall;
                    break;

                case CssConstants.Large:
                    box.FontSize = CssLength.FontSizeLarge;
                    break;

                case CssConstants.XLarge:
                    box.FontSize = CssLength.FontSizeLarge;
                    break;

                case CssConstants.XXLarge:
                    box.FontSize = CssLength.FontSizeLarger;
                    break;

                case CssConstants.Smaller:
                    box.FontSize = CssLength.FontSizeSmaller;
                    break;

                case CssConstants.Larger:
                    box.FontSize = CssLength.FontSizeLarger;
                    break;
                }
            }
            break;
            }
        }
Ejemplo n.º 11
0
        CssBox CreateInputBox(HtmlElement domE,
                              CssBox parentBox,
                              BoxSpec spec,
                              HtmlHost host)
        {
            //https://www.w3schools.com/tags/tag_input.asp
            //button
            //checkbox
            //color
            //date
            //datetime - local
            //email
            //file
            //hidden
            //image
            //month
            //number
            //password
            //radio
            //range
            //reset
            //search
            //submit
            //tel
            //text
            //time
            //url
            //week
            HtmlInputElement htmlInputElem = (HtmlInputElement)domE;
            var typeAttr = domE.FindAttribute("type");

            if (typeAttr != null)
            {
                switch (typeAttr.Value)
                {
                case "password":
                {
                    var textbox = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false, true);
                    textbox.TextBoxSwitcher = _textboxSwitcher;

                    var subdomExtender = new TextBoxInputSubDomExtender(textbox);

                    CssBox wrapperBox = CreateCssWrapper(
                        host,
                        textbox,
                        textbox.GetPrimaryRenderElement(),
                        spec,
                        subdomExtender,
                        true);

                    textbox.KeyDown += (s, e) =>
                    {
                        ((LayoutFarm.UI.IUIEventListener)htmlInputElem).ListenKeyDown(e);
                    };


                    htmlInputElem.SubDomExtender = subdomExtender;        //connect

                    //place holder support
                    DomAttribute placeHolderAttr = domE.FindAttribute("placeholder");
                    if (placeHolderAttr != null)
                    {
                        textbox.PlaceHolderText = placeHolderAttr.Value;
                    }
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "text":
                {
                    //TODO: user can specific width of textbox
                    var textbox = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false);
                    textbox.TextBoxSwitcher = _textboxSwitcher;

                    var subdomExtender = new TextBoxInputSubDomExtender(textbox);

                    CssBox wrapperBox = CreateCssWrapper(
                        host,
                        textbox,
                        textbox.GetPrimaryRenderElement(),
                        spec,
                        subdomExtender,
                        true);

                    textbox.KeyDown += (s, e) =>
                    {
                        ((LayoutFarm.UI.IUIEventListener)htmlInputElem).ListenKeyDown(e);
                    };

                    htmlInputElem.SubDomExtender = subdomExtender;        //connect

                    //place holder support
                    DomAttribute placeHolderAttr = domE.FindAttribute("placeholder");
                    if (placeHolderAttr != null)
                    {
                        textbox.PlaceHolderText = placeHolderAttr.Value;
                    }
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "button":
                {
                    //use subdom technique ***
                    //todo: review the technique here
                    var button       = new HtmlWidgets.Button(60, 30);
                    var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;
                    if (ihtmlElement != null)
                    {
                        button.Text = ihtmlElement.innerHTML;
                    }
                    else
                    {
                        button.Text = "testButton";
                    }

                    HtmlElement buttonDom = button.GetPresentationDomNode(domE);
                    buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:white;cursor:pointer");
                    CssBox buttonCssBox = host.CreateCssBox(parentBox, buttonDom, true);
                    parentBox.AppendChild(buttonCssBox);
                    return(buttonCssBox);
                }

                case "checkbox":
                {
                    //implement with choice box + multiple value

                    var chkbox = new HtmlWidgets.ChoiceBox(18, 10);
                    chkbox.SetHtmlInputBox(htmlInputElem);
                    chkbox.OnlyOne = false;         //*** show as checked box

                    HtmlElement chkBoxElem = chkbox.GetPresentationDomNode(domE);
                    //buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:red;cursor:pointer");

                    CssBox chkCssBox = host.CreateCssBox(parentBox, chkBoxElem, true); //create and append to the parentBox
                    htmlInputElem.SubDomExtender = chkbox;                             //connect

#if DEBUG
                    chkCssBox.dbugMark1 = 1;
#endif
                    return(chkCssBox);
                }

                case "radio":
                {
                    var radio = new HtmlWidgets.ChoiceBox(10, 10);
                    radio.OnlyOne = true;        // show as option box
                    HtmlElement radioElem = radio.GetPresentationDomNode(domE);
                    //buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:red;cursor:pointer");

                    CssBox buttonCssBox = host.CreateCssBox(parentBox, radioElem, true); //create and append to the parentBox
                    htmlInputElem.SubDomExtender = radio;                                //connect

#if DEBUG
                    buttonCssBox.dbugMark1 = 1;
#endif
                    return(buttonCssBox);
                }

                case "your_box":
                {
                    //tempfix -> just copy the Button code,
                    //TODO: review here, use proper radio button
                    var    box        = new LayoutFarm.CustomWidgets.Box(20, 20);
                    CssBox wrapperBox = CreateCssWrapper(
                        host,
                        box,
                        box.GetPrimaryRenderElement(),
                        spec,
                        null,
                        true);
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }
                }
            }
            return(null);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// evaluate computed value
        /// </summary>
        internal void ReEvaluateComputedValues(ITextService iFonts, CssBox containingBlock)
        {
            //depend on parent
            //1. fonts
            if (this.ParentBox != null)
            {
                ReEvaluateFont(iFonts, this.ParentBox.ResolvedFont.SizeInPixels);
                //2. actual word spacing
                //this._actualWordSpacing = this.NoEms(this.InitSpec.LineHeight);
                //3. font size
                //len = len.ConvertEmToPoints(parentBox.ActualFont.SizeInPoints);
            }
            else
            {
                ReEvaluateFont(iFonts, containingBlock.ResolvedFont.SizeInPixels);
                //this._actualFont = this.Spec.GetFont(containingBlock.Spec);
            }

            //-----------------------------------------------------------------------
            float cbWidth            = containingBlock.VisualWidth;
            int   tmpBoxCompactFlags = this._boxCompactFlags;

            this._boxCompactFlags |= BoxFlags.LAY_EVAL_COMPUTE_VALUES;
            //www.w3.org/TR/CSS2/box.html#margin-properties
            //w3c: margin applies to all elements except elements table display type
            //other than table-caption,table and inline table
            var     cssDisplay = this.CssDisplay;
            BoxSpec spec       = _myspec;

            switch (cssDisplay)
            {
            case CssDisplay.None:
            {
                return;
            }

            case CssDisplay.TableCell:
            case CssDisplay.TableColumn:
            case CssDisplay.TableColumnGroup:
            case CssDisplay.TableFooterGroup:
            case CssDisplay.TableHeaderGroup:
            case CssDisplay.TableRow:
            case CssDisplay.TableRowGroup:
            {
                //no margin
            }
            break;

            default:
            {
                //if (this.__aa_dbugId == 5)
                //{
                //    int a = spec.__aa_dbugId;

                //}

                this._actualMarginLeft   = RecalculateMargin(spec.MarginLeft, cbWidth);
                this._actualMarginTop    = RecalculateMargin(spec.MarginTop, cbWidth);
                this._actualMarginRight  = RecalculateMargin(spec.MarginRight, cbWidth);
                this._actualMarginBottom = RecalculateMargin(spec.MarginBottom, cbWidth);
            }
            break;
            }
            //www.w3.org/TR/CSS2/box.html#padding-properties
            switch (cssDisplay)
            {
            case CssDisplay.TableRowGroup:
            case CssDisplay.TableHeaderGroup:
            case CssDisplay.TableFooterGroup:
            case CssDisplay.TableRow:
            case CssDisplay.TableColumnGroup:
            case CssDisplay.TableColumn:
            {
                //no padding
            }
            break;

            default:
            {
                //-----------------------------------------------------------------------
                //padding
                this._actualPaddingLeft   = RecalculatePadding(spec.PaddingLeft, cbWidth);
                this._actualPaddingTop    = RecalculatePadding(spec.PaddingTop, cbWidth);
                this._actualPaddingRight  = RecalculatePadding(spec.PaddingRight, cbWidth);
                this._actualPaddingBottom = RecalculatePadding(spec.PaddingBottom, cbWidth);
            }
            break;
            }

            //-----------------------------------------------------------------------
            //borders
            float a1, a2, a3, a4;

            this._actualBorderLeftWidth   = a1 = (spec.BorderLeftStyle == CssBorderStyle.None) ? 0 : CssValueParser.GetActualBorderWidth(spec.BorderLeftWidth, this);
            this._actualBorderTopWidth    = a2 = (spec.BorderTopStyle == CssBorderStyle.None) ? 0 : CssValueParser.GetActualBorderWidth(spec.BorderTopWidth, this);
            this._actualBorderRightWidth  = a3 = (spec.BorderRightStyle == CssBorderStyle.None) ? 0 : CssValueParser.GetActualBorderWidth(spec.BorderRightWidth, this);
            this._actualBorderBottomWidth = a4 = (spec.BorderBottomStyle == CssBorderStyle.None) ? 0 : CssValueParser.GetActualBorderWidth(spec.BorderBottomWidth, this);
            //---------------------------------------------------------------------------

            this._borderLeftVisible  = a1 > 0 && spec.BorderLeftStyle >= CssBorderStyle.Visible;
            this._borderTopVisible   = a2 > 0 && spec.BorderTopStyle >= CssBorderStyle.Visible;
            this._borderRightVisible = a3 > 0 && spec.BorderRightStyle >= CssBorderStyle.Visible;
            this._borderBottomVisble = a4 > 0 && spec.BorderBottomStyle >= CssBorderStyle.Visible;
            //extension ***
            if (a1 + a2 + a3 + a4 > 0)
            {
                //css 2.1 border can't be nagative values

                tmpBoxCompactFlags |= BoxFlags.HAS_SOME_VISIBLE_BORDER;
            }
            else
            {
                tmpBoxCompactFlags &= ~BoxFlags.HAS_SOME_VISIBLE_BORDER;
            }
            //---------------------------------------------------------------------------

            this._actualCornerNE = a1 = CssValueParser.ConvertToPx(spec.CornerNERadius, 0, this);
            this._actualCornerNW = a2 = CssValueParser.ConvertToPx(spec.CornerNWRadius, 0, this);
            this._actualCornerSE = a3 = CssValueParser.ConvertToPx(spec.CornerSERadius, 0, this);
            this._actualCornerSW = a4 = CssValueParser.ConvertToPx(spec.CornerSWRadius, 0, this);
            if ((a1 + a2 + a3 + a4) > 0)
            {
                //evaluate
                tmpBoxCompactFlags |= BoxFlags.HAS_ROUND_CORNER;
            }
            else
            {
                tmpBoxCompactFlags &= ~BoxFlags.HAS_ROUND_CORNER;
            }
            //---------------------------------------------------------------------------
            //evaluate bg

            if (BackgroundGradient != Color.Transparent ||
                RenderUtils.IsColorVisible(ActualBackgroundColor))
            {
                tmpBoxCompactFlags |= BoxFlags.HAS_VISIBLE_BG;
            }
            else
            {
                tmpBoxCompactFlags &= ~BoxFlags.HAS_VISIBLE_BG;
            }



            if (spec.WordSpacing.IsNormalWordSpacing)
            {
                this._actualWordSpacing = iFonts.MeasureWhitespace(_resolvedFont);
            }
            else
            {
                this._actualWordSpacing = iFonts.MeasureWhitespace(_resolvedFont)
                                          + CssValueParser.ConvertToPx(spec.WordSpacing, 1, this);
            }
            //----------------------------------------------
            this._boxCompactFlags = tmpBoxCompactFlags;
            //----------------------------------------------

            //text indent
            this._actualTextIndent = CssValueParser.ConvertToPx(spec.TextIndent, containingBlock.VisualWidth, this);
            this._actualBorderSpacingHorizontal = spec.BorderSpacingHorizontal.Number;
            this._actualBorderSpacingVertical   = spec.BorderSpacingVertical.Number;
            //-----------------------
            //this._actualLineHeight = 0.9f * CssValueParser.ConvertToPx(LineHeight, this.GetEmHeight(), this);
            //expected width expected height
            //this._expectedWidth = CssValueParser.ParseLength(Width, cbWidth, this);
            //this._expectedHight = CssValueParser.ParseLength(Height, containingBlock.SizeHeight, this);
            ////----------------------------------------------


            //www.w3.org/TR/CSS2/visudet.html#line-height
            //line height,
            //percent value of line height :
            // is refer to font size of the element itself
            //if (this.LineHeight.Number > 0)
            //{
            //    _actualLineHeight = .9f * CssValueParser.ConvertToPx(LineHeight, this.GetEmHeight(), this);
            //}
            //else
            //{
            //    _actualLineHeight = .9f * (this.GetEmHeight());
            //}


            if (this._myspec.HasBoxShadow)
            {
                //temp fix here
                //TODO: review move shadow to external decoration object/box
                if (decorator == null)
                {
                    decorator = new CssBoxDecorator();
                }
                decorator.HBoxShadowOffset = (int)CssValueParser.ConvertToPx(spec.BoxShadowHOffset, 0, this);
                decorator.VBoxShadowOffset = (int)CssValueParser.ConvertToPx(spec.BoxShadowVOffset, 0, this);
                decorator.Color            = spec.BoxShadowColor;
            }
            else
            {
                this.decorator = null;
            }
        }
        public static void CloneAllStyles(BoxSpec target, BoxSpec source)
        {
            //1.
            //=====================================
            //if (s._fontFeats.Owner == s)
            //{
            //    //this._fontFeats = s._fontFeats;
            //}
            target._fontFeats = source._fontFeats;
            target._listFeats = source._listFeats;
            //--------------------------------------- 
            target._lineHeight = source._lineHeight;
            target._textIndent = source._textIndent;
            target._actualColor = source._actualColor;
            target._emptyCells = source._emptyCells;
            //--------------------------------------- 
            target._textAlign = source._textAlign;
            target._verticalAlign = source._verticalAlign;
            target._visibility = source._visibility;
            target._whitespace = source._whitespace;
            target._wordBreak = source._wordBreak;
            target._cssDirection = source._cssDirection;
            //---------------------------------------

            //2.
            //for clone only (eg. split a box into two parts)
            //=======================================
            target._boxSizing = source._boxSizing;
            target._backgroundFeats = source._backgroundFeats;
            target._borderFeats = source._borderFeats;
            target._cornerFeats = source._cornerFeats;
#if DEBUG
            //if (target.__aa_dbugId == 9)
            //{
            //    int ss= source.__aa_dbugId;

            //}
#endif
            target._marginFeats = source._marginFeats;
            target._paddingFeats = source._paddingFeats;
            //---------------------------------------
            //if (target.__aa_dbugId == 8)
            //{
            //}
            target._cssDisplay = source._cssDisplay;
            target._left = source._left;
            target._top = source._top;
            target._bottom = source._bottom;
            target._right = source._right;
            target._width = source._width;
            target._height = source._height;
            target._maxWidth = source._maxWidth;
            target._position = source._position;
            target._wordSpacing = source._wordSpacing;
            target._lineHeight = source._lineHeight;
            target._float = source._float;
            target._overflow = source._overflow;
            target._textDecoration = source._textDecoration;
            //3.
            //===================================== 
            target._cssDirection = source._cssDirection;
        }
Ejemplo n.º 14
0
 public CssIsolateBox(BoxSpec spec)
     : base(spec)
 {
 }
Ejemplo n.º 15
0
        internal CssBox CreateBox(CssBox parentBox, HtmlElement childElement, bool fullmode)
        {
            //-----------------------------------------
            //1. create new box
            //-----------------------------------------
            //some box has predefined behaviour
            CssBox newBox = null;

            switch (childElement.WellknownElementName)
            {
            case WellKnownDomNodeName.br:
                //special treatment for br
                newBox = new CssBox(childElement.Spec, parentBox.RootGfx);
                newBox.SetController(childElement);
                CssBox.SetAsBrBox(newBox);
                CssBox.ChangeDisplayType(newBox, CssDisplay.Block);
                parentBox.AppendChild(newBox);
                childElement.SetPrincipalBox(newBox);
                return(newBox);

            case WellKnownDomNodeName.img:

                //auto append newBox to parentBox
                newBox = CreateImageBox(parentBox, childElement);
                childElement.SetPrincipalBox(newBox);
                return(newBox);

            case WellKnownDomNodeName.hr:
                newBox = new CssBoxHr(childElement.Spec, parentBox.RootGfx);
                newBox.SetController(childElement);
                parentBox.AppendChild(newBox);
                childElement.SetPrincipalBox(newBox);
                return(newBox);

            //-----------------------------------------------------
            //TODO: simplify this ...
            //table-display elements, fix display type
            case WellKnownDomNodeName.td:
            case WellKnownDomNodeName.th:
                newBox = TableBoxCreator.CreateTableCell(parentBox, childElement, true);
                break;

            case WellKnownDomNodeName.col:
                newBox = TableBoxCreator.CreateTableColumnOrColumnGroup(parentBox, childElement, true, CssDisplay.TableColumn);
                break;

            case WellKnownDomNodeName.colgroup:
                newBox = TableBoxCreator.CreateTableColumnOrColumnGroup(parentBox, childElement, true, CssDisplay.TableColumnGroup);
                break;

            case WellKnownDomNodeName.tr:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.TableRow);
                break;

            case WellKnownDomNodeName.tbody:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.TableRowGroup);
                break;

            case WellKnownDomNodeName.table:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.Table);
                break;

            case WellKnownDomNodeName.caption:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.TableCaption);
                break;

            case WellKnownDomNodeName.thead:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.TableHeaderGroup);
                break;

            case WellKnownDomNodeName.tfoot:
                newBox = TableBoxCreator.CreateOtherPredefinedTableElement(parentBox, childElement, CssDisplay.TableFooterGroup);
                break;

            //---------------------------------------------------
            case WellKnownDomNodeName.canvas:
            case WellKnownDomNodeName.input:

                newBox = this.CreateCustomCssBox(parentBox, childElement, childElement.Spec);
                if (newBox != null)
                {
                    childElement.SetPrincipalBox(newBox);
                    return(newBox);
                }
                goto default;     //else goto default ***

            //---------------------------------------------------
            case WellKnownDomNodeName.svg:
            {
                //1. create svg container node
                newBox = _svgCreator.CreateSvgBox(parentBox, childElement, childElement.Spec);
                childElement.SetPrincipalBox(newBox);
                return(newBox);
            }

            case WellKnownDomNodeName.NotAssign:
            case WellKnownDomNodeName.Unknown:
            {
                //custom tag
                //check if this is tag is registered as custom element
                //-----------------------------------------------
                if (childElement.HasCustomPrincipalBoxGenerator)
                {
                    var childbox = childElement.GetPrincipalBox(parentBox, this);
                    parentBox.AppendChild(childbox);
                    return(childbox);
                }

                //-----------------------------------------------
                LayoutFarm.Composers.CreateCssBoxDelegate foundBoxGen;
                if (((HtmlDocument)childElement.OwnerDocument).TryGetCustomBoxGenerator(childElement.Name, out foundBoxGen))
                {
                    //create custom box
                    newBox = foundBoxGen(childElement, parentBox, childElement.Spec, this);
                }
                if (newBox == null)
                {
                    goto default;
                }
                else
                {
                    childElement.SetPrincipalBox(newBox);
                    return(newBox);
                }
            }

            default:
            {
                BoxSpec childSpec = childElement.Spec;
                switch (childSpec.CssDisplay)
                {
                //not fixed display type
                case CssDisplay.TableCell:
                    newBox = TableBoxCreator.CreateTableCell(parentBox, childElement, false);
                    break;

                case CssDisplay.TableColumn:
                    newBox = TableBoxCreator.CreateTableColumnOrColumnGroup(parentBox, childElement, false, CssDisplay.TableColumn);
                    break;

                case CssDisplay.TableColumnGroup:
                    newBox = TableBoxCreator.CreateTableColumnOrColumnGroup(parentBox, childElement, false, CssDisplay.TableColumnGroup);
                    break;

                case CssDisplay.ListItem:
                    newBox = ListItemBoxCreator.CreateListItemBox(parentBox, childElement);
                    break;

                default:
                    newBox = new CssBox(childSpec, parentBox.RootGfx);
                    newBox.SetController(childElement);
                    parentBox.AppendChild(newBox);
                    break;
                }
            }
            break;
            }

            childElement.SetPrincipalBox(newBox);
            UpdateChildBoxes(childElement, fullmode);
            return(newBox);
        }
Ejemplo n.º 16
0
 public abstract CssBox CreateCssBox(LayoutFarm.WebDom.DomElement tag,
                                     CssBox parentBox, BoxSpec spec, HtmlHost host);
Ejemplo n.º 17
0
        CssBox CreateInputBox(DomElement domE,
                              CssBox parentBox,
                              BoxSpec spec,
                              LayoutFarm.RootGraphic rootgfx, HtmlHost host)
        {
            //https://www.w3schools.com/tags/tag_input.asp
            //button
            //checkbox
            //color
            //date
            //datetime - local
            //email
            //file
            //hidden
            //image
            //month
            //number
            //password
            //radio
            //range
            //reset
            //search
            //submit
            //tel
            //text
            //time
            //url
            //week



            var typeAttr = domE.FindAttribute("type");

            if (typeAttr != null)
            {
                switch (typeAttr.Value)
                {
                case "password":
                {
                    var    textbox    = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false, true);
                    CssBox wrapperBox = CreateWrapper(
                        host,
                        textbox,
                        textbox.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    //place holder support
                    DomAttribute placeHolderAttr = domE.FindAttribute("placeholder");
                    if (placeHolderAttr != null)
                    {
                        textbox.PlaceHolderText = placeHolderAttr.Value;
                    }
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "text":
                {
                    // user can specific width of textbox
                    //var textbox = new LayoutFarm.CustomWidgets.TextBox(100, 17, false);
                    var    textbox    = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false);
                    CssBox wrapperBox = CreateWrapper(
                        host,
                        textbox,
                        textbox.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    //place holder support
                    DomAttribute placeHolderAttr = domE.FindAttribute("placeholder");
                    if (placeHolderAttr != null)
                    {
                        textbox.PlaceHolderText = placeHolderAttr.Value;
                    }
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "button":
                {
                    //use subdom technique ***
                    //todo: review the technique here
                    var button       = new HtmlWidgets.Button(60, 30);
                    var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;
                    if (ihtmlElement != null)
                    {
                        button.Text = ihtmlElement.innerHTML;
                    }
                    else
                    {
                        button.Text = "testButton";
                    }

                    WebDom.Impl.HtmlElement buttonDom = (WebDom.Impl.HtmlElement)button.GetPresentationDomNode((HtmlDocument)domE.OwnerDocument);
                    buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:white;cursor:pointer");
                    CssBox buttonCssBox = host.CreateBox(parentBox, buttonDom, true);
                    parentBox.AppendChild(buttonCssBox);
                    return(buttonCssBox);
                }

                case "checkbox":
                {
                    //implement with choice box + multiple value
                    var button = new HtmlWidgets.ChoiceBox(10, 10);
                    button.OnlyOne = false;         //*** show as checked box
                    var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;
                    WebDom.Impl.HtmlElement buttonDom = (WebDom.Impl.HtmlElement)button.GetPresentationDomNode((HtmlDocument)domE.OwnerDocument);
                    //buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:red;cursor:pointer");
                    CssBox buttonCssBox = host.CreateBox(parentBox, buttonDom, true);         //create and append to the parentBox
#if DEBUG
                    buttonCssBox.dbugMark1 = 1;
#endif
                    return(buttonCssBox);
                }

                case "radio":
                {
                    var button = new HtmlWidgets.ChoiceBox(10, 10);
                    button.OnlyOne = true;        // show as option box

                    var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;

                    //if (ihtmlElement != null)
                    //{
                    //    button.Text = ihtmlElement.innerHTML;
                    //}
                    //else
                    //{
                    //    button.Text = "testButton";
                    //}
                    //button.Text = "C";

                    WebDom.Impl.HtmlElement buttonDom = (WebDom.Impl.HtmlElement)button.GetPresentationDomNode((HtmlDocument)domE.OwnerDocument);
                    //buttonDom.SetAttribute("style", "width:20px;height:20px;background-color:red;cursor:pointer");
                    CssBox buttonCssBox = host.CreateBox(parentBox, buttonDom, true);         //create and append to the parentBox
#if DEBUG
                    buttonCssBox.dbugMark1 = 1;
#endif
                    return(buttonCssBox);
                }

                case "your_box":
                {
                    //tempfix -> just copy the Button code,
                    //TODO: review here, use proper radio button
                    var    box        = new LayoutFarm.CustomWidgets.Box(20, 20);
                    CssBox wrapperBox = CreateWrapper(
                        host,
                        box,
                        box.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }
                }
            }
            return(null);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// assign property value from parent
        /// </summary>
        /// <param name="spec"></param>
        /// <param name="propName"></param>
        static void SetPropertyValueFromParent(BoxSpec spec, BoxSpec parentSpec, WellknownCssPropertyName propName)
        {
            switch (propName)
            {
            case WellknownCssPropertyName.BorderBottomWidth:
                spec.BorderBottomWidth = parentSpec.BorderBottomWidth;
                break;

            case WellknownCssPropertyName.BorderLeftWidth:
                spec.BorderLeftWidth = parentSpec.BorderLeftWidth;
                break;

            case WellknownCssPropertyName.BorderRightWidth:
                spec.BorderRightWidth = parentSpec.BorderRightWidth;
                break;

            case WellknownCssPropertyName.BorderTopWidth:
                spec.BorderTopWidth = parentSpec.BorderTopWidth;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderBottomStyle:
                spec.BorderBottomStyle = parentSpec.BorderBottomStyle;
                break;

            case WellknownCssPropertyName.BorderLeftStyle:
                spec.BorderLeftStyle = parentSpec.BorderBottomStyle;
                break;

            case WellknownCssPropertyName.BorderRightStyle:
                spec.BorderRightStyle = parentSpec.BorderRightStyle;
                break;

            case WellknownCssPropertyName.BorderTopStyle:
                spec.BorderTopStyle = parentSpec.BorderTopStyle;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderBottomColor:
                spec.BorderBottomColor = parentSpec.BorderBottomColor;
                break;

            case WellknownCssPropertyName.BorderLeftColor:
                spec.BorderLeftColor = parentSpec.BorderLeftColor;
                break;

            case WellknownCssPropertyName.BorderRightColor:
                spec.BorderRightColor = parentSpec.BorderRightColor;
                break;

            case WellknownCssPropertyName.BorderTopColor:
                spec.BorderTopColor = parentSpec.BorderTopColor;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderSpacing:

                spec.BorderSpacingHorizontal = parentSpec.BorderSpacingHorizontal;
                spec.BorderSpacingVertical   = parentSpec.BorderSpacingVertical;
                break;

            case WellknownCssPropertyName.BorderCollapse:
                spec.BorderCollapse = parentSpec.BorderCollapse;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.CornerRadius:
                spec.CornerNERadius = parentSpec.CornerNERadius;
                spec.CornerNWRadius = parentSpec.CornerNWRadius;
                spec.CornerSERadius = parentSpec.CornerSERadius;
                spec.CornerSWRadius = parentSpec.CornerSWRadius;
                break;

            case WellknownCssPropertyName.CornerNWRadius:

                spec.CornerNWRadius = parentSpec.CornerNWRadius;
                break;

            case WellknownCssPropertyName.CornerNERadius:
                spec.CornerNERadius = parentSpec.CornerNERadius;
                break;

            case WellknownCssPropertyName.CornerSERadius:
                spec.CornerSERadius = parentSpec.CornerSERadius;
                break;

            case WellknownCssPropertyName.CornerSWRadius:
                spec.CornerSWRadius = parentSpec.CornerSWRadius;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.MarginBottom:
                spec.MarginBottom = parentSpec.MarginBottom;
                break;

            case WellknownCssPropertyName.MarginLeft:
                spec.MarginLeft = parentSpec.MarginLeft;
                break;

            case WellknownCssPropertyName.MarginRight:
                spec.MarginRight = parentSpec.MarginRight;
                break;

            case WellknownCssPropertyName.MarginTop:
                spec.MarginTop = parentSpec.MarginTop;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.PaddingBottom:
                spec.PaddingBottom = parentSpec.PaddingBottom;
                break;

            case WellknownCssPropertyName.PaddingLeft:
                spec.PaddingLeft = parentSpec.PaddingLeft;
                break;

            case WellknownCssPropertyName.PaddingRight:
                spec.PaddingRight = parentSpec.PaddingRight;
                break;

            case WellknownCssPropertyName.PaddingTop:
                spec.PaddingTop = parentSpec.PaddingTop;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.Left:
                spec.Left = parentSpec.Left;
                break;

            case WellknownCssPropertyName.Top:
                spec.Top = parentSpec.Top;
                break;

            case WellknownCssPropertyName.Width:
                spec.Width = parentSpec.Width;
                break;

            case WellknownCssPropertyName.MaxWidth:
                spec.MaxWidth = parentSpec.MaxWidth;
                break;

            case WellknownCssPropertyName.Height:
                spec.Height = parentSpec.Height;
                break;

            case WellknownCssPropertyName.BackgroundColor:
                spec.BackgroundColor = parentSpec.BackgroundColor;
                break;

            case WellknownCssPropertyName.BackgroundImage:
                spec.BackgroundImageBinder = parentSpec.BackgroundImageBinder;
                break;

            case WellknownCssPropertyName.BackgroundPosition:
                spec.BackgroundPositionX = parentSpec.BackgroundPositionX;
                spec.BackgroundPositionY = parentSpec.BackgroundPositionY;
                break;

            case WellknownCssPropertyName.BackgroundRepeat:
                spec.BackgroundRepeat = parentSpec.BackgroundRepeat;
                break;

            case WellknownCssPropertyName.BackgroundGradient:
                spec.BackgroundGradient = parentSpec.BackgroundGradient;
                break;

            case WellknownCssPropertyName.BackgroundGradientAngle:
            {
                spec.BackgroundGradientAngle = parentSpec.BackgroundGradientAngle;
            }
            break;

            case WellknownCssPropertyName.Color:
                spec.Color = parentSpec.Color;
                break;

            case WellknownCssPropertyName.Display:
                spec.CssDisplay = parentSpec.CssDisplay;
                break;

            case WellknownCssPropertyName.Direction:
                spec.CssDirection = parentSpec.CssDirection;
                break;

            case WellknownCssPropertyName.EmptyCells:
                spec.EmptyCells = parentSpec.EmptyCells;
                break;

            case WellknownCssPropertyName.Float:
                spec.Float = parentSpec.Float;
                break;

            case WellknownCssPropertyName.Position:
                spec.Position = parentSpec.Position;
                break;

            case WellknownCssPropertyName.LineHeight:
                spec.LineHeight = parentSpec.LineHeight;
                break;

            case WellknownCssPropertyName.VerticalAlign:
                spec.VerticalAlign = parentSpec.VerticalAlign;
                break;

            case WellknownCssPropertyName.TextIndent:
                spec.TextIndent = parentSpec.TextIndent;
                break;

            case WellknownCssPropertyName.TextAlign:
                spec.CssTextAlign = parentSpec.CssTextAlign;
                break;

            case WellknownCssPropertyName.TextDecoration:
                spec.TextDecoration = parentSpec.TextDecoration;
                break;

            case WellknownCssPropertyName.Whitespace:
                spec.WhiteSpace = parentSpec.WhiteSpace;
                break;

            case WellknownCssPropertyName.WordBreak:
                spec.WordBreak = parentSpec.WordBreak;
                break;

            case WellknownCssPropertyName.Visibility:
                spec.Visibility = parentSpec.Visibility;
                break;

            case WellknownCssPropertyName.WordSpacing:
                spec.WordSpacing = parentSpec.WordSpacing;
                break;

            case WellknownCssPropertyName.FontFamily:
                spec.FontFamily = parentSpec.FontFamily;
                //cssBox.FontFamily = value;
                break;

            case WellknownCssPropertyName.FontSize:
                spec.FontSize = parentSpec.FontSize;
                break;

            case WellknownCssPropertyName.FontStyle:
                spec.FontStyle = parentSpec.FontStyle;
                break;

            case WellknownCssPropertyName.FontVariant:
                spec.FontVariant = parentSpec.FontVariant;
                break;

            case WellknownCssPropertyName.FontWeight:
                spec.FontWeight = parentSpec.FontWeight;
                break;

            case WellknownCssPropertyName.ListStyle:

                spec.ListStyle = parentSpec.ListStyle;
                break;

            case WellknownCssPropertyName.ListStylePosition:
                spec.ListStylePosition = parentSpec.ListStylePosition;
                break;

            case WellknownCssPropertyName.ListStyleImage:

                spec.ListStyleImage = parentSpec.ListStyleImage;
                break;

            case WellknownCssPropertyName.ListStyleType:

                spec.ListStyleType = parentSpec.ListStyleType;
                break;

            case WellknownCssPropertyName.Overflow:
                spec.Overflow = parentSpec.Overflow;
                break;

            case WellknownCssPropertyName.BoxSizing:
                spec.BoxSizing = parentSpec.BoxSizing;
                break;
            }
        }
Ejemplo n.º 19
0
 public abstract CssBox CreateCssBox(HtmlElement tag,
                                     CssBox parentBox,
                                     BoxSpec spec,
                                     HtmlHost host);
Ejemplo n.º 20
0
 public CssIsolateBox(BoxSpec spec, RootGraphic rootgfx)
     : base(spec, rootgfx)
 {
 }
Ejemplo n.º 21
0
 public CssIsolateBox(BoxSpec spec, RootGraphic rootgfx)
     : base(spec, new CssBoxRootGfxBridge(rootgfx))
 {
 }
Ejemplo n.º 22
0
        static void SetPropertyValue(BoxSpec spec, WebDom.CssPropertyDeclaration decl)
        {
            //assign property
            CssCodeValueExpression cssValue = decl.GetPropertyValue(0);

            switch (decl.WellknownPropertyName)
            {
            case WellknownCssPropertyName.Display:
                spec.CssDisplay = UserMapUtil.GetDisplayType(cssValue);
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderBottomWidth:
                spec.BorderBottomWidth = cssValue.AsBorderLength();
                break;

            case WellknownCssPropertyName.BorderLeftWidth:
                spec.BorderLeftWidth = cssValue.AsBorderLength();
                break;

            case WellknownCssPropertyName.BorderRightWidth:
                spec.BorderRightWidth = cssValue.AsBorderLength();
                break;

            case WellknownCssPropertyName.BorderTopWidth:
                spec.BorderTopWidth = cssValue.AsBorderLength();
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderBottomStyle:
                spec.BorderBottomStyle = UserMapUtil.GetBorderStyle(cssValue);
                break;

            case WellknownCssPropertyName.BorderLeftStyle:
                spec.BorderLeftStyle = UserMapUtil.GetBorderStyle(cssValue);
                break;

            case WellknownCssPropertyName.BorderRightStyle:
                spec.BorderRightStyle = UserMapUtil.GetBorderStyle(cssValue);
                break;

            case WellknownCssPropertyName.BorderTopStyle:
                spec.BorderTopStyle = UserMapUtil.GetBorderStyle(cssValue);
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderBottomColor:
                spec.BorderBottomColor = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.BorderLeftColor:
                spec.BorderLeftColor = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.BorderRightColor:
                spec.BorderRightColor = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.BorderTopColor:
                spec.BorderTopColor = AsColor(cssValue);;
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BorderSpacing:

                SetBorderSpacing(spec, cssValue);
                break;

            case WellknownCssPropertyName.BorderCollapse:
                spec.BorderCollapse = UserMapUtil.GetBorderCollapse(cssValue);
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.BoxSizing:
                spec.BoxSizing = UserMapUtil.GetBoxSizing(cssValue);
                break;

            case WellknownCssPropertyName.BoxShadow:
                SetBoxShadow(spec, decl);
                break;

            case WellknownCssPropertyName.CornerRadius:

                SetCornerRadius(spec, cssValue);
                break;

            case WellknownCssPropertyName.CornerNWRadius:
                spec.CornerNWRadius = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.CornerNERadius:
                spec.CornerNERadius = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.CornerSERadius:
                spec.CornerSERadius = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.CornerSWRadius:
                spec.CornerSWRadius = cssValue.AsLength();
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.MarginBottom:
                spec.MarginBottom = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.MarginLeft:
                spec.MarginLeft = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.MarginRight:
                spec.MarginRight = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.MarginTop:
                spec.MarginTop = cssValue.AsTranslatedLength();
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.PaddingBottom:
                spec.PaddingBottom = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.PaddingLeft:
                spec.PaddingLeft = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.PaddingRight:
                spec.PaddingRight = cssValue.AsTranslatedLength();
                break;

            case WellknownCssPropertyName.PaddingTop:
                spec.PaddingTop = cssValue.AsTranslatedLength();
                break;

            //------------------------------------------------
            case WellknownCssPropertyName.Left:
                spec.Left = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.Top:
                spec.Top = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.Width:
                spec.Width = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.MaxWidth:
                spec.MaxWidth = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.Height:
                spec.Height = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.BackgroundColor:
                spec.BackgroundColor = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.BackgroundImage:
                spec.BackgroundImageBinder = new ClientImageBinder(cssValue.GetTranslatedStringValue());
                break;

            case WellknownCssPropertyName.BackgroundPosition:
                SetBackgroundPosition(spec, cssValue);
                break;

            case WellknownCssPropertyName.BackgroundRepeat:
                spec.BackgroundRepeat = UserMapUtil.GetBackgroundRepeat(cssValue);
                break;

            case WellknownCssPropertyName.BackgroundGradient:
                spec.BackgroundGradient = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.BackgroundGradientAngle:
                spec.BackgroundGradientAngle = cssValue.AsNumber();
                break;

            case WellknownCssPropertyName.Color:
                spec.Color = AsColor(cssValue);
                break;

            case WellknownCssPropertyName.Direction:
                spec.CssDirection = UserMapUtil.GetCssDirection(cssValue);
                break;

            case WellknownCssPropertyName.EmptyCells:
                spec.EmptyCells = UserMapUtil.GetEmptyCell(cssValue);
                break;

            case WellknownCssPropertyName.Float:
                spec.Float = UserMapUtil.GetFloat(cssValue);
                break;

            case WellknownCssPropertyName.Position:
                spec.Position = UserMapUtil.GetCssPosition(cssValue);
                break;

            case WellknownCssPropertyName.LineHeight:
                spec.LineHeight = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.VerticalAlign:
                spec.VerticalAlign = UserMapUtil.GetVerticalAlign(cssValue);
                break;

            case WellknownCssPropertyName.TextIndent:
                spec.TextIndent = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.TextAlign:

                spec.CssTextAlign = UserMapUtil.GetTextAlign(cssValue);
                break;

            case WellknownCssPropertyName.TextDecoration:
                spec.TextDecoration = UserMapUtil.GetTextDecoration(cssValue);
                break;

            case WellknownCssPropertyName.Whitespace:
                spec.WhiteSpace = UserMapUtil.GetWhitespace(cssValue);
                break;

            case WellknownCssPropertyName.WordBreak:
                spec.WordBreak = UserMapUtil.GetWordBreak(cssValue);
                break;

            case WellknownCssPropertyName.Visibility:
                spec.Visibility = UserMapUtil.GetVisibility(cssValue);
                break;

            case WellknownCssPropertyName.WordSpacing:
                spec.WordSpacing = cssValue.AsLength();
                break;

            case WellknownCssPropertyName.FontFamily:
                spec.FontFamily = cssValue.GetTranslatedStringValue();
                break;

            case WellknownCssPropertyName.FontSize:

                SetFontSize(spec, cssValue);
                break;

            case WellknownCssPropertyName.FontStyle:
                spec.FontStyle = UserMapUtil.GetFontStyle(cssValue);
                break;

            case WellknownCssPropertyName.FontVariant:
                spec.FontVariant = UserMapUtil.GetFontVariant(cssValue);
                break;

            case WellknownCssPropertyName.FontWeight:
                spec.FontWeight = UserMapUtil.GetFontWeight(cssValue);
                break;

            case WellknownCssPropertyName.ListStyle:
                spec.ListStyle = cssValue.GetTranslatedStringValue();
                break;

            case WellknownCssPropertyName.ListStylePosition:
                spec.ListStylePosition = UserMapUtil.GetListStylePosition(cssValue);
                break;

            case WellknownCssPropertyName.ListStyleImage:
                spec.ListStyleImage = cssValue.GetTranslatedStringValue();
                break;

            case WellknownCssPropertyName.ListStyleType:
                spec.ListStyleType = UserMapUtil.GetListStyleType(cssValue);
                break;

            case WellknownCssPropertyName.Overflow:
                spec.Overflow = UserMapUtil.GetOverflow(cssValue);
                break;

            //------------------------------------------------
            //for flex container
            case WellknownCssPropertyName.Flex:
            {
                //TODO: implement this
            }
            break;

            case WellknownCssPropertyName.FlexDirection:
            {
                //TODO: implement this
            }
            break;

            case WellknownCssPropertyName.FlexFlow:
            {
                //TODO: implement this
            }
            break;

            case WellknownCssPropertyName.FlexWrap:
            {
                //TODO: implement this
            }
            break;

            //------------------------------------------------
            //for flex item
            case WellknownCssPropertyName.FlexGrow:
                spec.FlexGrow = (int)cssValue.AsNumber();
                break;

            case WellknownCssPropertyName.FlexShrink:
                spec.FlexShrink = (int)cssValue.AsNumber();
                break;

            case WellknownCssPropertyName.FlexOrder:
                spec.FlexOrder = (int)cssValue.AsNumber();
                break;

            //------------------------------------------------
            //experiment : for container
            case WellknownCssPropertyName.FlexExtensionNum:
                spec.FlexExtensionNum = (int)cssValue.AsNumber();
                break;

            //experiment : for space part
            case WellknownCssPropertyName.FlexExtensionPart:
                spec.FlexExtensionPart = (int)cssValue.AsNumber();
                break;
            }
        }
 void CacheBoxSpec(CssTemplateKey key, BoxSpec spec)
 {
     //add at last(top) level
     specLevels[specLevels.Count - 1].AddBoxSpec(key, spec);
 }
Ejemplo n.º 24
0
        void ApplyStyleSheetForSingleHtmlElement(
            HtmlElement element,
            BoxSpec parentSpec,
            TopDownActiveCssTemplate activeCssTemplate)
        {
            BoxSpec curSpec = element.Spec;

            BoxSpec.InheritStyles(curSpec, parentSpec);
            //--------------------------------
            string classValue = null;

            if (element.HasAttributeClass)
            {
                classValue = element.AttrClassValue;
            }
            //--------------------------------
            //1. apply style
            activeCssTemplate.ApplyCacheTemplate(element.LocalName,
                                                 classValue,//class
                                                 curSpec,
                                                 parentSpec);
            //-------------------------------------------------------------------
            //2. specific id
            if (element.HasAttributeElementId)
            {
                // element.ElementId;
                activeCssTemplate.ApplyActiveTemplateForSpecificElementId(element);
            }
            //3. some html translate attributes

            if (element.WellknownElementName != WellKnownDomNodeName.svg)
            {
                //translate svg attributes
                AssignStylesFromTranslatedAttributesHTML5(element);
            }
            else
            {
                AssignSvgAttributes(element);
            }
            //-------------------------------------------------------------------
            //4. style attribute value
            //'style' object of this element
            if (!element.IsStyleEvaluated)
            {
                CssRuleSet parsedRuleSet = null;
                string     attrStyleValue;
                if (element.TryGetAttribute(WellknownName.Style, out attrStyleValue))
                {
                    //parse and evaluate the ruleset
                    parsedRuleSet = _miniCssParser.ParseCssPropertyDeclarationList(attrStyleValue.ToCharArray());
                    foreach (WebDom.CssPropertyDeclaration propDecl in parsedRuleSet.GetAssignmentIter())
                    {
                        SpecSetter.AssignPropertyValue(
                            curSpec,
                            parentSpec,
                            propDecl);
                    }
                }
                else
                {
                }
                //----------------------------------------------------------------
                element.IsStyleEvaluated = true;
                element.ElementRuleSet   = parsedRuleSet;
            }
            else
            {
                var elemRuleSet = element.ElementRuleSet;
                if (elemRuleSet != null)
                {
                    if (curSpec.IsFreezed)
                    {
                        curSpec.Defreeze();
                        //var newspec = new BoxSpec();
                        //BoxSpec.CloneAllStyles(newspec, curSpec);
                        //curSpec = newspec;
                        //element.Spec = curSpec;
                    }

                    foreach (WebDom.CssPropertyDeclaration propDecl in elemRuleSet.GetAssignmentIter())
                    {
                        SpecSetter.AssignPropertyValue(
                            curSpec,
                            parentSpec,
                            propDecl);
                    }
                }
            }
            //=====================
            curSpec.Freeze(); //***
            //=====================
        }
        internal void ApplyCacheTemplate(string elemName,
                                         string class_value,
                                         BoxSpec currentBoxSpec,
                                         BoxSpec parentSpec)
        {
            //1. tag name key
            int tagNameKey = ustrTable.AddStringIfNotExist(elemName);
            //2. class name key
            int classNameKey = 0;

            if (class_value != null)
            {
                classNameKey = ustrTable.AddStringIfNotExist(class_value);
            }
            //find cache in the same level
            var templateKey = new CssTemplateKey(tagNameKey, classNameKey);
            //BoxSpec boxTemplate = SearchUpBoxSpec(templateKey);
            BoxSpec boxTemplate = null;

            if (boxTemplate != null)
            {
                BoxSpec.CloneAllStyles(currentBoxSpec, boxTemplate);
            }
            else
            {
                //create template for specific key
                boxTemplate = new BoxSpec();
                //copy current spec to boxTemplate
                BoxSpec.CloneAllStyles(boxTemplate, currentBoxSpec);
                //***
                //----------------------------
                //1. tag name
                CssRuleSetGroup ruleGroup = activeSheet.GetRuleSetForTagName(elemName);
                if (ruleGroup != null)
                {
                    //currentBoxSpec.VersionNumber++;
                    foreach (WebDom.CssPropertyDeclaration decl in ruleGroup.GetPropertyDeclIter())
                    {
                        SpecSetter.AssignPropertyValue(boxTemplate, parentSpec, decl);
                    }
                }
                //----------------------------
                //2. series of class
                if (class_value != null)
                {
                    //currentBoxSpec.VersionNumber++;
                    string[] classNames = class_value.Split(_whiteSplitter, StringSplitOptions.RemoveEmptyEntries);
                    int      j          = classNames.Length;
                    if (j > 0)
                    {
                        for (int i = 0; i < j; ++i)
                        {
                            CssRuleSetGroup ruleSetGroup = activeSheet.GetRuleSetForClassName(classNames[i]);
                            if (ruleSetGroup != null)
                            {
                                foreach (var propDecl in ruleSetGroup.GetPropertyDeclIter())
                                {
                                    SpecSetter.AssignPropertyValue(boxTemplate, parentSpec, propDecl);
                                }
                                //---------------------------------------------------------
                                //find subgroup for more specific conditions
                                int subgroupCount = ruleSetGroup.SubGroupCount;
                                for (int m = 0; m < subgroupCount; ++m)
                                {
                                    //find if selector condition match with this box
                                    CssRuleSetGroup ruleSetSubGroup = ruleSetGroup.GetSubGroup(m);
                                    var             selector        = ruleSetSubGroup.OriginalSelector;
                                }
                            }
                        }
                    }
                }

                boxTemplate.Freeze();
                //this.CacheBoxSpec(templateKey, boxTemplate);
                boxTemplate.IsTemplate = true;
                //copy back from template to currentBoxSpec
                BoxSpec.CloneAllStyles(currentBoxSpec, boxTemplate);
            }
        }
Ejemplo n.º 26
0
        public static void CloneAllStyles(BoxSpec target, BoxSpec source)
        {
            //1.
            //=====================================
            //if (s._fontFeats.Owner == s)
            //{
            //    //this._fontFeats = s._fontFeats;
            //}
            target._fontFeats = source._fontFeats;
            target._listFeats = source._listFeats;
            //---------------------------------------
            target._lineHeight  = source._lineHeight;
            target._textIndent  = source._textIndent;
            target._actualColor = source._actualColor;
            target._emptyCells  = source._emptyCells;
            //---------------------------------------
            target._textAlign     = source._textAlign;
            target._verticalAlign = source._verticalAlign;
            target._visibility    = source._visibility;
            target._whitespace    = source._whitespace;
            target._wordBreak     = source._wordBreak;
            target._cssDirection  = source._cssDirection;
            //---------------------------------------

            //2.
            //for clone only (eg. split a box into two parts)
            //=======================================
            target._boxSizing       = source._boxSizing;
            target._backgroundFeats = source._backgroundFeats;
            target._borderFeats     = source._borderFeats;
            target._cornerFeats     = source._cornerFeats;
#if DEBUG
            //if (target.__aa_dbugId == 9)
            //{
            //    int ss= source.__aa_dbugId;

            //}
#endif
            target._marginFeats  = source._marginFeats;
            target._paddingFeats = source._paddingFeats;
            //---------------------------------------
            //if (target.__aa_dbugId == 8)
            //{
            //}
            target._cssDisplay     = source._cssDisplay;
            target._left           = source._left;
            target._top            = source._top;
            target._bottom         = source._bottom;
            target._right          = source._right;
            target._width          = source._width;
            target._height         = source._height;
            target._maxWidth       = source._maxWidth;
            target._position       = source._position;
            target._wordSpacing    = source._wordSpacing;
            target._lineHeight     = source._lineHeight;
            target._float          = source._float;
            target._overflow       = source._overflow;
            target._textDecoration = source._textDecoration;
            //3.
            //=====================================
            target._cssDirection = source._cssDirection;
        }
Ejemplo n.º 27
0
        CssBox CreateTextAreaElement(HtmlElement domE,
                                     CssBox parentBox,
                                     BoxSpec spec,
                                     HtmlHost host)
        {
            //mulitline
            //TODO: review default size of a textarea...

            HtmlTextAreaElement htmlTextAreaElem = (HtmlTextAreaElement)domE;
            var textbox        = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 60, true);
            var subdomExtender = new TextAreaInputSubDomExtender(textbox);

            CssBox wrapperBox = CreateCssWrapper(
                host,
                textbox,
                textbox.GetPrimaryRenderElement(),
                spec,
                subdomExtender,
                true);

            textbox.KeyDown += (s, e) =>
            {
                ((LayoutFarm.UI.IUIEventListener)domE).ListenKeyDown(e);
            };

            htmlTextAreaElem.SubDomExtender = subdomExtender;//connect

            //place holder support
            DomAttribute placeHolderAttr = domE.FindAttribute("placeholder");

            if (placeHolderAttr != null)
            {
                textbox.PlaceHolderText = placeHolderAttr.Value;
            }
            parentBox.AppendChild(wrapperBox);

            //content of text area
            HtmlTextNode textNode = null;

            foreach (DomNode child in domE.GetChildNodeIterForward())
            {
                switch (child.NodeKind)
                {
                case HtmlNodeKind.TextNode:
                {
                    textNode = (HtmlTextNode)child;
                }
                break;
                }
                if (textNode != null)
                {
                    break;
                }
            }
            if (textNode != null)
            {
                //if first line is blank line we skip

                //TODO: review here
                System.Collections.Generic.List <string> strList = new System.Collections.Generic.List <string>();
                int lineCount = 0;
                using (System.IO.StringReader strReader = new System.IO.StringReader(new string(textNode.GetOriginalBuffer())))
                {
                    string line = strReader.ReadLine();
                    while (line != null)
                    {
                        if (lineCount == 0)
                        {
                            if (line.Trim() != string.Empty)
                            {
                                strList.Add(line);
                            }
                        }
                        else
                        {
                            strList.Add(line);
                        }

                        lineCount++;
                        line = strReader.ReadLine();
                    }

                    if (strList.Count > 0)
                    {
                        //check last line
                        line = strList[strList.Count - 1];
                        if (line.Trim() == string.Empty)
                        {
                            strList.RemoveAt(strList.Count - 1);
                        }
                    }
                }
                //
                if (strList.Count > 0)
                {
                    textbox.SetText(strList);
                }
            }

            return(wrapperBox);
        }
        internal void ParseWordContent(
            char[] textBuffer,
            BoxSpec spec,
            bool isBlock,
            List <CssRun> runlistOutput,
            out bool hasSomeCharacter)
        {
            bool preserverLine      = false;
            bool preserveWhiteSpace = false;
            var  isblock            = spec.CssDisplay == CssDisplay.Block;

            switch (spec.WhiteSpace)
            {
            case CssWhiteSpace.Pre:
            case CssWhiteSpace.PreWrap:
                //run and preserve whitespace
                preserveWhiteSpace = true;
                preserverLine      = true;
                break;

            case CssWhiteSpace.PreLine:
                preserverLine = true;
                break;
            }

            //---------------------------------------
            //1. check if has some text
            //--------------------------------------

            hasSomeCharacter = false;
            //--------------------------------------
            //just parse and preserve all whitespace
            //--------------------------------------
            int startIndex = 0;
            int buffLength = textBuffer.Length;
            //whitespace and respect newline
            WordParsingState parsingState = WordParsingState.Init;
            int appendLength = 0;
            //--------------------------------------

            //some text
            bool needFinerTextParser = false;

            for (int i = 0; i < buffLength; ++i)
            {
                char c0 = textBuffer[i];
                if (c0 == '\r')
                {
                    continue;
                }
                //----------------------------------------
                //switch by state
                switch (parsingState)
                {
                case WordParsingState.Init:
                {
                    if (char.IsWhiteSpace(c0))
                    {
                        if (c0 == '\n')
                        {
                            if (preserverLine)
                            {
                                runlistOutput.Add(CssTextRun.CreateLineBreak());
                                appendLength = 0;         //clear append length
                                continue;
                            }
                        }
                        parsingState = WordParsingState.Whitespace;
                        //start collect whitespace
                        startIndex   = i;
                        appendLength = 1;        //start collect whitespace
                    }
                    else if (char.IsPunctuation(c0))
                    {
                        parsingState = WordParsingState.Init;
                        startIndex   = i;
                        appendLength = 1;
                        //add single token
                        runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                    }
                    else
                    {
                        //character
                        if (c0 > '~')
                        {
                            needFinerTextParser = true;
                        }

                        parsingState = WordParsingState.CharacterCollecting;
                        startIndex   = i;
                        appendLength = 1;        //start collect whitespace
                    }
                }
                break;

                case WordParsingState.Whitespace:
                {
                    if (char.IsWhiteSpace(c0))
                    {
                        if (c0 == '\n')
                        {
                            if (preserverLine)
                            {
                                runlistOutput.Add(CssTextRun.CreateLineBreak());
                                appendLength = 0;         //clear append length
                                continue;
                            }
                        }
                        if (appendLength == 0)
                        {
                            startIndex = i;
                        }

                        appendLength++;
                    }
                    else
                    {
                        runlistOutput.Add(CssTextRun.CreateWhitespace(preserveWhiteSpace ? appendLength : 1));
                        if (char.IsPunctuation(c0))
                        {
                            parsingState = WordParsingState.Init;
                            startIndex   = i;
                            appendLength = 1;
                            //add single token
                            runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                        }
                        else
                        {
                            if (c0 > '~')
                            {
                                needFinerTextParser = true;
                            }

                            parsingState = WordParsingState.CharacterCollecting;
                            startIndex   = i;      //start collect
                            appendLength = 1;      //start append length
                        }
                    }
                }
                break;

                case WordParsingState.CharacterCollecting:
                {
                    bool isWhiteSpace;
                    if ((isWhiteSpace = char.IsWhiteSpace(c0)) || char.IsPunctuation(c0))
                    {
                        //flush collecting token
                        if (needFinerTextParser && TextBreaker != null)
                        {
                            CreateTextRuns(textBuffer, runlistOutput, startIndex, appendLength);
                            needFinerTextParser = false;        //reset
                        }
                        else
                        {
                            runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                        }

                        hasSomeCharacter = true;
                        startIndex       = i;  //start collect
                        appendLength     = 1;  //collect whitespace
                        if (isWhiteSpace)
                        {
                            if (c0 == '\n')
                            {
                                if (preserverLine)
                                {
                                    runlistOutput.Add(CssTextRun.CreateLineBreak());
                                    appendLength = 0;         //clear append length
                                    continue;
                                }
                            }
                            parsingState = WordParsingState.Whitespace;
                        }
                        else
                        {
                            parsingState = WordParsingState.Init;
                            runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                        }
                        //----------------------------------------
                    }
                    else
                    {
                        if (c0 > '~')
                        {
                            needFinerTextParser = true;
                        }

                        if (appendLength == 0)
                        {
                            startIndex = i;
                        }
                        appendLength++;
                    }
                }
                break;
                }
            }
            //--------------------

            if (appendLength > 0)
            {
                switch (parsingState)
                {
                case WordParsingState.Whitespace:
                {
                    //last with whitespace
                    if (preserveWhiteSpace)
                    {
                        runlistOutput.Add(CssTextRun.CreateWhitespace(appendLength));
                    }
                    else
                    {
                        if (!isblock || (runlistOutput.Count > 0))
                        {
                            runlistOutput.Add(CssTextRun.CreateWhitespace(1));
                        }
                    }
                }
                break;

                case WordParsingState.CharacterCollecting:
                {
                    if (needFinerTextParser && TextBreaker != null)
                    {
                        CreateTextRuns(textBuffer, runlistOutput, startIndex, appendLength);
                        needFinerTextParser = false;        //reset
                    }
                    else
                    {
                        runlistOutput.Add(CssTextRun.CreateTextRun(startIndex, appendLength));
                    }

                    hasSomeCharacter = true;
                }
                break;
                }
            }
        }
Ejemplo n.º 29
0
        public override CssBox CreateCssBox(
            HtmlElement domE,
            CssBox parentBox,
            BoxSpec spec,
            HtmlHost host)
        {
            switch (domE.Name)
            {
            case "select":
            {
                CssBox selectedBox = CreateSelectBox(domE, parentBox, spec, host);
                if (selectedBox != null)
                {
                    return(selectedBox);
                }
            }
            break;

            case "input":
            {
                CssBox inputBox = CreateInputBox(domE, parentBox, spec, host);
                if (inputBox != null)
                {
                    return(inputBox);
                }
            }
            break;

            case "canvas":
            {
                //test only
                //TODO: review here
                //software canvas ?
                var    canvas     = new LayoutFarm.CustomWidgets.MiniAggCanvasBox(400, 400);
                CssBox wrapperBox = CreateCssWrapper(
                    host,
                    canvas,
                    canvas.GetPrimaryRenderElement(),
                    spec,
                    null,
                    true);
                parentBox.AppendChild(wrapperBox);
                return(wrapperBox);
            }

            case "textarea":
            {
                CssBox textAreaCssBox = CreateTextAreaElement(domE, parentBox, spec, host);
                if (textAreaCssBox != null)
                {
                    return(textAreaCssBox);
                }
            }
            break;
            }

            //default unknown
            var simpleBox = new LayoutFarm.CustomWidgets.Box(100, 20);

            simpleBox.BackColor = PixelFarm.Drawing.KnownColors.LightGray;
            CssBox wrapperBox2 = CreateCssWrapper(
                host,
                simpleBox,
                simpleBox.GetPrimaryRenderElement(),
                spec,
                null,
                false);

            parentBox.AppendChild(wrapperBox2);
            return(wrapperBox2);
        }
Ejemplo n.º 30
0
        LayoutFarm.HtmlBoxes.CssBox CreateInputBox(DomElement domE,
                                                   LayoutFarm.HtmlBoxes.CssBox parentBox,
                                                   BoxSpec spec,
                                                   LayoutFarm.RootGraphic rootgfx, HtmlHost host)
        {
            var typeAttr = domE.FindAttribute("type");

            if (typeAttr != null)
            {
                switch (typeAttr.Value)
                {
                case "text":
                {
                    // user can specific width of textbox
                    //var textbox = new LayoutFarm.CustomWidgets.TextBox(100, 17, false);
                    var textbox    = new LayoutFarm.CustomWidgets.TextBoxContainer(100, 20, false);
                    var wrapperBox = CreateWrapper(
                        textbox,
                        textbox.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    //place holder support
                    var placeHolderAttr = domE.FindAttribute("placeholder");
                    if (placeHolderAttr != null)
                    {
                        textbox.PlaceHolderText = placeHolderAttr.Value;
                    }
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "button":
                {
                    //use subdom? technique
                    //todo: review the technique here
                    var button       = new HtmlWidgets.Button(60, 30);
                    var ihtmlElement = domE as LayoutFarm.WebDom.IHtmlElement;
                    if (ihtmlElement != null)
                    {
                        button.Text = ihtmlElement.innerHTML;
                    }
                    else
                    {
                        button.Text = "";
                    }
                    button.Text = "testButton";
                    DomElement buttonDom    = button.GetPresentationDomNode((HtmlDocument)domE.OwnerDocument);
                    CssBox     buttonCssBox = host.CreateBox2(parentBox, (WebDom.Impl.HtmlElement)buttonDom, true);     // CreateCssBox(buttonDom, parentBox, spec, host);
                    //var ui = button.GetPrimaryUIElement(this.myHost);

                    //var wrapperBox = CreateWrapper(
                    //    button,
                    //    ui.GetPrimaryRenderElement(rootgfx),
                    //    spec, true);
                    //parentBox.AppendChild(wrapperBox);
                    //return wrapperBox;

                    parentBox.AppendChild(buttonCssBox);
                    return(buttonCssBox);
                }

                case "textbox":
                {
                    var    textbox    = new LayoutFarm.CustomWidgets.TextBox(100, 17, false);
                    CssBox wrapperBox = CreateWrapper(
                        textbox,
                        textbox.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }

                case "radio":
                {
                    //tempfix -> just copy the Button code,
                    //TODO: review here, use proper radio button
                    var    box        = new LayoutFarm.CustomWidgets.Box(20, 20);
                    CssBox wrapperBox = CreateWrapper(
                        box,
                        box.GetPrimaryRenderElement(rootgfx),
                        spec, true);
                    parentBox.AppendChild(wrapperBox);
                    return(wrapperBox);
                }
                }
            }
            return(null);
        }
Ejemplo n.º 31
0
 public RenderElementBridgeCssBox(BoxSpec spec,
                                  RenderElement containerElement)
     : base(spec)
 {
     ContainerElement = containerElement;
 }