Esempio n. 1
0
        public Choose_LayoutDefaults_Layout(IEnumerable <VisualDefaults> choices)
        {
            // title
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            builder.AddLayout(new TextblockLayout("Choose a theme!"));

            Editor sampleTextbox = new Editor();

            // There's a bug in Uniforms.Misc where it saves the first font you ask about and always returns sizes for that font
            sampleTextbox.Text = "Sample editable text";
            builder.AddLayout(new TextboxLayout(sampleTextbox));

            // individual themes
            List <VisualDefaults> choiceList = new List <VisualDefaults>(choices);
            int        numColumns            = 2;
            int        numRows = (choiceList.Count + 1) / 2;
            GridLayout grid    = GridLayout.New(BoundProperty_List.Uniform(numRows), BoundProperty_List.Uniform(numColumns), LayoutScore.Zero);

            foreach (VisualDefaults choice in choiceList)
            {
                // add a separator so the user can see when it changes
                OverrideLayoutDefaults_Layout container = new OverrideLayoutDefaults_Layout(choice);
                container.SubLayout = this.makeDemoLayout(choice);
                grid.AddLayout(container);
            }
            builder.AddLayout(grid);

            // scrollable
            this.SubLayout = ScrollLayout.New(builder.Build());
        }
Esempio n. 2
0
        public ReorderableList(IEnumerable <T> items, LayoutProvider <T> layoutProvider)
        {
            // get the items and layouts
            this.Items       = new List <T>(items);
            this.itemLayouts = new List <LayoutChoice_Set>();

            foreach (T item in items)
            {
                LayoutChoice_Set itemLayout = layoutProvider.GetLayout(item);
                this.itemLayouts.Add(itemLayout);
            }

            this.makeArrows();
            BoundProperty_List columnWidths = new BoundProperty_List(2);

            columnWidths.BindIndices(0, 1);
            columnWidths.SetPropertyScale(0, 1);
            columnWidths.SetPropertyScale(1, 7);
            this.mainGrid  = GridLayout.New(BoundProperty_List.Uniform(this.itemLayouts.Count), columnWidths, LayoutScore.Zero);
            this.SubLayout = this.mainGrid;
            this.putLayouts();
        }
Esempio n. 3
0
 private LayoutChoice_Set MakeSublayout(double fontSize)
 {
     Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();
     GridLayout gridLayout = GridLayout.New(new BoundProperty_List(this.components.Count()), BoundProperty_List.Uniform(1), LayoutScore.Zero);
     foreach (HelpBlock block in this.components)
     {
         builder.AddLayout(block.Get(fontSize, this.components.Count()));
     }
     return builder.Build();
 }