Example #1
0
        public void PopupAddContentText()
        {
            tlog.Debug(tag, $"PopupAddContentText START");

            var testingTarget = new Popup();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Popup>(testingTarget, "Should return Popup instance.");

            testingTarget.MinimumSize = new Size(1032, 184);
            testingTarget.Size        = new Size(1032, 400);
            testingTarget.Position    = new Position(150, 100);

            testingTarget.TitleText = "Popup";
            tlog.Debug(tag, "TitleText : " + testingTarget.TitleText);

            testingTarget.TitlePointSize = 15.0f;
            tlog.Debug(tag, "TitlePointSize : " + testingTarget.TitlePointSize);

            testingTarget.TitleTextColor = Color.Blue;
            tlog.Debug(tag, "TitelTextColor : " + testingTarget.TitleTextColor);

            testingTarget.TitleTextHorizontalAlignment = HorizontalAlignment.Begin;
            tlog.Debug(tag, "TitleTextHorizontalAlignment : " + testingTarget.TitleTextHorizontalAlignment);

            testingTarget.TitleTextPosition = new Position(64, 52);
            tlog.Debug(tag, "TitleTextPosition : " + testingTarget.TitleTextPosition);

            testingTarget.TitleHeight = 20;
            tlog.Debug(tag, "TitleHeight : " + testingTarget.TitleHeight);

            testingTarget.Title.Padding = 0;

            testingTarget.ImageShadow = new ImageShadow(image_path);

            testingTarget.BackgroundImage       = image_path;
            testingTarget.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);

            testingTarget.AddButton("Ok");
            testingTarget.AddButton("Cancel");

            testingTarget.ButtonBackground       = image_path;
            testingTarget.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
            testingTarget.ButtonOverLayBackgroundColorSelector = new Selector <Color>
            {
                Normal  = new Color(1.0f, 1.0f, 1.0f, 0.5f),
                Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f)
            };
            testingTarget.ButtonImageShadow = new ImageShadow(image_path);
            testingTarget.Post(Window.Instance);

            var contentText = new TextLabel();

            contentText.Size                = new Size(1032, 100);
            contentText.PointSize           = 20;
            contentText.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText.VerticalAlignment   = VerticalAlignment.Center;
            contentText.Text                = "Popup ButtonStyle!";
            contentText.TextColor           = new Color(0, 0, 222, 1);
            testingTarget.AddContentText(contentText);

            testingTarget.Dismiss();

            testingTarget.Dispose();
            tlog.Debug(tag, $"PopupAddContentText END (OK)");
        }
Example #2
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size            = new Size(1920, 1080),
                BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
            };
            window.Add(root);

            parent1 = new View()
            {
                Size = new Size(1920, 1080),
            };
            parent1.Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal,
                LinearAlignment   = LinearLayout.Alignment.Center,
                CellPadding       = new Size(50, 50)
            };

            parent2 = new View()
            {
                Size = new Size(1032, 980),
            };
            parent2.Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical,
                LinearAlignment   = LinearLayout.Alignment.CenterHorizontal,
                CellPadding       = new Size(400, 400)
            };

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]      = new TextLabel();
            createText[0].Text = "Create Popup just by properties";
            createText[0].WidthSpecification  = 500;
            createText[0].HeightSpecification = 100;
            parent2.Add(createText[0]);

            popup             = new Popup();
            popup.MinimumSize = new Size(1032, 184);
            popup.Size        = new Size(1032, 400);
            popup.Position    = new Position(150, 100);

            // Title
            popup.Title.PointSize = 25;
            popup.Title.Size      = new Size(0, 68);
            popup.Title.PositionUsesPivotPoint = true;
            popup.Title.ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft;
            popup.Title.PivotPoint             = Tizen.NUI.PivotPoint.TopLeft;
            popup.Title.HorizontalAlignment    = HorizontalAlignment.Begin;
            popup.Title.VerticalAlignment      = VerticalAlignment.Bottom;
            popup.Title.Position = new Position(64, 52);
            popup.Title.Text     = "Popup Title";
            popup.Title.Padding  = 0;

            // Shadow
            popup.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", new Rectangle(24, 24, 24, 24), extents: new Vector2(48, 48));

            // Background
            popup.BackgroundImage       = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png";
            popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);

            // Buttons
            popup.AddButton("Yes");
            popup.AddButton("Exit");
            popup.ButtonBackground       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
            popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
            popup.ButtonOverLayBackgroundColorSelector = new Selector <Color>
            {
                Normal  = new Color(1.0f, 1.0f, 1.0f, 0.5f),
                Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f)
            };
            popup.ButtonImageShadow       = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5));
            popup.ButtonTextColor         = color[0];
            popup.ButtonHeight            = 132;
            popup.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup.LayoutDirectionChanged += PopupLayoutDirectionChanged;
            popup.Post(window);

            contentText                     = new TextLabel();
            contentText.Size                = new Size(1032, 100);
            contentText.PointSize           = 20;
            contentText.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText.VerticalAlignment   = VerticalAlignment.Center;
            contentText.Text                = "Popup ButtonStyle is " + buttonStyles[index];
            contentText.TextColor           = new Color(0, 0, 222, 1);
            popup.AddContentText(contentText);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]      = new TextLabel();
            createText[1].Text = "Create Popup just by Attributes";
            createText[1].WidthSpecification  = 500;
            createText[1].HeightSpecification = 100;
            parent2.Add(createText[1]);

            PopupStyle attrs = new PopupStyle
            {
                MinimumSize     = new Size(1032, 184),
                BackgroundImage = new Selector <string> {
                    All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png"
                },
                BackgroundImageBorder = new Selector <Rectangle> {
                    All = new Rectangle(0, 0, 81, 81)
                },
                ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", new Rectangle(24, 24, 24, 24), extents: new Vector2(48, 48)),
                Title       = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color> {
                        All = Color.Black
                    },
                    Size = new Size(0, 68),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                    HorizontalAlignment    = HorizontalAlignment.Begin,
                    VerticalAlignment      = VerticalAlignment.Bottom,
                    Position = new Position(64, 52),
                    Text     = new Selector <string> {
                        All = "Popup Title"
                    },
                },
                Buttons = new ButtonStyle
                {
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundImage        = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png"
                    },
                    BackgroundImageBorder = new Selector <Rectangle> {
                        All = new Rectangle(5, 5, 5, 5)
                    },
                    ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)),
                    Overlay     = new ImageViewStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        WidthResizePolicy      = ResizePolicyType.FillToParent,
                        HeightResizePolicy     = ResizePolicyType.FillToParent,
                        BackgroundColor        = new Selector <Color>
                        {
                            Normal  = new Color(1.0f, 1.0f, 1.0f, 0.5f),
                            Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f),
                        }
                    },
                    Text = new TextLabelStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        HorizontalAlignment    = HorizontalAlignment.Center,
                        VerticalAlignment      = VerticalAlignment.Center,
                        TextColor = new Selector <Color> {
                            All = color[index2]
                        }
                    },
                },
            };

            popup2          = new Popup(attrs);
            popup2.Size     = new Size(1032, 400);
            popup2.Position = new Position(150, 600);
            popup2.AddButton("Yes");
            popup2.AddButton("Exit");
            popup2.ButtonHeight            = 132;
            popup2.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged;
            popup2.Post(window);

            contentText2                     = new TextLabel();
            contentText2.Size                = new Size(1032, 100);
            contentText2.PointSize           = 20;
            contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText2.VerticalAlignment   = VerticalAlignment.Center;
            contentText2.Text                = "Popup2 ButtonStyle is " + buttonStyles[index];
            popup2.ContentView.Add(contentText2);

            button = new Button();
            button.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.WidthSpecification    = 580;
            button.HeightSpecification   = 80;
            button.TextLabel.Text        = "LayoutDirection is left to right";
            button.Clicked += ButtonClicked;

            parent1.Add(parent2);
            parent1.Add(button);
            root.Add(parent1);
        }
Example #3
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D          = new Size2D(1920, 1080),
                BackgroundColor = Color.White,
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Popup just by properties";
            createText[0].Size2D     = new Size2D(500, 100);
            createText[0].Position2D = new Position2D(500, 50);
            root.Add(createText[0]);

            popup             = new Popup();
            popup.MinimumSize = new Size2D(1032, 184);
            popup.Size        = new Size(1032, 400);
            popup.Position    = new Position(200, 100);

            // Title
            popup.Style.Title.PointSize           = 25;
            popup.Style.Title.SizeHeight          = 68;
            popup.Style.Title.HorizontalAlignment = HorizontalAlignment.Begin;
            popup.Style.Title.Position            = new Position(64, 52);
            popup.Style.Title.Text = "Popup Title";

            // Shadow
            popup.Style.ImageShadow = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png",
                Border = new Rectangle(24, 24, 24, 24),
                Offset = new Vector2(-24, -24),
                // TODO We do not have shadow extents now, so replace it to scale value
                Scale = new Vector2(1080f / 1032f, 448f / 400f),
            };

            // Background
            popup.BackgroundImage       = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png";
            popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81);

            // Buttons
            popup.AddButton("Yes");
            popup.AddButton("Exit");
            popup.ButtonBackground       = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png";
            popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5);
            popup.ButtonOverLayBackgroundColorSelector = new Selector <Color>
            {
                Normal   = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                Pressed  = new Color(0.0f, 0.0f, 0.0f, 0.1f),
                Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
            };
            popup.ButtonImageShadow = new ImageShadow
            {
                Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                Border = new Rectangle(5, 5, 5, 5)
            };
            popup.ButtonTextColor         = color[0];
            popup.ButtonHeight            = 132;
            popup.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup.LayoutDirectionChanged += PopupLayoutDirectionChanged;
            popup.Post(window);

            contentText                     = new TextLabel();
            contentText.Size2D              = new Size2D(904, 100);
            contentText.PointSize           = 20;
            contentText.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText.VerticalAlignment   = VerticalAlignment.Center;
            contentText.Text                = "Popup ButtonStyle is " + buttonStyles[index];
            contentText.TextColor           = new Color(0, 0, 222, 1);
            popup.AddContentText(contentText);

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Popup just by Attributes";
            createText[1].Size2D     = new Size2D(500, 100);
            createText[1].Position2D = new Position2D(500, 550);
            root.Add(createText[1]);

            PopupStyle attrs = new PopupStyle
            {
                MinimumSize     = new Size2D(1032, 184),
                BackgroundImage = new Selector <string> {
                    All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png"
                },
                BackgroundImageBorder = new Selector <Rectangle> {
                    All = new Rectangle(0, 0, 81, 81)
                },
                ImageShadow = new ImageShadow
                {
                    Url    = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png",
                    Border = new Rectangle(24, 24, 24, 24),
                    Offset = new Vector2(-24, -24),
                    // TODO We do not have shadow extents now, so replace it to scale value
                    Scale = new Vector2(1080f / 1032f, 448f / 400f),
                },
                Title = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color> {
                        All = Color.Black
                    },
                    Size = new Size(0, 68),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                    HorizontalAlignment    = HorizontalAlignment.Begin,
                    VerticalAlignment      = VerticalAlignment.Bottom,
                    Position = new Position(64, 52),
                    Text     = new Selector <string> {
                        All = "Popup Title"
                    },
                },
                Buttons = new ButtonStyle
                {
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundImage        = new Selector <string> {
                        All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png"
                    },
                    BackgroundImageBorder = new Selector <Rectangle> {
                        All = new Rectangle(5, 5, 5, 5)
                    },
                    ImageShadow = new ImageShadow
                    {
                        Url    = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                        Border = new Rectangle(5, 5, 5, 5),
                    },
                    Overlay = new ImageViewStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        WidthResizePolicy      = ResizePolicyType.FillToParent,
                        HeightResizePolicy     = ResizePolicyType.FillToParent,
                        BackgroundColor        = new Selector <Color>
                        {
                            Normal   = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                            Pressed  = new Color(0.0f, 0.0f, 0.0f, 0.1f),
                            Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
                        }
                    },
                    Text = new TextLabelStyle
                    {
                        PositionUsesPivotPoint = true,
                        ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                        PivotPoint             = Tizen.NUI.PivotPoint.Center,
                        HorizontalAlignment    = HorizontalAlignment.Center,
                        VerticalAlignment      = VerticalAlignment.Center,
                        TextColor = new Selector <Color> {
                            All = color[index2]
                        },
                    },
                },
            };

            popup2          = new Popup(attrs);
            popup2.Size     = new Size(1032, 400);
            popup2.Position = new Position(200, 600);
            popup2.AddButton("Yes");
            popup2.AddButton("Exit");
            popup2.ButtonHeight            = 132;
            popup2.PopupButtonClickEvent  += PopupButtonClickedEvent;
            popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged;
            popup2.Post(window);

            contentText2                     = new TextLabel();
            contentText2.Size2D              = new Size2D(904, 100);
            contentText2.PointSize           = 20;
            contentText2.HorizontalAlignment = HorizontalAlignment.Begin;
            contentText2.VerticalAlignment   = VerticalAlignment.Center;
            contentText2.Text                = "Popup2 ButtonStyle is " + buttonStyles[index];
            popup2.ContentView.Add(contentText2);

            button = new Button();
            button.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.Size2D          = new Size2D(580, 80);
            button.Position2D      = new Position2D(1300, 500);
            button.Style.Text.Text = "LayoutDirection is left to right";
            button.ClickEvent     += ButtonClickEvent;
            root.Add(button);
        }