public override void OnCreate(View root) { var resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; NUIApplication.GetDefaultWindow().BackgroundColor = Color.White; popup0 = new Popup(); popup0.BackgroundColor = Color.Cyan; popup0.Title.Text = "Popup0"; popup0.Size = new Size(300, 200); popup0.ButtonHeight = 60; popup0.AddButton("Left"); popup0.AddButton("Right"); popup0.PopupButtonClickEvent += Popup0ButtonClickedEvent; popup0.Post(NUIApplication.GetDefaultWindow()); var style = new PopupStyle() { IncludeDefaultStyle = true, Size = new Size(300, 200), Position = new Position(60, 60), BackgroundColor = Color.Magenta, Title = new TextLabelStyle() { Text = "Popup1", TextColor = Color.White, }, Buttons = new ButtonStyle() { CornerRadius = 0, SizeHeight = 60, BackgroundColor = new Selector <Color>() { Normal = new Color(1, 1, 1, 1), Pressed = new Color(1, 1, 1, 0.5f), }, Overlay = new ImageViewStyle() { BackgroundColor = new Selector <Color>() { Pressed = new Color(0, 0, 0, 0.1f), Other = new Color(1, 1, 1, 0.1f), }, }, Text = new TextLabelStyle() { TextColor = new Color(0.05f, 0.63f, 0.9f, 1), } } }; popup1 = new Popup(style); popup1.AddButton("Left"); popup1.AddButton("Right"); popup1.PopupButtonClickEvent += Popup1ButtonClickedEvent; popup1.Post(NUIApplication.GetDefaultWindow()); }
public void PopupAddButton() { tlog.Debug(tag, $"PopupAddButton START"); var testingTarget = new Popup(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Popup>(testingTarget, "Should return Popup instance."); try { testingTarget.AddButton("lb"); ButtonStyle style = new ButtonStyle() { Opacity = 0.8f, }; testingTarget.AddButton("rb", style); var result = testingTarget.GetButton(0); tlog.Debug(tag, "GetButton : " + result); try { testingTarget.RemoveButton(0); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } testingTarget.Dispose(); tlog.Debug(tag, $"PopupAddButton END (OK)"); }
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); }
public override void OnCreate(View root) { var popupStyle1 = new PopupStyle() { Size = new Size(500, 200), BackgroundColor = Color.White, BoxShadow = new Shadow(6.0f, Color.Blue, extents: new Vector2(5, 5)), Title = new TextLabelStyle { TextColor = Color.Black, PixelSize = 16, Text = "PopupStyle1" }, Buttons = new ButtonStyle { SizeHeight = 50, BackgroundColor = new Selector <Color> { Pressed = Color.Black, Other = Color.Cyan, }, Text = new TextLabelStyle { TextColor = new Selector <Color> { Pressed = Color.White, Other = Color.Black, }, PixelSize = 12, }, ParentOrigin = ParentOrigin.BottomLeft, PivotPoint = PivotPoint.BottomLeft, PositionUsesPivotPoint = true }, ThemeChangeSensitive = true, }; var popupStyle2 = popupStyle1.Clone() as PopupStyle; popupStyle2.BackgroundColor = Color.Black; popupStyle2.Title.Text = "PopupStyle2"; popupStyle2.Title.TextColor = Color.Cyan; popupStyle2.Buttons.SizeHeight = 80; popupStyle2.Buttons.BackgroundColor = new Selector <Color> { Pressed = Color.Cyan, Other = Color.Black, }; popupStyle2.Buttons.Text.TextColor = new Selector <Color> { Pressed = Color.Black, Other = Color.White, }; theme1 = new Theme(); theme1.AddStyle("Popup1", popupStyle1); theme1.AddStyle("Popup2", popupStyle2); theme2 = new Theme(); theme2.AddStyle("Popup1", popupStyle2); theme2.AddStyle("Popup2", popupStyle1); ThemeManager.ApplyTheme(theme1); popup0 = new Popup("Popup1"); popup0.AddButton("ChangeTheme"); popup0.AddButton("Close"); popup0.PopupButtonClickEvent += PopupButtonClickedEvent; popup0.Post(NUIApplication.GetDefaultWindow()); popup1 = new Popup("Popup2"); popup1.Position = new Position(0, 210); popup1.AddButton("ChangeTheme"); popup1.AddButton("Close"); popup1.PopupButtonClickEvent += PopupButtonClickedEvent; popup1.Post(NUIApplication.GetDefaultWindow()); }
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)"); }
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); }