public ProgressBar(String name, Rectangle area)
            : base(name, area)
        {
            barPanel = new Panel(String.Empty, area);
            barPanel.Texture = UserInterface.TexBar;
            barPanel.Color = Color.White;

            fillPanel = new Panel(String.Empty, new Rectangle(area.X, area.Y, 0, area.Height));
            fillPanel.Texture = UserInterface.TexBlank;
            fillPanel.Color = new Color(173, 216, 230, 100);

            label = new Label(name, area, Label.Fit.AlignCenter);
        }
        public override void Initialize()
        {
            Viewport vp = manager.UI.GraphicsDevice.Viewport;

            Color bgColor = firstLoad ? Color.Black : new Color(0, 0, 0, 175);
            background = new Panel("Load BG", new Rectangle(0, 0, vp.Width, vp.Height), bgColor);

            int lbW = (int)(vp.Width * 0.8f);
            int lbH = (int)(vp.Height * 0.05f);
            Rectangle lbA = new Rectangle((vp.Width - lbW) / 2, (vp.Height - lbH) / 2, lbW, lbH);
            loadBar = new ProgressBar("Building...", lbA);

            title = new Label("Loading", new Rectangle(0, lbH/2, vp.Width, lbH*2), Label.Fit.AlignCenter);
        }
        private void Setup()
        {
            Rectangle labelArea = new Rectangle(area.X, area.Y, (int)(0.3f * area.Width), area.Height);
            Rectangle barArea = new Rectangle(labelArea.Right, area.Y, (int)(0.5f * area.Width), area.Height);
            Rectangle valueArea = new Rectangle(barArea.Right, area.Y, area.Width - labelArea.Width - 
                barArea.Width, area.Height);

            nameLabel = new Label(name, labelArea, Label.Fit.AlignLeft);
            nameLabel.TextColor = Color.LightGray;
            valueLabel = new Label(valueString, valueArea, Label.Fit.AlignCenter);
            valueLabel.TextColor = Color.LightGray;

            // calculate the bar's positioning
            int barHeight = 4;
            bar = new Rectangle(barArea.X, barArea.Y + (barArea.Height - barHeight) / 2, barArea.Width, barHeight);

            // calculate the knob's area
            int knobHeight = (int)(area.Height * 0.8f);
            knob = new Rectangle(bar.Left, bar.Y + (bar.Height - knobHeight) / 2, knobHeight, knobHeight);
            CenterKnob(0);
        }
        private void SetupAC(Viewport vp)
        {
            Rectangle area = new Rectangle(0, 0, vp.Width / 3, vp.Height / 3);
            ControlMat mat = new ControlMat(area, 10, 1, 2, ControlMat.FillOrder.RowsFirst);
            Label selectionLabel = new Label("Selected Target", mat.Spaces[0], Label.Fit.AlignLeft);
            Label nameLabel = new Label("Name: ", mat.Spaces[1], Label.Fit.AlignLeft);
            Label positionLabel = new Label("Position: ", mat.Spaces[2], Label.Fit.AlignLeft);
            Label infoLabel = new Label("Info: ", mat.Spaces[3], Label.Fit.AlignLeft);

            SelectionInfoChanged += delegate(object src, EventArgs e)
            {
                nameLabel.Text = src == null ? "Name:" : "Name: " + selected.Name;
                positionLabel.Text = src == null ? "Position:" : "Position: " + selected.Position;
                infoLabel.Text = src == null ? "Info:" : "Info: " + selected.Info;
            };

            Slider separationSlider = new Slider("Separation", mat.Spaces[4], 0.0f, 1.0f);
            Slider cohesionSlider = new Slider("Cohesion", mat.Spaces[5], 0.0f, 1.0f);
            Slider wanderSlider = new Slider("Wander", mat.Spaces[6], 0.0f, 1.0f);
            Slider alignmentSlider = new Slider("Alignment", mat.Spaces[7], 0.0f, 1.0f);
            //alignmentSlider.Use += delegate(float v) { world.Wildlife.ApplySteerParameters(

            ac.Add(selectionLabel);
            ac.Add(nameLabel);
            ac.Add(positionLabel);
            ac.Add(infoLabel);
            ac.Disable(manager.UI);
        }
        private void SetupCC(Viewport vp)
        {
            Camera c = manager.UI.Camera;
            Rectangle ccArea = new Rectangle(0, 0, (int)(vp.Width * 0.5f), vp.Height / 3);
            ControlMat ccSpace = new ControlMat(ccArea, 7, 1, 2, ControlMat.FillOrder.RowsFirst);

            cc.Add(new Label("Camera Options", ccSpace.Spaces[0], Label.Fit.AlignCenter));

            Spinner<Camera.Mode> mode = new Spinner<Camera.Mode>("Mode", ccSpace.Spaces[1]);
            foreach (Camera.Mode cMode in Enum.GetValues(typeof(Camera.Mode)))
                mode.Add(cMode);
            mode.Use += delegate() { manager.UI.Camera.SetMode(mode.GetSelected()); };
            c.Changed += delegate(object src, EventArgs e) { mode.Select(c.CurrentMode); };
            cc.Add(mode);

            Slider transSpeed = new Slider("TSpeed", ccSpace.Spaces[2], 0.1f, 5.0f);
            transSpeed.SetValue(manager.UI.Camera.TranslateSpeed);
            transSpeed.Use += delegate(float v) { manager.UI.Camera.TranslateSpeed = v; };
            c.Changed += delegate(object src, EventArgs e) { transSpeed.SetValue(c.TranslateSpeed); };
            cc.Add(transSpeed);

            Slider rotSpeed = new Slider("RSpeed", ccSpace.Spaces[3], 0.02f, 0.1f);
            rotSpeed.SetValue(manager.UI.Camera.RotateSpeed);
            rotSpeed.Use += delegate(float v) { manager.UI.Camera.RotateSpeed = v; };
            c.Changed += delegate(object src, EventArgs e) { rotSpeed.SetValue(c.RotateSpeed); };
            cc.Add(rotSpeed);

            Label posInfo = new Label("Position: " + manager.UI.Camera.Position, ccSpace.Spaces[4], Label.Fit.AlignCenter);
            cc.Add(posInfo);

            Label rotInfo = new Label("Rotation: " + manager.UI.Camera.Rotation, ccSpace.Spaces[5], Label.Fit.AlignLeft);
            cc.Add(rotInfo);

            c.Changed += delegate(object src, EventArgs e)
            {
                posInfo.SetText("Position: " + c.Position, Label.Fit.AlignLeft);
                rotInfo.SetText("Rotation: " + c.Rotation, Label.Fit.AlignLeft);
            };

            cc.Disable(manager.UI);
        }
        private void SetupMenu(Viewport vp)
        {
            menu.Clear();

            int menuHeight = vp.Height / 20;
            menuArea = new Rectangle(0, vp.Height - menuHeight, (int)(vp.Width * 0.7f), menuHeight);
            ControlMat menuSpace = new ControlMat(menuArea, 1, 5, 2, ControlMat.FillOrder.ColumnsFirst);
            int i = 0;

            Panel mPanel = new Panel("Menu Panel", new Rectangle(0, menuArea.Y, vp.Width, menuHeight), new Color(0, 0, 0, 128));
            mPanel.Texture = UserInterface.TexButtonM;
            menu.Add(mPanel);
            menu.Add(new Button("Menu", menuSpace.Spaces[i++], delegate() { manager.ChangeScreen(new MenuScreen(manager)); }));
            menu.Add(new Button("Drawing", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(gc); }));
            menu.Add(new Button("Wildlife", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(ac); }));
            menu.Add(new Button("Weather", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(wc); }));
            menu.Add(new Button("Camera", menuSpace.Spaces[i++], delegate() { ChangeActiveCG(cc); }));
            timeLabel = new Label("Time", new Rectangle(menuSpace.Spaces[i - 1].Right, menuArea.Y, vp.Width - menuArea.Width, menuArea.Height), Label.Fit.AlignCenter);
            menu.Add(timeLabel);
        }
        protected Label label;  // button name label

        public Button(String name, Rectangle area)
            : base(name, area)
        {
            label = new Label(name, area, Label.Fit.AlignCenter);
            label.TextColor = Color.LightGray;
        }