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()); }
public TextDiagnosticLayout() { //GridLayout grid0 = GridLayout.New(BoundProperty_List.Uniform(2), BoundProperty_List.Uniform(1), new LayoutScore()); Editor editor = new Editor(); editor.TextChanged += Editor_TextChanged; //grid0.AddLayout(new TextboxLayout(editor)); BoundProperty_List heights = new BoundProperty_List(3); heights.BindIndices(0, 1); heights.BindIndices(0, 2); heights.SetPropertyScale(0, 1); heights.SetPropertyScale(1, 1); heights.SetPropertyScale(2, 12); GridLayout grid1 = GridLayout.New(heights, new BoundProperty_List(1), LayoutScore.Zero); View bottomView = new ContentView(); bottomView.BackgroundColor = Color.DarkGray; GridLayout grid2 = GridLayout.New(new BoundProperty_List(1), new BoundProperty_List(2), LayoutScore.Zero); this.editorToUpdate = new Editor(); grid2.AddLayout(new TextboxLayout(this.editorToUpdate)); View rightView = new ContentView(); rightView.BackgroundColor = Color.Green; grid2.AddLayout(new ImageLayout(rightView, LayoutScore.Get_UsedSpace_LayoutScore(1))); grid1.AddLayout(grid2); grid1.AddLayout(new TextboxLayout(editor)); grid1.AddLayout(new ImageLayout(bottomView, LayoutScore.Get_UsedSpace_LayoutScore(1000))); this.SubLayout = grid1; }
public BoundProperty_List(BoundProperty_List original) { this.values = new double[original.values.Length]; original.values.CopyTo(this.values, 0); this.scales = new double[original.scales.Length]; original.scales.CopyTo(this.scales, 0); this.indicesByGroup = new List <List <int> >(original.indicesByGroup); }
public static BoundProperty_List WithRatios(List <double> ratios) { BoundProperty_List result = Uniform(ratios.Count); for (int i = 0; i < ratios.Count; i++) { result.SetPropertyScale(i, ratios[i]); } return(result); }
public static BoundProperty_List Uniform(int numProperties) { BoundProperty_List result = new BoundProperty_List(numProperties); int i; for (i = 1; i < numProperties; i++) { result.BindIndices(0, i); } return(result); }
public LayoutStack(bool showBackButtons = true) { this.showBackButtons = showBackButtons; if (showBackButtons) { BoundProperty_List rowHeights = new BoundProperty_List(3); rowHeights.BindIndices(0, 1); rowHeights.BindIndices(0, 2); rowHeights.SetPropertyScale(0, 28); rowHeights.SetPropertyScale(1, 1); // extra unused space for visual separation rowHeights.SetPropertyScale(2, 3); this.mainGrid = GridLayout.New(rowHeights, new BoundProperty_List(1), LayoutScore.Zero); this.SubLayout = this.mainGrid; } }
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(); }
private LayoutChoice_Set build() { GridLayout_Builder mainBuilder = new Vertical_GridLayout_Builder().Uniform(); this.buttons = new List <Button>(); this.subtitles = new List <TextblockLayout>(); this.buttonDestinations = new Dictionary <Button, ValueProvider <StackEntry> >(); for (int i = 0; i < this.buttonNameProviders.Count; i++) { Button button = new Button(); button.Clicked += Button_Clicked; this.buttons.Add(button); ButtonLayout buttonLayout = new ButtonLayout(button); TextblockLayout subtitleLayout = new TextblockLayout(); subtitleLayout.AlignHorizontally(TextAlignment.Center); subtitleLayout.AlignVertically(TextAlignment.Center); subtitleLayout.ScoreIfEmpty = false; this.subtitles.Add(subtitleLayout); BoundProperty_List columnWidths = new BoundProperty_List(2); columnWidths.SetPropertyScale(0, 2); columnWidths.SetPropertyScale(1, 1); columnWidths.BindIndices(0, 1); GridLayout entryGrid = GridLayout.New(new BoundProperty_List(1), columnWidths, LayoutScore.Get_UnCentered_LayoutScore(1)); entryGrid.AddLayout(buttonLayout); entryGrid.AddLayout(subtitleLayout); LayoutUnion content = new LayoutUnion(entryGrid, buttonLayout); mainBuilder.AddLayout(content); ValueProvider <StackEntry> destinationProvider = destinationProviders[i]; this.buttonDestinations[button] = destinationProvider; } return(LayoutCache.For(mainBuilder.BuildAnyLayout())); }
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(); }