Example #1
0
        public override void Draw()
        {
            MouseOverIndex = -1;
            Color outerBorderColor = Skin.OuterBorderColor;
            Color innerBorderColor = Skin.InnerBorderColor;
            Color innerButtonColor = Skin.WhiteBackgroundColor;
            Color textColor        = Skin.TextColor;

            Primitives.FillRectangle(Rectangle, innerBorderColor);
            Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness);
            Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness);
            //  Primitives.DrawMultiLineText(txt + (Root.SecondsSinceStartInt % 2 == 0 ? "|" : ""), new Rectangle(InnerRectangle.X + 8, InnerRectangle.Y + 3, InnerRectangle.Width - 10, InnerRectangle.Height - 4), textColor, Skin.Font, Primitives.TextAlignment.TopLeft);
            for (int i = _topOfList; i < Items.Count; i++)
            {
                Rectangle rectItem = new Rectangle(InnerRectangle.X + 1, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList) + 1, InnerRectangle.Width - 2, Skin.ListItemHeight);
                if (Root.IsMouseOver(rectItem))
                {
                    MouseOverIndex = i;
                }

                if (_selectedIndex == i)
                {
                    Primitives.FillRectangle(rectItem, Skin.ItemSelectedBackgroundColor);
                }
                else if (MouseOverIndex == i)
                {
                    Primitives.FillRectangle(rectItem, Skin.ItemMouseOverBackgroundColor);
                }
                Primitives.DrawSingleLineText(Items[i].ToString(), new Vector2(InnerRectangle.X + 5, InnerRectangle.Y + 2 + Skin.ListItemHeight * (i - _topOfList)), Skin.TextColor, Skin.Font);
                Primitives.DrawLine(new Vector2(InnerRectangle.X, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)),
                                    new Vector2(InnerRectangle.Right, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)),
                                    outerBorderColor, Skin.OuterBorderThickness);
            }
        }