Exemplo n.º 1
0
 /// <summary>
 /// Coppies values from another instance. Does NOT copy event subscribers.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <param name="b"></param>
 public ToggleButton(int x, int y, int w, int h, ToggleButton b)
     : base(x, y, w, h, "")
 {
     textures = b.textures;
     keys = b.keys;
     CurIndex = b.CurIndex;
 }
Exemplo n.º 2
0
        public override void Initialize()
        {
            if (t_leftUp == null)
            {
                LoadTextures();
            }

            WasInitialized = true;

            size = new Vector2(155, 172);

            title = new Label(0, 5, AssociatedComponent.Graphics.GetCSToolTip());
            title.font = TitleFont;
            title.UpdateSizeToTextSize();
            title.TextAlignment = Renderer.TextAlignment.Center;
            title.foreground = Color.White;
            controls.Add(title);

            Size = new Vector2(Math.Max(title.font.MeasureString(title.text).X + 80, Size.X), Size.Y);

            title.Size = new Vector2(Size.X - 20, title.Size.Y);

            removable = new CheckBox(5, 55, (int)size.X - 10, 20, "Removable: ", false);
            removable.foreground = Color.White;
            removable.onCheckedChanged += new CheckBox.CheckBoxCheckedHandler(removable_onCheckedChanged);
            controls.Add(removable);

            leftUp = new MenuButton(5, 80, 20, 20, "");
            leftUp.onClicked += new Button.ClickedEventHandler(leftUp_onClicked);
            leftUp.LeftTexture = t_leftUp;
            controls.Add(leftUp);

            leftRight = new MenuButton(30, 80, 20, 20, "");
            leftRight.onClicked += new Button.ClickedEventHandler(leftRight_onClicked);
            leftRight.LeftTexture = t_leftRight;
            controls.Add(leftRight);

            leftDown = new MenuButton(55, 80, 20, 20, "");
            leftDown.onClicked += new Button.ClickedEventHandler(leftDown_onClicked);
            leftDown.LeftTexture = t_leftDown;
            controls.Add(leftDown);

            upRight = new MenuButton(80, 80, 20, 20, "");
            upRight.onClicked += new Button.ClickedEventHandler(upRight_onClicked);
            upRight.LeftTexture = t_upRight;
            controls.Add(upRight);

            upDown = new MenuButton(105, 80, 20, 20, "");
            upDown.onClicked += new Button.ClickedEventHandler(upDown_onClicked);
            upDown.LeftTexture = t_upDown;
            controls.Add(upDown);

            rightDown = new MenuButton(130, 80, 20, 20, "");
            rightDown.onClicked += new Button.ClickedEventHandler(rightDown_onClicked);
            rightDown.LeftTexture = t_rightDown;
            controls.Add(rightDown);

            portLeft = new ToggleButton((int)size.X / 2 - 30, 125, 20, 20);
            portLeft.Add(arrowLeftRight, "IO");
            portLeft.Add(arrowLeft, "O");
            portLeft.Add(arrowRight, "I");
            portLeft.onSelectedChanged += new ToggleButton.SelectedChanged(portLeft_onSelectedChanged);
            controls.Add(portLeft);

            portRight = new ToggleButton((int)size.X / 2 + 10, 125, 20, 20);
            portRight.Add(arrowLeftRight, "IO");
            portRight.Add(arrowRight, "O");
            portRight.Add(arrowLeft, "I");
            portRight.onSelectedChanged += new ToggleButton.SelectedChanged(portRight_onSelectedChanged);
            controls.Add(portRight);

            portUp = new ToggleButton((int)size.X / 2 - 10, 105, 20, 20);
            portUp.Add(arrowUpDown, "IO");
            portUp.Add(arrowUp, "O");
            portUp.Add(arrowDown, "I");
            portUp.onSelectedChanged += new ToggleButton.SelectedChanged(portUp_onSelectedChanged);
            controls.Add(portUp);

            portDown = new ToggleButton((int)size.X / 2 - 10, 145, 20, 20);
            portDown.Add(arrowUpDown, "IO");
            portDown.Add(arrowDown, "O");
            portDown.Add(arrowUp, "I");
            portDown.onSelectedChanged += new ToggleButton.SelectedChanged(portDown_onSelectedChanged);
            controls.Add(portDown);

            base.Initialize();
        }