2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
22 namespace Tizen.NUI.CommonUI
25 /// Popup is one kind of common component, it can be used as popup window.
26 /// User can handle Popup button count, head title and content area.
28 /// <since_tizen> 6 </since_tizen>
29 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class Popup : Control
33 private ImageView backgroundImage;
34 private ImageView shadowImage;
35 private TextLabel titleText;
36 private List<Button> buttonList;
37 private List<string> buttonTextList = new List<string>();
39 private PopupAttributes popupAttributes;
40 private int buttonCount = 0;
43 /// Creates a new instance of a Popup.
45 /// <since_tizen> 6 </since_tizen>
46 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
47 [EditorBrowsable(EditorBrowsableState.Never)]
48 public Popup() : base()
53 /// Creates a new instance of a Popup with style.
55 /// <param name="style">Create Popup by special style defined in UX.</param>
56 /// <since_tizen> 6 </since_tizen>
57 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public Popup(string style) : base(style)
64 /// Creates a new instance of a Popup with attributes.
66 /// <param name="attributes">Create Popup by attributes customized by user.</param>
67 /// <since_tizen> 6 </since_tizen>
68 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public Popup(PopupAttributes attributes) : base(attributes)
75 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
77 /// <since_tizen> 6 </since_tizen>
78 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public event EventHandler<ButtonClickEventArgs> PopupButtonClickedEvent;
83 /// Title text string in Popup.
85 /// <since_tizen> 6 </since_tizen>
86 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
87 [EditorBrowsable(EditorBrowsableState.Never)]
88 public string TitleText
92 return popupAttributes?.TitleTextAttributes?.Text?.All;
98 CreateTitleTextAttributes();
99 if (popupAttributes.TitleTextAttributes.Text == null)
101 popupAttributes.TitleTextAttributes.Text = new StringSelector();
103 popupAttributes.TitleTextAttributes.Text.All = value;
111 /// Button count in Popup.
113 /// <since_tizen> 6 </since_tizen>
114 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
115 [EditorBrowsable(EditorBrowsableState.Never)]
116 public int ButtonCount
124 if (buttonCount != value)
133 /// Content view in Popup, only can be gotten.
135 /// <since_tizen> 6 </since_tizen>
136 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public View ContentView
145 /// Shadow image's resource url in Popup.
147 /// <since_tizen> 6 </since_tizen>
148 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
150 public string ShadowImageURL
154 return popupAttributes?.ShadowImageAttributes?.ResourceUrl?.All;
160 CreateShadowAttributes();
161 if (popupAttributes.ShadowImageAttributes.ResourceUrl == null)
163 popupAttributes.ShadowImageAttributes.ResourceUrl = new StringSelector();
165 popupAttributes.ShadowImageAttributes.ResourceUrl.All = value;
172 /// Shadow image's border in Popup.
174 /// <since_tizen> 6 </since_tizen>
175 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public Rectangle ShadowImageBorder
181 return popupAttributes?.ShadowImageAttributes?.Border?.All;
187 CreateShadowAttributes();
188 if (popupAttributes.ShadowImageAttributes.Border == null)
190 popupAttributes.ShadowImageAttributes.Border = new RectangleSelector();
192 popupAttributes.ShadowImageAttributes.Border.All = value;
199 /// Background image's resource url in Popup.
201 /// <since_tizen> 6 </since_tizen>
202 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
203 [EditorBrowsable(EditorBrowsableState.Never)]
204 public string BackgroundImageURL
208 return popupAttributes?.BackgroundImageAttributes?.ResourceUrl?.All;
214 CreateBackgroundAttributes();
215 if (popupAttributes.BackgroundImageAttributes.ResourceUrl == null)
217 popupAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
219 popupAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
226 /// Background image's border in Popup.
228 /// <since_tizen> 6 </since_tizen>
229 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public Rectangle BackgroundImageBorder
235 return popupAttributes?.BackgroundImageAttributes?.Border?.All;
241 CreateBackgroundAttributes();
242 if (popupAttributes.BackgroundImageAttributes.Border == null)
244 popupAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
246 popupAttributes.BackgroundImageAttributes.Border.All = value;
253 /// Title text point size in Popup.
255 /// <since_tizen> 6 </since_tizen>
256 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public float TitlePointSize
262 return popupAttributes?.TitleTextAttributes?.PointSize?.All ?? 0;
266 CreateTitleTextAttributes();
267 if (popupAttributes.TitleTextAttributes.PointSize == null)
269 popupAttributes.TitleTextAttributes.PointSize = new FloatSelector();
271 popupAttributes.TitleTextAttributes.PointSize.All = value;
277 /// Title text font family in Popup.
279 /// <since_tizen> 6 </since_tizen>
280 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public string TitleFontFamily
286 return popupAttributes?.TitleTextAttributes?.FontFamily;
290 CreateTitleTextAttributes();
291 popupAttributes.TitleTextAttributes.FontFamily = value;
297 /// Title text color in Popup.
299 /// <since_tizen> 6 </since_tizen>
300 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public Color TitleTextColor
306 return popupAttributes?.TitleTextAttributes?.TextColor?.All;
310 CreateTitleTextAttributes();
311 if (popupAttributes.TitleTextAttributes.TextColor == null)
313 popupAttributes.TitleTextAttributes.TextColor = new ColorSelector();
315 popupAttributes.TitleTextAttributes.TextColor.All = value;
321 /// Title text horizontal alignment in Popup.
323 /// <since_tizen> 6 </since_tizen>
324 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
325 [EditorBrowsable(EditorBrowsableState.Never)]
326 public HorizontalAlignment TitleTextHorizontalAlignment
330 return popupAttributes?.TitleTextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
334 CreateTitleTextAttributes();
335 popupAttributes.TitleTextAttributes.HorizontalAlignment = value;
341 /// Title text's position in Popup.
343 /// <since_tizen> 6 </since_tizen>
344 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public Position2D TitleTextPosition2D
350 return popupAttributes?.TitleTextAttributes?.Position2D ?? new Position2D(0, 0);
354 CreateTitleTextAttributes();
355 popupAttributes.TitleTextAttributes.Position2D = value;
361 /// Title text's height in Popup.
363 /// <since_tizen> 6 </since_tizen>
364 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public int TitleHeight
370 return popupAttributes?.TitleTextAttributes?.Size2D?.Height ?? 0;
374 CreateTitleTextAttributes();
375 popupAttributes.TitleTextAttributes.Size2D.Height = value;
381 /// Shadow offset in Popup, including left, right, up and bottom offset.
383 /// <since_tizen> 6 </since_tizen>
384 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
385 [EditorBrowsable(EditorBrowsableState.Never)]
386 public Vector4 ShadowOffset
390 return popupAttributes?.ShadowOffset;
396 if (popupAttributes.ShadowOffset == null)
398 popupAttributes.ShadowOffset = new Vector4(0, 0, 0, 0);
400 popupAttributes.ShadowOffset = value;
407 /// Button height in Popup.
409 /// <since_tizen> 6 </since_tizen>
410 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public int ButtonHeight
416 return popupAttributes?.ButtonAttributes?.Size2D?.Height ?? 0;
420 CreateButtonAttributes();
421 popupAttributes.ButtonAttributes.Size2D.Height = value;
427 /// Button text point size in Popup.
429 /// <since_tizen> 6 </since_tizen>
430 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
431 [EditorBrowsable(EditorBrowsableState.Never)]
432 public float ButtonPointSize
436 return popupAttributes?.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0;
440 CreateButtonAttributes();
441 if (popupAttributes.ButtonAttributes.TextAttributes.PointSize == null)
443 popupAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector();
445 popupAttributes.ButtonAttributes.TextAttributes.PointSize.All = value;
451 /// Button text font family in Popup.
453 /// <since_tizen> 6 </since_tizen>
454 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 public string ButtonFontFamily
460 return popupAttributes?.ButtonAttributes?.TextAttributes?.FontFamily;
464 CreateButtonAttributes();
465 popupAttributes.ButtonAttributes.TextAttributes.FontFamily = value;
471 /// Button text color in Popup.
473 /// <since_tizen> 6 </since_tizen>
474 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
475 [EditorBrowsable(EditorBrowsableState.Never)]
476 public Color ButtonTextColor
480 return popupAttributes?.ButtonAttributes?.TextAttributes?.TextColor?.All;
484 CreateButtonAttributes();
485 if (popupAttributes.ButtonAttributes.TextAttributes.TextColor == null)
487 popupAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector();
489 popupAttributes.ButtonAttributes.TextAttributes.TextColor.All = value;
495 /// Button overlay background color selector in Popup.
497 /// <since_tizen> 6 </since_tizen>
498 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
499 [EditorBrowsable(EditorBrowsableState.Never)]
500 public ColorSelector ButtonOverLayBackgroundColorSelector
504 return popupAttributes?.ButtonAttributes?.OverlayImageAttributes?.BackgroundColor;
510 CreateButtonAttributes();
511 popupAttributes.ButtonAttributes.OverlayImageAttributes.BackgroundColor = value.Clone() as ColorSelector;
518 /// Button text horizontal alignment in Popup.
520 /// <since_tizen> 6 </since_tizen>
521 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
522 [EditorBrowsable(EditorBrowsableState.Never)]
523 public HorizontalAlignment ButtonTextAlignment
527 return popupAttributes?.ButtonAttributes?.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
531 CreateButtonAttributes();
532 popupAttributes.ButtonAttributes.TextAttributes.HorizontalAlignment = value;
538 /// Button background image's resource url in Popup.
540 /// <since_tizen> 6 </since_tizen>
541 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
542 [EditorBrowsable(EditorBrowsableState.Never)]
543 public string ButtonBackgroundImageURL
547 return popupAttributes?.ButtonAttributes?.BackgroundImageAttributes?.ResourceUrl?.All;
553 CreateButtonAttributes();
554 if (popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl == null)
556 popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
558 popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
565 /// Button background image's border in Popup.
567 /// <since_tizen> 6 </since_tizen>
568 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public Rectangle ButtonBackgroundImageBorder
574 return popupAttributes?.ButtonAttributes?.BackgroundImageAttributes?.Border?.All;
580 CreateButtonAttributes();
581 if (popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border == null)
583 popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
585 popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border.All = value;
592 /// Set button text by index.
594 /// <param name="index">Button index.</param>
595 /// <param name="text">Button text string.</param>
596 /// <since_tizen> 6 </since_tizen>
597 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 public void SetButtonText(int index, string text)
601 if(index < 0 && index >= buttonCount)
605 if(buttonTextList.Count < index + 1)
607 for (int i = buttonTextList.Count; i < index + 1; i++)
609 buttonTextList.Add("");
612 buttonTextList[index] = text;
617 /// Dispose Popup and all children on it.
619 /// <param name="type">Dispose type.</param>
620 /// <since_tizen> 6 </since_tizen>
621 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
622 [EditorBrowsable(EditorBrowsableState.Never)]
623 protected override void Dispose(DisposeTypes type)
630 if (type == DisposeTypes.Explicit)
632 if (titleText != null)
638 if (backgroundImage != null)
640 Remove(backgroundImage);
641 backgroundImage.Dispose();
642 backgroundImage = null;
644 if (shadowImage != null)
647 shadowImage.Dispose();
650 if (ContentView != null)
653 ContentView.Dispose();
656 if (buttonList != null)
658 foreach(Button btn in buttonList)
670 /// Focus gained callback.
672 /// <since_tizen> 6 </since_tizen>
673 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
674 [EditorBrowsable(EditorBrowsableState.Never)]
675 public override void OnFocusGained()
677 base.OnFocusGained();
680 /// Focus lost callback.
682 /// <since_tizen> 6 </since_tizen>
683 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
684 [EditorBrowsable(EditorBrowsableState.Never)]
685 public override void OnFocusLost()
691 /// Get Popup attribues.
693 /// <since_tizen> 6 </since_tizen>
694 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
695 [EditorBrowsable(EditorBrowsableState.Never)]
696 protected override Attributes GetAttributes()
698 return new PopupAttributes();
702 /// Update Popup by attributes.
704 /// <since_tizen> 6 </since_tizen>
705 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
706 [EditorBrowsable(EditorBrowsableState.Never)]
707 protected override void OnUpdate()
716 if (popupAttributes.ShadowImageAttributes != null)
718 if (shadowImage == null)
720 shadowImage = new ImageView();
723 ApplyAttributes(shadowImage, popupAttributes.ShadowImageAttributes);
726 if (popupAttributes.ShadowOffset != null)
728 w = (int)(Size2D.Width + popupAttributes.ShadowOffset.W + popupAttributes.ShadowOffset.X);
729 h = (int)(Size2D.Height + popupAttributes.ShadowOffset.Y + popupAttributes.ShadowOffset.Z);
732 shadowImage.Size2D = new Size2D(w, h);
735 if (popupAttributes.BackgroundImageAttributes != null)
737 if (backgroundImage == null)
739 backgroundImage = new ImageView()
741 WidthResizePolicy = ResizePolicyType.FillToParent,
742 HeightResizePolicy = ResizePolicyType.FillToParent
744 Add(backgroundImage);
746 ApplyAttributes(backgroundImage, popupAttributes.BackgroundImageAttributes);
749 if (popupAttributes.TitleTextAttributes != null)
751 if (titleText == null)
753 titleText = new TextLabel();
757 ApplyAttributes(titleText, popupAttributes.TitleTextAttributes);
759 if (titleText.Text != null && titleText.Text != "")
761 popupAttributes.TitleTextAttributes.Text = new StringSelector { All = titleText.Text };
762 w = (int)(Size2D.Width - titleText.PositionX * 2);
764 if (popupAttributes.TitleTextAttributes.Size2D != null)
766 titleH = titleText.Size2D.Height;
768 titleText.Size2D = new Size2D(w, titleH);
770 if (popupAttributes.TitleTextAttributes.Position2D != null)
772 titleX = popupAttributes.TitleTextAttributes.Position2D.X;
773 titleY = popupAttributes.TitleTextAttributes.Position2D.Y;
778 titleText.Size2D = new Size2D(0, 0);
783 ContentView.RaiseToTop();
785 UpdateButton(buttonCount);
787 if (buttonList != null && popupAttributes.ButtonAttributes != null && popupAttributes.ButtonAttributes.Size2D != null)
789 buttonH = popupAttributes.ButtonAttributes.Size2D.Height;
791 ContentView.Size2D = new Size2D(Size2D.Width - titleX * 2, Size2D.Height - titleY - titleH - buttonH);
792 ContentView.Position2D = new Position2D(titleX, titleY + titleH);
798 /// Layout child in Popup and it can be override by user.
800 /// <since_tizen> 6 </since_tizen>
801 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
802 [EditorBrowsable(EditorBrowsableState.Never)]
803 protected virtual void LayoutChild()
805 if (popupAttributes == null)
810 if(titleText != null)
812 if(LayoutDirection == ViewLayoutDirectionType.RTL)
814 if (popupAttributes.TitleTextAttributes != null)
816 popupAttributes.TitleTextAttributes.HorizontalAlignment = HorizontalAlignment.End;
818 titleText.HorizontalAlignment = HorizontalAlignment.End;
820 else if(LayoutDirection == ViewLayoutDirectionType.LTR)
822 if (popupAttributes.TitleTextAttributes != null)
824 popupAttributes.TitleTextAttributes.HorizontalAlignment = HorizontalAlignment.Begin;
826 titleText.HorizontalAlignment = HorizontalAlignment.Begin;
830 if(buttonList != null && buttonList.Count > 0)
833 if (LayoutDirection == ViewLayoutDirectionType.RTL)
835 for (int i = buttonList.Count - 1; i >= 0; i--)
837 buttonList[i].PositionX = pos;
838 pos += buttonList[i].Size2D.Width;
843 for (int i = 0; i < buttonList.Count; i++)
845 buttonList[i].PositionX = pos;
846 pos += buttonList[i].Size2D.Width;
853 /// Theme change callback when theme is changed, this callback will be trigger.
855 /// <since_tizen> 6 </since_tizen>
856 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
857 [EditorBrowsable(EditorBrowsableState.Never)]
858 protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
860 PopupAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as PopupAttributes;
861 if (tempAttributes != null)
863 attributes = popupAttributes = tempAttributes;
868 private void Initialize()
870 popupAttributes = attributes as PopupAttributes;
871 if (popupAttributes == null)
873 throw new Exception("Popup attribute parse error.");
876 ApplyAttributes(this, popupAttributes);
877 LeaveRequired = true;
879 ContentView = new View()
881 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
882 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
883 PositionUsesPivotPoint = true
886 ContentView.RaiseToTop();
889 private void CreateShadowAttributes()
891 if (popupAttributes.ShadowImageAttributes == null)
893 popupAttributes.ShadowImageAttributes = new ImageAttributes()
895 PositionUsesPivotPoint = true,
896 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
897 PivotPoint = Tizen.NUI.PivotPoint.Center,
902 private void CreateBackgroundAttributes()
904 if (popupAttributes.BackgroundImageAttributes == null)
906 popupAttributes.BackgroundImageAttributes = new ImageAttributes()
908 PositionUsesPivotPoint = true,
909 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
910 PivotPoint = Tizen.NUI.PivotPoint.Center,
911 WidthResizePolicy = ResizePolicyType.FillToParent,
912 HeightResizePolicy = ResizePolicyType.FillToParent
917 private void CreateTitleTextAttributes()
919 if (popupAttributes.TitleTextAttributes == null)
921 popupAttributes.TitleTextAttributes = new TextAttributes()
923 Size2D = new Size2D(0, 0),
924 PositionUsesPivotPoint = true,
925 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
926 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
927 HorizontalAlignment = HorizontalAlignment.Begin,
928 VerticalAlignment = VerticalAlignment.Bottom
933 private void CreateButtonAttributes()
935 if (popupAttributes.ButtonAttributes == null)
937 popupAttributes.ButtonAttributes = new ButtonAttributes()
939 Size2D = new Size2D(0, 0),
940 PositionUsesPivotPoint = true,
941 ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
942 PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
943 TextAttributes = new TextAttributes
945 PositionUsesPivotPoint = true,
946 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
947 PivotPoint = Tizen.NUI.PivotPoint.Center,
948 HorizontalAlignment = HorizontalAlignment.Center,
949 VerticalAlignment = VerticalAlignment.Center
951 BackgroundImageAttributes = new ImageAttributes
953 PositionUsesPivotPoint = true,
954 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
955 PivotPoint = Tizen.NUI.PivotPoint.Center,
956 WidthResizePolicy = ResizePolicyType.FillToParent,
957 HeightResizePolicy = ResizePolicyType.FillToParent,
958 Border = new RectangleSelector { All = new Rectangle(0, 0, 0, 0) },
960 OverlayImageAttributes = new ImageAttributes
962 PositionUsesPivotPoint = true,
963 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
964 PivotPoint = Tizen.NUI.PivotPoint.Center,
965 WidthResizePolicy = ResizePolicyType.FillToParent,
966 HeightResizePolicy = ResizePolicyType.FillToParent,
967 Border = new RectangleSelector { All = new Rectangle(0, 0, 0, 0) },
973 private void UpdateButton(int count)
975 if(buttonList != null && buttonCount == buttonList.Count)
977 for (int i = 0; i < count; i++)
979 buttonList[i].TextColor = popupAttributes.ButtonAttributes.TextAttributes.TextColor.All;
984 if (buttonList != null)
986 foreach (Button btn in buttonList)
988 btn.ClickEvent -= ButtonClickEvent;
999 int buttonWidth = Size2D.Width / count;
1000 int buttonHeight = popupAttributes.ButtonAttributes.Size2D.Height;
1002 buttonList = new List<Button>();
1003 for (int i = 0; i < count; i++)
1006 popupAttributes.ButtonAttributes.Size2D.Width = buttonWidth;
1007 btn = new Button(popupAttributes.ButtonAttributes);
1008 btn.Position2D = new Position2D(pos, 0);
1010 if (i >= buttonTextList.Count)
1012 buttonTextList.Add("");
1014 btn.Text = buttonTextList[i];
1015 btn.ClickEvent += ButtonClickEvent;
1018 buttonList.Add(btn);
1022 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1024 if (PopupButtonClickedEvent != null && buttonList != null)
1026 Button button = sender as Button;
1027 for (int i = 0; i < buttonList.Count; i++)
1029 if(button == buttonList[i])
1031 ButtonClickEventArgs args = new ButtonClickEventArgs();
1032 args.ButtonIndex = i;
1033 PopupButtonClickedEvent(this, args);
1040 /// ButtonClickEventArgs is a class to record button click event arguments which will sent to user.
1042 /// <since_tizen> 6 </since_tizen>
1043 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1044 [EditorBrowsable(EditorBrowsableState.Never)]
1045 public class ButtonClickEventArgs : EventArgs
1047 /// <summary> Button index which is clicked in Popup </summary>
1048 /// <since_tizen> 6 </since_tizen>
1049 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1050 [EditorBrowsable(EditorBrowsableState.Never)]
1051 public int ButtonIndex;