/// <summary>
        /// Constructor of the scrollbar
        /// </summary>
        public UIScrollbar()
        {
            // Set the background for this element
            ElementType = UIElementType.ScrollbarBackground;

            // Calculate our dimension
            CalculateWidth();

            // Create the 3 buttons
            TopButton = new UIButton();
            TopButton.NormalType = UIElementType.ScrollbarTop;
            TopButton.HighlightType = UIElementType.ScrollbarTopHighlight;
            TopButton.ButtonReleasedInside += delegate(UIButton Button, MouseState mouse)
            {
                ScrollbarPosition -= ScrollbarLength / 10;
            };
            AddSubview(TopButton);

            BottomButton = new UIButton();
            BottomButton.NormalType = UIElementType.ScrollbarBottom;
            BottomButton.HighlightType = UIElementType.ScrollbarBottomHighlight;
            BottomButton.ButtonReleasedInside += delegate(UIButton Button, MouseState mouse)
            {
                ScrollbarPosition += ScrollbarLength / 10;
            };
            AddSubview(BottomButton);

            GemButton = new UIButton();
            GemButton.NormalType = UIElementType.ScrollbarGem;
            GemButton.HighlightType = UIElementType.ScrollbarGem;
            GemButton.ButtonDragged += delegate(UIButton Button, MouseState mouse)
            {
                int S = mouse.Y - ScreenBounds.Y - TopButton.Bounds.Height;
                int ScrollAreaLength = Bounds.Height - TopButton.Bounds.Height - BottomButton.Bounds.Height;
                S = (int)(ScrollbarLength * ((double)S / ScrollAreaLength));
                ScrollbarPosition = Math.Min(ScrollbarLength, Math.Max(0, S));
            };
            AddSubview(GemButton);

            // Set some defaults for the scrollbar
            ScrollbarLength = 100;
            ScrollbarPosition = 0;
        }
 public void AddFrameButton(UIButton Button)
 {
     AddSubview(Button);
     FrameButtons.Add(Button);
 }
 protected UIButton CreateButton(String Label)
 {
     UIButton Button = new UIButton();
     Button.Bounds.Width = 12;
     Button.Bounds.Height = 12;
     Button.Label = Label;
     Button.Margin.Top = -10;
     Button.ZOrder = 1;
     return Button;
 }
        private void CreateMenu()
        {
            Rectangle ButtonSize = new Rectangle(0, 0, 58, 15);
            MenuView = new UIStackView(UIStackDirection.Horizontal, true);

            UIToggleButton InventoryToggle = new UIToggleButton("Player");
            InventoryToggle.Bounds = ButtonSize;
            InventoryToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && InventoryView == null)
                {
                    InventoryView = new InventoryPanel(Desktop);
                    AddWindow(InventoryView);
                }
                else if (!Button.On && InventoryView != null)
                {
                    InventoryView.RemoveFromSuperview();
                    InventoryView = null;
                }
            };
            MenuView.AddSubview(InventoryToggle);

            UIToggleButton SkillToggle = new UIToggleButton("Skills");
            SkillToggle.Bounds = ButtonSize;
            SkillToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && SkillsView == null)
                {
                    SkillsView = new SkillPanel(Desktop);
                    SkillsView.Bounds.Width = 176;
                    SkillsView.Bounds.Height = 180;
                    AddWindow(SkillsView);
                }
                else if (!Button.On && SkillsView != null)
                {
                    SkillsView.RemoveFromSuperview();
                    SkillsView = null;
                }
            };
            MenuView.AddSubview(SkillToggle);

            UIToggleButton BattleToggle = new UIToggleButton("Battle");
            BattleToggle.Bounds = ButtonSize;
            MenuView.AddSubview(BattleToggle);

            UIToggleButton VIPToggle = new UIToggleButton("VIP");
            VIPToggle.Bounds = ButtonSize;
            VIPToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && VIPView == null)
                {
                    VIPView = new VIPPanel(Desktop);
                    AddWindow(VIPView);
                }
                else if (!Button.On && VIPView != null)
                {
                    VIPView.RemoveFromSuperview();
                    VIPView = null;
                }
            };
            MenuView.AddSubview(VIPToggle);

            UIButton MapToggle = new UIButton("Map");
            MapToggle.Bounds = ButtonSize;
            MenuView.AddSubview(MapToggle);

            UIButton MenuToggle = new UIButton("Menu");
            MenuToggle.Bounds = ButtonSize;
            MenuView.AddSubview(MenuToggle);

            AddSubview(MenuView);
        }
        private void CreateMenu()
        {
            Rectangle ButtonSize = new Rectangle(0, 0, 58, 15);

            MenuView = new UIStackView(UIStackDirection.Horizontal, true);

            UIToggleButton InventoryToggle = new UIToggleButton("Player");

            InventoryToggle.Bounds         = ButtonSize;
            InventoryToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && InventoryView == null)
                {
                    InventoryView = new InventoryPanel(Desktop);
                    AddWindow(InventoryView);
                }
                else if (!Button.On && InventoryView != null)
                {
                    InventoryView.RemoveFromSuperview();
                    InventoryView = null;
                }
            };
            MenuView.AddSubview(InventoryToggle);

            UIToggleButton SkillToggle = new UIToggleButton("Skills");

            SkillToggle.Bounds         = ButtonSize;
            SkillToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && SkillsView == null)
                {
                    SkillsView = new SkillPanel(Desktop);
                    SkillsView.Bounds.Width  = 176;
                    SkillsView.Bounds.Height = 180;
                    AddWindow(SkillsView);
                }
                else if (!Button.On && SkillsView != null)
                {
                    SkillsView.RemoveFromSuperview();
                    SkillsView = null;
                }
            };
            MenuView.AddSubview(SkillToggle);

            UIToggleButton BattleToggle = new UIToggleButton("Battle");

            BattleToggle.Bounds = ButtonSize;
            MenuView.AddSubview(BattleToggle);

            UIToggleButton VIPToggle = new UIToggleButton("VIP");

            VIPToggle.Bounds         = ButtonSize;
            VIPToggle.ButtonToggled += delegate(UIToggleButton Button, MouseState mouse)
            {
                if (Button.On && VIPView == null)
                {
                    VIPView = new VIPPanel(Desktop);
                    AddWindow(VIPView);
                }
                else if (!Button.On && VIPView != null)
                {
                    VIPView.RemoveFromSuperview();
                    VIPView = null;
                }
            };
            MenuView.AddSubview(VIPToggle);

            UIButton MapToggle = new UIButton("Map");

            MapToggle.Bounds = ButtonSize;
            MenuView.AddSubview(MapToggle);

            UIButton MenuToggle = new UIButton("Menu");

            MenuToggle.Bounds = ButtonSize;
            MenuView.AddSubview(MenuToggle);

            AddSubview(MenuView);
        }