コード例 #1
0
 public void NextFeature()
 {
     if (_derivedView.Layout == null)
     {
         _derivedView.Layout = new LinearLayout();
     }
     Window.Instance.Remove(nextFeatureButton);
     LayoutingExample.GetToolbar().Add(helpButton);
 }
コード例 #2
0
 public void NextFeature()
 {
     if (_derivedView.Layout == null)
     {
         _derivedView.Layout = new LinearLayout();
         _derivedView.HeightSpecification = LayoutParamPolicies.WrapContent;
     }
     Window.Instance.Remove(nextFeatureButton);
     LayoutingExample.GetToolbar().Add(helpButton);
 }
コード例 #3
0
        public override void Remove()
        {
            Window window = Window.Instance;

            if (helpImageView)
            {
                window.Remove(helpImageView);
                helpImageView = null;
            }
            helpShowing = false;
            LayoutingExample.GetToolbar().Remove(helpButton);
            window.Remove(View01);
            window.Remove(View02);
            helpButton = null;
        }
コード例 #4
0
        public override void Remove()
        {
            Window window = LayoutingExample.GetWindow();

            if (helpImageView)
            {
                window.Remove(helpImageView);
                helpImageView = null;
            }
            helpShowing = false;
            LayoutingExample.GetToolbar().Remove(helpButton);
            window.Remove(contentBackgroundShadow);
            helpButton = null;
            contentBackgroundShadow = null;
        }
コード例 #5
0
        // Execute different features to test
        public void NextFeature()
        {
            switch (featureIndex)
            {
            // Parent container assigned a layout after tree constructed.
            // Children should now be laid out horizontally .
            case ExampleFeature.SET_PARENT_HORIZONTAL_LAYOUT:
            {
                _parentContainer.Layout     = createHbox();
                nextFeatureButton.LabelText = "Add child with no layout";
                featureIndex = ExampleFeature.ADD_CHILD_VIEW_WITH_NO_LAYOUT;
                break;
            }

            // Add a View without a layout but with 2 children.
            // 2 children will be overlapping.
            case ExampleFeature.ADD_CHILD_VIEW_WITH_NO_LAYOUT:
            {
                _childView = new View();
                for (var i = 0; i < 2; i++)
                {
                    _childView.Add(CreateImageView("3rdSet"));
                }
                _imageViewContainer2.Add(_childView);
                nextFeatureButton.LabelText = "Add linear layout to last added child";
                featureIndex = ExampleFeature.ADD_LINEAR_LAYOUT_TO_LAST_ADDED_CHILD;
                break;
            }

            // A horizontal layout added to the View that had no layout.
            // It's children should now be laid out horizontally too.
            case ExampleFeature.ADD_LINEAR_LAYOUT_TO_LAST_ADDED_CHILD:
            {
                LayoutingExample.GetToolbar().Add(helpButton);
                _childView.Layout = createHbox();
                LayoutingExample.GetWindow().Remove(nextFeatureButton);
                break;
            }

            default:
            {
                break;
            }
            }
        }
コード例 #6
0
ファイル: NoLayoutExample.cs プロジェクト: theojin/nui-demo
        public override void Create()
        {
            Window window = Window.Instance;

            window.BackgroundColor = Color.White;

            view = new View()
            {
                Size2D                 = new Size2D(476, 500),
                BackgroundColor        = Color.Green,
                Position2D             = new Position2D(2, 0),
                ParentOrigin           = ParentOrigin.BottomRight,
                PivotPoint             = PivotPoint.BottomRight,
                PositionUsesPivotPoint = true,
            };
            window.Add(view);

            TextLabel textLabel = new TextLabel()
            {
                Size2D                 = new Size2D(274, 70),
                BackgroundColor        = Color.Red,
                Position2D             = new Position2D(0, -10),
                Name                   = "TextLabel",
                Text                   = "Enter password",
                ParentOrigin           = ParentOrigin.BottomCenter,
                PivotPoint             = PivotPoint.BottomCenter,
                PositionUsesPivotPoint = true,
            };

            view.Add(textLabel);

            TextField field = new TextField()
            {
                Size2D          = new Size2D(120, 80),
                Position2D      = new Position2D(150, 85),
                BackgroundColor = Color.Cyan,
                Name            = "TextField",
                PlaceholderText = "input something",
            };

            view.Add(field);

            CreateHelpButton();
            LayoutingExample.GetToolbar().Add(helpButton);
        }
コード例 #7
0
        public override void Remove()
        {
            Window window = LayoutingExample.GetWindow();

            if (helpImageView)
            {
                window.Remove(helpImageView);
                helpImageView = null;
            }
            helpShowing = false;
            LayoutingExample.GetToolbar().Remove(helpButton);
            window.Remove(_parentContainer);
            window.Remove(nextFeatureButton);
            nextFeatureButton    = null;
            helpButton           = null;
            _parentContainer     = null;
            _imageViewContainer2 = null;
            _childView           = null;
            featureIndex         = ExampleFeature.SET_PARENT_VERTICAL_LAYOUT;
        }
コード例 #8
0
        public override void Create()
        {
            Window window = Window.Instance;

            linearView = new View()
            {
                LayoutWidthSpecificationFixed = 480,
                HeightSpecification           = LayoutParamPolicies.WrapContent,
                BackgroundColor = Color.Blue,
                Name            = "LinearView",
                Position2D      = new Position2D(0, 250)
            };
            var layout = new LinearLayout();

            linearView.Layout = layout;
            window.Add(linearView);

            greenView = new View()
            {
                BackgroundColor     = Color.Green,
                Name                = "GreenView",
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };
            linearView.Add(greenView);

            TextLabel textLabel = new TextLabel()
            {
                Name      = "TextLabel",
                Text      = "TextLabel in a View",
                PointSize = 20.0f
            };

            greenView.Add(textLabel);

            CreateHelpButton();
            LayoutingExample.GetToolbar().Add(helpButton);
        }
コード例 #9
0
        public override void Create()
        {
            Window window = Window.Instance;

            View01 = new View()
            {
                BackgroundColor = Color.Green,
                Position2D      = new Position2D(0, window.Size.Height / 8),
                Size2D          = new Size2D(window.Size.Width / 2, (window.Size.Height / 8) * 7),
                Name            = "View01"
            };
            window.Add(View01);

            View02 = new View()
            {
                Position2D          = new Position2D(window.Size.Width / 2, window.Size.Height / 8),
                WidthSpecification  = (window.Size.Width / 2),
                HeightSpecification = (window.Size.Height / 8) * 7,
                BackgroundColor     = Color.Blue,
                Layout = new LinearLayout(),
                Name   = "View02LinearView",
            };
            window.Add(View02);

            View03 = new View()
            {
                BackgroundColor = Color.Yellow,
                Name            = "View03",
                Size2D          = new Size2D(20, (window.Size.Height / 8) * 7)
            };
            View01.Add(View03);

            LinearLayout verticalLayout = new LinearLayout();

            verticalLayout.LinearOrientation = LinearLayout.Orientation.Vertical;

            View04 = new View()
            {
                BackgroundColor     = Color.Cyan,
                PositionX           = View03.Size2D.Width,
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                Layout = verticalLayout,
                Name   = "View04LinearView",
            };
            View01.Add(View04);

            View07 = new View()
            {
                BackgroundColor = Color.Blue,
                Size2D          = new Size2D(200, 200),
                Name            = "View07"
            };
            View03.Add(View07);

            ImageView06      = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(100, 100));
            ImageView06.Name = "imageView-06";
            View04.Add(ImageView06);

            ImageView04      = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(200, 200));
            ImageView04.Name = "imageView-04";
            View07.Add(ImageView04);

            View08 = new View()
            {
                BackgroundColor = Color.Magenta,
                Size2D          = new Size2D(280, 280),
                Name            = "View08"
            };
            View04.Add(View08);

            ImageView03      = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(100, 100));
            ImageView03.Name = "imageView-03";
            View08.Add(ImageView03);

            View05 = new View()
            {
                BackgroundColor = Color.Yellow,
                Name            = "View05",
                Size2D          = new Size2D(10, 100)
            };
            View02.Add(View05);

            FlexContainer legacyContainer = new FlexContainer();

            legacyContainer.FlexDirection = FlexContainer.FlexDirectionType.Column;
            legacyContainer.Size2D        = new Size2D(View02.Size2D.Width / 2, 280);
            legacyContainer.Name          = "legacyFlexContainer";
            View02.Add(legacyContainer);

            ImageView02      = LayoutingExample.CreateChildImageView("res/images/application-icon-103.png", new Size2D(100, 100));
            ImageView02.Name = "imageView-02";
            legacyContainer.Add(ImageView02);
            ImageView01      = LayoutingExample.CreateChildImageView("res/images/application-icon-104.png", new Size2D(100, 100));
            ImageView01.Name = "imageView-01";
            legacyContainer.Add(ImageView01);

            ImageView05      = LayoutingExample.CreateChildImageView("res/images/application-icon-102.png", new Size2D(100, 100));
            ImageView05.Name = "imageView-05";
            View05.Add(ImageView05);

            CreateHelpButton();
            LayoutingExample.GetToolbar().Add(helpButton);
        }
コード例 #10
0
        public override void Create()
        {
            Window window = LayoutingExample.GetWindow();

            contentBackgroundShadow = new View()
            {
                Name            = "contentBackgroundShadow",
                Size2D          = new Size2D(window.Size.Width, 500),
                BackgroundColor = new Color(75f, 0f, 130f, 0.8f),
                Position2D      = new Position2D(0, 40),
            };

            // Create gradient visual that can be set as a background
            GradientVisual gradientVisualMap1 = new GradientVisual();
            PropertyArray  stopColor          = new PropertyArray();

            stopColor.Add(new PropertyValue(new Vector4(0.35f, 0.0f, 0.65f, 0.9f)));
            stopColor.Add(new PropertyValue(new Vector4(1.0f, 0.99f, 0.89f, 0.9f)));
            gradientVisualMap1.StopColor      = stopColor;
            gradientVisualMap1.StartPosition  = new Vector2(0.0f, -0.5f);
            gradientVisualMap1.EndPosition    = new Vector2(-0.5f, 0.5f);
            gradientVisualMap1.PositionPolicy = VisualTransformPolicyType.Relative;
            gradientVisualMap1.SizePolicy     = VisualTransformPolicyType.Relative;

            int  shadowOffset        = 4;
            View backgroundContainer = new View()
            {
                Name = "backgroundContainer",
                PositionUsesPivotPoint = true,
                Size2D       = new Size2D((window.Size.Width - (shadowOffset * 2)), (500 - (shadowOffset * 2))),
                Position2D   = new Position2D(shadowOffset, shadowOffset),
                PivotPoint   = PivotPoint.TopLeft,
                ParentOrigin = ParentOrigin.TopLeft,
                Background   = gradientVisualMap1.OutputVisualMap,
            };

            View contentBackground = new View()
            {
                Name = "contentBackground",
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.Center,
                ParentOrigin           = ParentOrigin.Center,
                BackgroundColor        = Color.Yellow,
                Layout              = createVbox(),
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            TextLabel textLabel = new TextLabel()
            {
                BackgroundColor = Color.White,
                Position2D      = new Position2D(0, -10),
                Name            = "TextLabel",
                Text            = "Popup title",
                PointSize       = 34
            };

            contentBackground.Add(textLabel);

            View contentContainer = new View()
            {
                Name                = "contentContainer",
                Layout              = createHbox(),
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.WrapContent
            };

            contentBackground.Add(contentContainer);

            View contentAreaOne = new View()
            {
                Name                = "contentAreaOne",
                Layout              = createVbox(),
                Margin              = new Extents(10, 10, 10, 10),
                Padding             = new Extents(15, 10, 15, 10),
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
                BackgroundColor     = Color.Red,
            };

            contentContainer.Add(contentAreaOne);

            View contentAreaTwo = new View()
            {
                Name                = "contentAreaTwo",
                Layout              = createVbox(),
                WidthSpecification  = LayoutParamPolicies.WrapContent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
                BackgroundColor     = Color.Cyan,
            };

            contentContainer.Add(contentAreaTwo);

            ImageView[] children = new ImageView[3];
            for (int i = 0; i < 3; i++)
            {
                children[i]                     = new ImageView("./res/images/gallery-small-23.jpg");
                children[i].PivotPoint          = PivotPoint.Center;
                children[i].WidthSpecification  = 70;
                children[i].HeightSpecification = 70;
                children[i].BackgroundColor     = new Color(i * 0.25f, i * 0.25f, 1.0f, 1.0f);
                children[i].Name                = "imageView1stSet_" + i;
                contentAreaOne.Add(children[i]);
            }
            ;

            ImageView[] children2 = new ImageView[5];
            for (int i = 0; i < 5; i++)
            {
                children2[i]                     = new ImageView("./res/images/application-icon-102.png");
                children2[i].PivotPoint          = PivotPoint.Center;
                children2[i].WidthSpecification  = 200;
                children2[i].HeightSpecification = 70;
                children2[i].BackgroundColor     = new Color(i * 0.25f, i * 0.25f, 1.0f, 1.0f);
                children2[i].Name                = "imageView2ndSet_" + i;
                contentAreaTwo.Add(children2[i]);
            }
            ;

            backgroundContainer.Add(contentBackground);
            contentBackgroundShadow.Add(backgroundContainer);

            window.Add(contentBackgroundShadow);
            CreateHelpButton();
            LayoutingExample.GetToolbar().Add(helpButton);
        }