コード例 #1
0
ファイル: TextLayout.cs プロジェクト: emmauss/VisiPlacer
        // returns a TextLayout that still gets fractional points while cropped
        public static LayoutChoice_Set New_Croppable(TextItem_Configurer textItem, double fontSize, bool scoreIfEmpty = true)
        {
            // We make a ScrollLayout and ask it to do the size computations but to not actually put the result into a ScrollView
            TextLayout textLayout = new TextLayout(textItem, fontSize, true, scoreIfEmpty);

            return(ScrollLayout.New(textLayout, null));
        }
コード例 #2
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());
        }
コード例 #3
0
 public LayoutChoice_Set Build()
 {
     List<LayoutChoice_Set> fontChoices = new List<LayoutChoice_Set>();
     LayoutChoice_Set large = this.MakeSublayout(20);
     fontChoices.Add(ScrollLayout.New(large));
     LayoutChoice_Set small = this.MakeSublayout(16);
     fontChoices.Add(small);
     return new LayoutUnion(fontChoices);
 }
コード例 #4
0
        public LayoutChoice_Set Build()
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();
            int minIndex = Math.Max(this.contributions.Count - 12, 0);

            for (int i = this.contributions.Count - 1; i >= minIndex; i--)
            {
                builder.AddLayout(this.MakeSublayout(this.contributions[i]));
            }

            return(ScrollLayout.New(builder.Build()));
        }
コード例 #5
0
        public PopoutTextbox(string title, LayoutStack layoutStack)
        {
            this.title       = title;
            this.layoutStack = layoutStack;

            Button button = new Button();

            button.Clicked += Button_Clicked;
            this.button     = button;

            ButtonLayout buttonLayout = ButtonLayout.WithoutBevel(button);

            this.textBox       = new Editor();
            this.detailsLayout = new TitledControl(title, ScrollLayout.New(new TextboxLayout(this.textBox)));

            this.SubLayout = new TitledControl(title, buttonLayout);
        }
コード例 #6
0
        public TextMeasurement_Test_Layout()
        {
            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            Editor textBox = new Editor();

            textBox.TextChanged += TextBox_TextChanged;
            this.textBox         = textBox;
            gridBuilder.AddLayout(new TextboxLayout(textBox, 16));

            for (double i = 0; i < 8; i += 1)
            {
                Label textBlock1 = new Label();
                textBlock1.BackgroundColor = Color.Red;
                TextblockLayout textBlockLayout = new TextblockLayout(textBlock1, i + 16, false, true);
                textBlockLayout.ScoreIfEmpty = false;
                gridBuilder.AddLayout(textBlockLayout);
                this.textBlockLayouts.Add(textBlockLayout);
            }

            this.SubLayout = ScrollLayout.New(gridBuilder.Build());
        }