X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2FTizen.NUI.Samples%2FTizen.NUI.Samples%2FSamples%2FDropDownSample.cs;h=c4b97cb78e324feaae11501134b9beb35aae95b5;hb=d726a01260f25e1b69cbf7eed3347601bfb084c3;hp=84bfa56528bc085a0ddd9fbf23ff8538bf07bc70;hpb=4ca3856ec53889c9352a363d4a3d894809d29c6c;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DropDownSample.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DropDownSample.cs index 84bfa56..c4b97cb 100755 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DropDownSample.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DropDownSample.cs @@ -7,6 +7,8 @@ namespace Tizen.NUI.Samples public class DropDownSample : IExample { private View root; + private View parent1; + private View parent2; private TextLabel[] createText = new TextLabel[2]; @@ -33,46 +35,71 @@ namespace Tizen.NUI.Samples { Window window = NUIApplication.GetDefaultWindow(); + //Create root view with linear layout. root = new View() { - Size2D = new Size2D(1920, 1080), - BackgroundColor = Color.White, + Size = new Size(1920, 1080), + BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f), + Layout = new LinearLayout() + { + LinearOrientation = LinearLayout.Orientation.Horizontal, + CellPadding = new Size(50, 50), + LinearAlignment = LinearLayout.Alignment.Center, + } }; window.Add(root); ///////////////////////////////////////////////Create by Property////////////////////////////////////////////////////////// + parent1 = new View() + { + Size = new Size(900, 800), + Layout = new LinearLayout() + { + LinearOrientation = LinearLayout.Orientation.Vertical, + CellPadding = new Size(50, 50), + LinearAlignment = LinearLayout.Alignment.Top, + } + }; + + root.Add(parent1); + // Create a description text. createText[0] = new TextLabel(); createText[0].Text = "Create DropDown just by properties"; - createText[0].Size2D = new Size2D(450, 100); - createText[0].Position2D = new Position2D(200, 100); + createText[0].Size = new Size(800, 100); createText[0].MultiLine = true; - root.Add(createText[0]); + parent1.Add(createText[0]); + //Create a dropdown by property. #region CreateByProperty dropDown = new DropDown(); - dropDown.Size2D = new Size2D(900, 108); - dropDown.Position2D = new Position2D(50, 300); - dropDown.Style.HeaderText.Text = "TitleArea"; - dropDown.Style.HeaderText.TextColor = new Color(0, 0, 0, 1); - dropDown.Style.HeaderText.PointSize = 28; - dropDown.Style.HeaderText.FontFamily = "SamsungOneUI 500C"; - dropDown.Style.Button.Text.Text = "DropDown Text"; - dropDown.Style.Button.Text.TextColor = new Color(0, 0, 0, 1); - dropDown.Style.Button.Text.PointSize = 20; - dropDown.Style.Button.Text.FontFamily = "SamsungOneUI 500"; - dropDown.Style.Button.Icon.ResourceUrl = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png"; - dropDown.Style.Button.Icon.Size = new Size(48, 48); - dropDown.Style.Button.IconRelativeOrientation = Button.IconOrientation.Right; - dropDown.Style.Button.PositionX = 56; + var style = dropDown.Style; + style.Button.BackgroundImage = ""; + style.Button.Icon.ResourceUrl = CommonResource.GetFHResourcePath() + "6. List/list_ic_dropdown.png"; + style.Button.Text.PointSize = 20; + style.Button.Text.FontFamily = "SamsungOneUI 500"; + style.Button.Text.TextColor = new Color(0, 0, 0, 1); + dropDown.ApplyStyle(style); + dropDown.Size = new Size(900, 108); + dropDown.HeaderText.Text = "TitleArea"; + dropDown.HeaderText.TextColor = new Color(0, 0, 0, 1); + dropDown.HeaderText.PointSize = 28; + dropDown.HeaderText.FontFamily = "SamsungOneUI 500C"; + dropDown.HeaderText.PositionX = 50; + dropDown.Button.ButtonText.Text = "DropDown Text"; + dropDown.Button.ButtonIcon.Size = new Size(48, 48); + dropDown.Button.IconRelativeOrientation = Button.IconOrientation.Right; + dropDown.Button.ParentOrigin = ParentOrigin.CenterLeft; + dropDown.Button.PivotPoint = PivotPoint.CenterLeft; + dropDown.Button.PositionX = 56; dropDown.SpaceBetweenButtonTextAndIcon = 8; - dropDown.Style.ListBackgroundImage.ResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png"; - dropDown.Style.ListBackgroundImage.Border = new Rectangle(51, 51, 51, 51); - dropDown.Style.ListBackgroundImage.Size = new Size(360, 500); + dropDown.ListBackgroundImage.ResourceUrl = CommonResource.GetFHResourcePath() + "10. Drop Down/dropdown_bg.png"; + dropDown.ListBackgroundImage.Border = new Rectangle(51, 51, 51, 51); + dropDown.ListBackgroundImage.Size = new Size(360, 500); dropDown.ListMargin.Start = 20; dropDown.ListMargin.Top = 20; dropDown.ListPadding = new Extents(4, 4, 4, 4); - root.Add(dropDown); - + dropDown.BackgroundColor = new Color(1, 1, 1, 1); + parent1.Add(dropDown); for (int i = 0; i < 8; i++) { DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(); @@ -93,46 +120,42 @@ namespace Tizen.NUI.Samples } dropDown.SelectedItemIndex = 3; - //dropDown.DeleteItem(1); - //DropDown.DropDownItemData insertItem = new DropDown.DropDownItemData(); - //insertItem.Size2D = new Size2D(360, 96); - //insertItem.BackgroundColorSelector = new Selector - //{ - // Pressed = new Color(0, 0, 0, 0.4f), - // Other = new Color(1, 1, 1, 0), - //}; - //insertItem.Text = "Insert Normal list "; - //insertItem.PointSize = 18; - //insertItem.FontFamily = "SamsungOne 500"; - //insertItem.TextPosition2D = new Position2D(28, 0); - //insertItem.CheckImageSize = new Size2D(40, 40); - //insertItem.CheckImageResourceUrl = CommonReosurce.GetFHResourcePath() + "10. Drop Down/dropdown_checkbox_on.png"; - //insertItem.CheckImageRightSpace = 16; - //dropDown.InsertItem(insertItem, 1); ////////Attach scrollbar/////////// scrollBar = new ScrollBar(); scrollBar.Direction = ScrollBar.DirectionType.Vertical; - scrollBar.Position2D = new Position2D(394, 2); - scrollBar.Size2D = new Size2D(4, 446); - scrollBar.Style.Track.BackgroundColor = Color.Green; - scrollBar.Style.Thumb.Size = new Size(4, 30); - scrollBar.Style.Thumb.BackgroundColor = Color.Yellow; - scrollBar.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png"; + scrollBar.Size = new Size(4, 446); + scrollBar.TrackColor = Color.Green; + scrollBar.ThumbSize = new Size(4, 30); + scrollBar.ThumbColor = Color.Yellow; + scrollBar.TrackImageURL = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png"; dropDown.AttachScrollBar(scrollBar); #endregion ///////////////////////////////////////////////Create by Attributes////////////////////////////////////////////////////////// + parent2 = new View() + { + Size = new Size(900, 800), + Layout = new LinearLayout() + { + LinearOrientation = LinearLayout.Orientation.Vertical, + CellPadding = new Size(50, 50), + LinearAlignment = LinearLayout.Alignment.Top, + } + }; + root.Add(parent2); + + // Create a description text. createText[1] = new TextLabel(); createText[1].Text = "Create DropDown just by Attributes"; - createText[1].Size2D = new Size2D(450, 100); - createText[1].Position2D = new Position2D(1000, 100); + createText[1].Size = new Size(800, 100); createText[1].MultiLine = true; - root.Add(createText[1]); + parent2.Add(createText[1]); - #region CreateByAttributes + //Create a dropdown by style. + #region CreateByStyle - DropDownStyle attrs = new DropDownStyle + DropDownStyle dropDownStyle = new DropDownStyle { HeaderText = new TextLabelStyle { @@ -140,6 +163,7 @@ namespace Tizen.NUI.Samples PointSize = new Selector { All = 28 }, TextColor = new Selector { All = new Color(0, 0, 0, 1) }, FontFamily = "SamsungOneUI 500C", + PositionX = 50, }, Button = new ButtonStyle @@ -158,6 +182,7 @@ namespace Tizen.NUI.Samples }, IconRelativeOrientation = Button.IconOrientation.Right, PositionX = 56, + BackgroundImage = "", }, ListBackgroundImage = new ImageViewStyle { @@ -171,12 +196,11 @@ namespace Tizen.NUI.Samples ListPadding = new Extents(4, 4, 4, 4), }; - dropDown2 = new DropDown(attrs); - dropDown2.Size2D = new Size2D(900, 108); - dropDown2.Position2D = new Position2D(1000, 300); - root.Add(dropDown2); + dropDown2 = new DropDown(dropDownStyle); + dropDown2.Size = new Size(900, 108); + parent2.Add(dropDown2); - DropDownItemStyle itemAttrs = new DropDownItemStyle + DropDownItemStyle itemStyle = new DropDownItemStyle { BackgroundColor = new Selector { @@ -199,7 +223,7 @@ namespace Tizen.NUI.Samples for (int i = 0; i < 8; i++) { - DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(itemAttrs); + DropDown.DropDownDataItem item = new DropDown.DropDownDataItem(itemStyle); item.Size = new Size(360, 96); item.Text = "Normal list " + i; dropDown2.AddItem(item); @@ -209,15 +233,17 @@ namespace Tizen.NUI.Samples ////////Attach scrollbar/////////// scrollBar2 = new ScrollBar(); scrollBar2.Direction = ScrollBar.DirectionType.Vertical; - scrollBar2.Position2D = new Position2D(394, 2); - scrollBar2.Size2D = new Size2D(4, 446); - scrollBar2.Style.Track.BackgroundColor = Color.Green; - scrollBar2.Style.Thumb.Size = new Size(4, 30); - scrollBar2.Style.Thumb.BackgroundColor = Color.Yellow; - scrollBar2.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png"; + scrollBar2.Size = new Size(4, 446); + scrollBar2.TrackColor = Color.Green; + scrollBar2.ThumbSize = new Size(4, 30); + scrollBar2.ThumbColor = Color.Yellow; + scrollBar2.TrackImageURL = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png"; dropDown2.AttachScrollBar(scrollBar2); #endregion + //Add all views into root view. + root.Add(parent1); + root.Add(parent2); } public void Deactivate() @@ -233,7 +259,7 @@ namespace Tizen.NUI.Samples scrollBar = null; } - root.Remove(dropDown); + parent1.Remove(dropDown); dropDown.Dispose(); dropDown = null; } @@ -246,24 +272,31 @@ namespace Tizen.NUI.Samples scrollBar2 = null; } - root.Remove(dropDown2); + parent2.Remove(dropDown2); dropDown2.Dispose(); dropDown2 = null; } if (createText[0] != null) { - root.Remove(createText[0]); + parent1.Remove(createText[0]); createText[0].Dispose(); createText[0] = null; } if (createText[1] != null) { - root.Remove(createText[1]); + parent2.Remove(createText[1]); createText[1].Dispose(); createText[1] = null; } + root.Remove(parent1); + parent1.Dispose(); + parent1 = null; + root.Remove(parent2); + parent2.Dispose(); + parent2 = null; + NUIApplication.GetDefaultWindow().Remove(root); root.Dispose(); root = null;