Esempio n. 1
0
        public SelectHorizontal(string[] options, int selectedIndex) : base(options, selectedIndex)
        {
            var verticalLayout = new HorizontalGrid();

            Construct(options, selectedIndex, verticalLayout);
            SetActive(selectedIndex);
        }
Esempio n. 2
0
        public DropdownList(string[] options, int selectedIndex, float width = 100) : base(width)
        {
            _options = options;

            var grid  = new HorizontalGrid();
            var left  = new HorizontalLayout();
            var right = new HorizontalLayout(true);

            _activeLabel = new Label(options[selectedIndex]);
            left.Attach(_activeLabel);
            float height = Utils.CalcSize("Adsd", Style).y;

            _triangle = new TriangleComponent(height, height, Col.white);
            right.Attach(_triangle);
            grid.Attach(left, right);
            AddChild(grid);

            _opened = new VerticalLayout(InnerWidth);
            foreach (var option in options)
            {
                _opened.Attach(new ClickableLable(option, x =>
                {
                    _activeLabel.Title = x;
                    Toggle();
                }));
            }
        }
Esempio n. 3
0
        public HeaderWidget(string title) : base(title)
        {
            var layout = new HorizontalGrid();
            var hL0    = new HorizontalLayout();

            hL0.Attach(new Label(title));
            layout.Attach(hL0);
            AddChild(layout);
        }
Esempio n. 4
0
 public TextField(string title, System.Func <string> getValueCallback = null, System.Action <string> setValueCallback = null)
 {
     _valueComponent           = new ValueComponent <string>(getValueCallback, setValueCallback);
     AddChild(_textFieldLabel2 = new Label(title));
     _horizontalGrid           = new HorizontalGrid();
     _textFieldLabel           = new Label(getValueCallback != null ? getValueCallback() : "");
     _horizontalGrid.Attach(_textFieldLabel);
     _horizontalGrid.Style.Set(Styles.BackgroundColor, SecondaryColor);
     _textFieldLabel.Style.Set(Styles.FontColor, PrimaryColor);
     AddChild(_horizontalGrid);
 }
Esempio n. 5
0
        public HeaderWidget2(string title) : base(title)
        {
            var layout = new HorizontalGrid();
            var hL0    = new HorizontalLayout();
            var hL1    = new HorizontalLayout(true);

            hL0.Attach(new Label(title));
            _button = new ToggleButton(true);
            // add toggle button to hl1
            hL1.Attach(_button);

            layout.Attach(hL0, hL1);
            AddChild(layout);
        }
Esempio n. 6
0
        public SortableList(string[] items)
        {
            var index = 0;

            foreach (var item in items)
            {
                var grid = new HorizontalGrid();
                if (index++ == 0)
                {
                    _itemStyle = grid.Style;
                }
                grid.SetStyle(_itemStyle);
                Attach(
                    ((HorizontalGrid)grid.Attach(new Label(item))).SetAlignToCenter()
                    );
            }
        }
Esempio n. 7
0
        public Slider(string title, System.Func <float> getValueCallback = null, System.Action <float> setValueCallback = null, float min = 0, float max = 1, float width = 100f) : base(width)
        {
            _valueComponent = new ValueComponent <float>(getValueCallback, setValueCallback);
            _max            = max;
            _min            = min;

            _inactiveBar    = new HorizontalGrid();
            _activeBar      = new EmptySpace();
            _verticalLayout = new VerticalLayout();
            _valueLabel     = new ValueLabel(title, () => string.Format("{0:0.00}", Value));
            Value           = getValueCallback();

            _verticalLayout.Attach(
                _inactiveBar.Attach(
                    new HorizontalLayout().Attach(
                        _activeBar
                        )
                    )
                );
            BuildLayout();
        }