Ejemplo n.º 1
0
        public AxisController(string name, bool fullCircle)
        {
            _fullCircle = fullCircle;

            Layout mainLayout = Layout.makeHorizontal();

            var nameLabel = new Label(name);
            nameLabel.area.width = 50;
            nameLabel.font.normal = Color.white;
            nameLabel.font.style = FontStyle.Bold;

            mainLayout.views.add(nameLabel);

            Layout digitalLayout = Layout.makeHorizontal();

            digitalLayout.views.add(new Space());

            digitalLayout.views.add(_button("<<<", -15));
            digitalLayout.views.add(_button("<<", -5));
            digitalLayout.views.add(_button("<", -1));

            _info = new Label("0");
            _info.area.width = 30;
            _info.font.alignment = Alignment.Center;
            _info.font.style = FontStyle.Bold;

            digitalLayout.views.add(_info);

            digitalLayout.views.add(_button(">", 1));
            digitalLayout.views.add(_button(">>", 5));
            digitalLayout.views.add(_button(">>>", 15));

            digitalLayout.views.add(new Space());

            Layout analogLayout = Layout.makeHorizontal();

            _slider = new Slider(-90, 90, 0);
            _slider.onUpdate = (s => { updateSliderValue(s.value); });

            analogLayout.views.add(_slider);

            Layout controlLayout = Layout.makeVertical();
            controlLayout.views.add(digitalLayout);
            controlLayout.views.add(analogLayout);

            mainLayout.views.add(controlLayout);

            Layout switchLayout = Layout.makeVertical();

            switchLayout.views.add(new Space(10));

            _sideSwitch = new Button("+");
            _sideSwitch.area.width = 30;
            _sideSwitch.area.height = 30;
            _sideSwitch.onClick = ((b, m) =>
                    {
                        onFrontSide = !onFrontSide;

                        if(onFrontSide)
                            b.text = "+";
                        else
                            b.text = "-";
                    });

            if(_fullCircle)
                switchLayout.views.add(_sideSwitch);
            else
            {
                Layout placeholder = Layout.makeHorizontal();
                placeholder.views.add(new Space(34));

                switchLayout.views.add(placeholder);
            }

            switchLayout.views.add(new Space());

            mainLayout.views.add(new Space(10));

            mainLayout.views.add(switchLayout);
            _view = mainLayout;
        }
Ejemplo n.º 2
0
 public void add(View view)
 {
     _childs.Add(view);
     view.container = this;
 }
Ejemplo n.º 3
0
 public void remove(View view)
 {
     _childs.Remove(view);
     view.container = null;
 }
Ejemplo n.º 4
0
 public ViewContainer(View view)
 {
     _parent = view;
     _childs = new List<View>();
 }