Exemplo n.º 1
0
        public override void Draw(SpriteBatch sb)
        {
            float extra = 15;

            width         = drop.BoundBox.Width;
            drop.Position = new Vector2(Position.X - (width / 2), Position.Y + 5);
            string  toDraw = "";
            Vector2 ArrowStartPos;

            if (selectedIndex >= 0)
            {
                toDraw = drop.items[selectedIndex].text;
            }

            label.text = toDraw;

            ArrowStartPos = new Vector2(BoundBox.Right - 12, Position.Y - 3);

            DrawManager.Draw_Box(Position + new Vector2(extra / 2, 0), width + extra, height, backColor, sb, 0f, 255);
            DrawManager.Draw_Outline(Position + new Vector2(extra / 2, 0), width + extra, height, Color.Black, sb);
            if (!drop.active)
            {
                DrawManager.Draw_Line(ArrowStartPos, ArrowStartPos + new Vector2(4, 6), Color.White, sb);
                DrawManager.Draw_Line(ArrowStartPos + new Vector2(4, 6), ArrowStartPos + new Vector2(8, 0), Color.White, sb);
            }
            else
            {
                DrawManager.Draw_Line(ArrowStartPos + new Vector2(0, 6), ArrowStartPos + new Vector2(4, 0), Color.White, sb);
                DrawManager.Draw_Line(ArrowStartPos + new Vector2(4, 0), ArrowStartPos + new Vector2(8, 6), Color.White, sb);
                drop.Draw(sb);
            }

            label.Draw(sb);
        }
Exemplo n.º 2
0
        public override void Draw(SpriteBatch sb)
        {
            if (active)
            {
                bool  defaulted = false;
                Color oldColor  = input.tdI.color;
                if (!input.selected && input.input == "" && placeHolderText != "")
                {
                    input.tdI.text  = placeHolderText;
                    defaulted       = true;
                    input.tdI.color = Color.Gray;
                }

                NinePatch patch = patchNormal;
                if (input.selected)
                {
                    if (isFilterText())
                    {
                        patch = textValid ? patchSelectedRight : patchSelectedWrong;
                    }
                    else
                    {
                        patch = patchSelected;
                    }
                }

                int patchWidth = scaleToText && input.BoundBox.Width >= (int)width ? input.BoundBox.Width : (int)width;

                patch.Draw(sb, Position, (int)patchWidth, (int)height);
                input.Position = Position + new Vector2(patch.leftWidth, patch.topHeight);
                input.Draw(sb);
                if (defaulted)
                {
                    input.tdI.text  = "";
                    input.tdI.color = oldColor;
                }

                contextMenu.Draw(sb);
            }
            base.Draw(sb);
        }
Exemplo n.º 3
0
 public void DrawTest()
 {
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     DropDownList target = new DropDownList(position, font); // TODO: Initialize to an appropriate value
     SpriteBatch sb = null; // TODO: Initialize to an appropriate value
     target.Draw(sb);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }