示例#1
0
        protected override void UpdateDisplayList(float width, float height)
        {
            base.UpdateDisplayList(width, height);

            LabelDisplay.Color = (Color)GetStyle("textColor");

            if (_selected)
            {
                _rect.BackgroundColor = (Color)GetStyle("selectionColor");
            }
            else if (ShowsCaret)
            {
                _rect.BackgroundColor = (Color)GetStyle("caretColor");
            }
            else if (hovered)
            {
                _rect.BackgroundColor = (Color)GetStyle("rollOverColor");
            }
            else
            {
                _rect.BackgroundColor = (Color)GetStyle("backgroundColor");
            }

            _rect.SetActualSize(width, height);   // (this is a component - no layout, so...)
            _hgroup.SetActualSize(width, height); // (this is a component - no layout, so...)
        }
示例#2
0
        protected override void UpdateDisplayList(float width, float height)
        {
            base.UpdateDisplayList(width, height);

            LabelDisplay.Color = (Color)GetStyle("textColor");

            //hovered = Contains(Gui.MouseTarget, true);

            //Color backgroundColor;
            //var drawBackground = true;
            if (Selected)
            {
                _rect.BackgroundColor = (Color)GetStyle("selectionColor");
            }
            else if (ShowsCaret)
            {
                _rect.BackgroundColor = (Color)GetStyle("caretColor");
            }
            else if (hovered)
            {
                _rect.BackgroundColor = (Color)GetStyle("rollOverColor");
            }
            else
            {
                _rect.BackgroundColor = (Color)GetStyle("backgroundColor");
            }

            //else
            //{
            //    var alternatingColors:Array = getStyle("alternatingItemColors");

            //    if (alternatingColors && alternatingColors.length > 0)
            //    {
            //        // translate these colors into uints
            //        styleManager.getColorNames(alternatingColors);

            //        backgroundColor = alternatingColors[itemIndex % alternatingColors.length];
            //    }
            //    else
            //    {
            //        // don't draw background if it is the contentBackgroundColor. The
            //        // list skin handles the background drawing for us.
            //        drawBackground = false;
            //    }
            //}

            //if (ShowsCaret)
            //{
            //    //graphics.lineStyle(1, getStyle("selectionColor"));
            //    //graphics.drawRect(0.5, 0.5, unscaledWidth-1, unscaledHeight-1);
            //}
            //else
            //{
            //    //graphics.lineStyle();
            //    //graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
            //}

            // make sure our width/height is in the min/max for the label
            float childWidth = width - 6;

            childWidth = Math.Max(LayoutUtil.GetMinBoundsWidth(LabelDisplay), Math.Min(LayoutUtil.GetMaxBoundsWidth(LabelDisplay), childWidth));

            float childHeight = height - 10;

            childHeight = Math.Max(LayoutUtil.GetMinBoundsHeight(LabelDisplay), Math.Min(LayoutUtil.GetMaxBoundsHeight(LabelDisplay), childHeight));

            // set the label's position and size
            LabelDisplay.SetLayoutBoundsSize(childWidth, childHeight);
            LabelDisplay.SetLayoutBoundsPosition(6, 5);

            _rect.SetActualSize(width, height); // (this is a component - no layout, so...)
        }