Exemplo n.º 1
0
    void Init()
    {
        var vbox = new VBox();

        vbox.percentWidth = vbox.percentHeight = 100;
        vbox.setStyle("verticalGap", 2);
        vbox.setStyle("verticalAlign", "top");
        //vbox.setStyle("verticalCenter", 0);

        var test = new Test();

        var hbox = new HBox();

        hbox.percentWidth = 100;
        hbox.setStyle("horizontalGap", 2);

        AddLabel(hbox, "Width: ");
        AddInput(hbox, test.Width, num =>
        {
            test.Width = (float)num;
            vbox.invalidateDisplayList();
        });
        AddLabel(hbox, "Height: ");
        AddInput(hbox, test.Height, num =>
        {
            test.Height = (float)num;
            vbox.invalidateDisplayList();
        });
        AddCheckBox(hbox, "Vertical", test.Vertical, f => { test.Vertical = f; });
        AddCheckBox(hbox, "RTL", test.RTL, f => { test.RTL = f; });
        AddComboBox(hbox, "Brush: ", 0, v => { test.Brush = v; }, "Solid", "LG", "Texture");
        vbox.addChild(hbox);

        hbox = new HBox();
        hbox.percentWidth = 100;
        hbox.setStyle("horizontalGap", 2);

        AddComboBox(hbox, "Align: ", 0, v => { test.Align = (StringAlignment)v; }, "near", "center", "far");
        AddComboBox(hbox, "Line Align: ", 0, v => { test.LineAlign = (StringAlignment)v; }, "near", "center", "far");

        AddComboBox(hbox, "Trimming: ", (int)test.Trimming,
                    v => { test.Trimming = (StringTrimming)v; },
                    "None", "Char", "Word", "EllipsisChar", "EllipsisWord", "EllipsisPath");

        vbox.addChild(hbox);

        hbox = new HBox();
        hbox.percentWidth = 100;
        hbox.setStyle("horizontalGap", 2);
        AddLabel(hbox, "Font: ");
        AddCheckBox(hbox, "Bold", test.Bold, f => { test.Bold = f; });
        vbox.addChild(hbox);

        vbox.addChild(test);
        addChild(vbox);
    }