[NUI] Fix the SVACE issue.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Popup.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20 using System.ComponentModel;
21
22 namespace Tizen.NUI.Components
23 {
24     /// <summary>
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.
27     /// </summary>
28     /// <since_tizen> 6 </since_tizen>
29     [Obsolete("Deprecated in API8; Will be removed in API10")]
30     public partial class Popup : Control
31     {
32         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33         [EditorBrowsable(EditorBrowsableState.Never)]
34         public static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create(nameof(ButtonHeight), typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
35         {
36             var instance = (Popup)bindable;
37             if (newValue != null)
38             {
39                 instance.btGroup.Itemheight = (int)newValue;
40                 instance.UpdateView();
41             }
42         },
43         defaultValueCreator: (bindable) =>
44         {
45             return (int)((Popup)bindable).btGroup.Itemheight;
46         });
47
48         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
49         [EditorBrowsable(EditorBrowsableState.Never)]
50         public static readonly BindableProperty ButtonTextPointSizeProperty = BindableProperty.Create(nameof(ButtonTextPointSize), typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
51         {
52             var instance = (Popup)bindable;
53             if (newValue != null)
54             {
55                 instance.btGroup.ItemPointSize = (float)newValue;
56             }
57         },
58         defaultValueCreator: (bindable) =>
59         {
60             return ((Popup)bindable).btGroup.ItemPointSize;
61         });
62
63         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public static readonly BindableProperty ButtonFontFamilyProperty = BindableProperty.Create(nameof(ButtonFontFamily), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
66         {
67             var instance = (Popup)bindable;
68             if (newValue != null)
69             {
70                 instance.btGroup.ItemFontFamily = (string)newValue;
71             }
72         },
73         defaultValueCreator: (bindable) =>
74         {
75             return ((Popup)bindable).btGroup.ItemFontFamily;
76         });
77
78         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
79         [EditorBrowsable(EditorBrowsableState.Never)]
80         public static readonly BindableProperty ButtonTextColorProperty = BindableProperty.Create(nameof(ButtonTextColor), typeof(Color), typeof(Popup), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
81         {
82             var instance = (Popup)bindable;
83             if (newValue != null)
84             {
85                 instance.btGroup.ItemTextColor = (Color)newValue;
86             }
87         },
88         defaultValueCreator: (bindable) =>
89         {
90             return ((Popup)bindable).btGroup.ItemTextColor;
91         });
92
93         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
94         [EditorBrowsable(EditorBrowsableState.Never)]
95         public static readonly BindableProperty ButtonOverLayBackgroundColorSelectorProperty = BindableProperty.Create(nameof(ButtonOverLayBackgroundColorSelector), typeof(Selector<Color>), typeof(Popup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
96         {
97             var instance = (Popup)bindable;
98             if (newValue != null)
99             {
100                 instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
101             }
102         },
103         defaultValueCreator: (bindable) =>
104         {
105             return ((Popup)bindable).btGroup.OverLayBackgroundColorSelector;
106         });
107
108         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
109         [EditorBrowsable(EditorBrowsableState.Never)]
110         public static readonly BindableProperty ButtonTextAlignmentProperty = BindableProperty.Create(nameof(ButtonTextAlignment), typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
111         {
112             var instance = (Popup)bindable;
113             if (newValue != null)
114             {
115                 instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
116             }
117         },
118         defaultValueCreator: (bindable) =>
119         {
120             return ((Popup)bindable).btGroup.ItemTextAlignment;
121         });
122
123         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public static readonly BindableProperty ButtonBackgroundProperty = BindableProperty.Create(nameof(ButtonBackground), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
126         {
127             var instance = (Popup)bindable;
128             if (newValue != null)
129             {
130                 instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
131             }
132         },
133         defaultValueCreator: (bindable) =>
134         {
135             return ((Popup)bindable).btGroup.ItemBackgroundImageUrl;
136         });
137
138         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
139         [EditorBrowsable(EditorBrowsableState.Never)]
140         public static readonly BindableProperty ButtonBackgroundBorderProperty = BindableProperty.Create(nameof(ButtonBackgroundBorder), typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
141         {
142             var instance = (Popup)bindable;
143             if (newValue != null)
144             {
145                 instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
146             }
147         },
148         defaultValueCreator: (bindable) =>
149         {
150             return ((Popup)bindable).btGroup.ItemBackgroundBorder;
151         });
152
153         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
154         [EditorBrowsable(EditorBrowsableState.Never)]
155         public static readonly BindableProperty ButtonImageShadowProperty = BindableProperty.Create(nameof(ButtonImageShadow), typeof(ImageShadow), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
156         {
157             var instance = (Popup)bindable;
158             ImageShadow shadow = (ImageShadow)newValue;
159             instance.btGroup.ItemImageShadow = new ImageShadow(shadow);
160         },
161         defaultValueCreator: (bindable) =>
162         {
163             return ((Popup)bindable).btGroup.ItemImageShadow;
164         });
165
166         private TextLabel titleText;
167         private ButtonGroup btGroup = null;
168         private Window window = null;
169         private Layer container = new Layer();
170         private ButtonStyle buttonStyle = new ButtonStyle();
171
172         static Popup() { }
173
174         /// <summary>
175         /// Creates a new instance of a Popup.
176         /// </summary>
177         /// <since_tizen> 6 </since_tizen>
178         [Obsolete("Deprecated in API8; Will be removed in API10")]
179         public Popup() : base()
180         {
181         }
182
183         /// <summary>
184         /// Creates a new instance of a Popup with style.
185         /// </summary>
186         /// <param name="style">Create Popup by special style defined in UX.</param>
187         [EditorBrowsable(EditorBrowsableState.Never)]
188         public Popup(string style) : base(style)
189         {
190         }
191
192         /// <summary>
193         /// Creates a new instance of a Popup with style.
194         /// </summary>
195         /// <param name="popupStyle">Create Popup by style customized by user.</param>
196         [EditorBrowsable(EditorBrowsableState.Never)]
197         public Popup(PopupStyle popupStyle) : base(popupStyle)
198         {
199         }
200
201         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
202         [EditorBrowsable(EditorBrowsableState.Never)]
203         public virtual void Post(Window targetWindow)
204         {
205             if (targetWindow == null)
206             {
207                 return;
208             }
209
210             window = targetWindow;
211             window.AddLayer(container);
212             container.RaiseToTop();
213         }
214
215         /// <summary>
216         /// Dismiss the dialog
217         /// </summary>
218         [EditorBrowsable(EditorBrowsableState.Never)]
219         public virtual void Dismiss()
220         {
221             if (window == null)
222             {
223                 return;
224             }
225
226             window.RemoveLayer(container);
227             window = null;
228         }
229
230         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
231         [EditorBrowsable(EditorBrowsableState.Never)]
232         public void AddButton(string buttonText)
233         {
234             Button btn = new Button(buttonStyle);
235             btn.Text = buttonText;
236             btn.ClickEvent += ButtonClickEvent;
237             btGroup.AddItem(btn);
238             UpdateView();
239         }
240
241         /// <summary>
242         /// Add button by style's name.
243         /// </summary>
244         [EditorBrowsable(EditorBrowsableState.Never)]
245         public void AddButton(string buttonText, string style)
246         {
247             AddButton(buttonText);
248         }
249
250         /// <summary>
251         /// Add button by style.
252         /// </summary>
253         [EditorBrowsable(EditorBrowsableState.Never)]
254         public void AddButton(string buttonText, ButtonStyle style)
255         {
256             Button btn = new Button(style);
257             btn.Text = buttonText;
258             btn.ClickEvent += ButtonClickEvent;
259             btGroup.AddItem(btn);
260             UpdateView();
261         }
262
263         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
264         [EditorBrowsable(EditorBrowsableState.Never)]
265         public Button GetButton(int index)
266         {
267             return btGroup.GetItem(index);
268         }
269
270         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
271         [EditorBrowsable(EditorBrowsableState.Never)]
272         public void RemoveButton(int index)
273         {
274             btGroup.RemoveItem(index);
275         }
276
277         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
278         [EditorBrowsable(EditorBrowsableState.Never)]
279         public void AddContentText(View childView)
280         {
281             if (null != ContentView)
282             {
283                 ContentView.Add(childView);
284             }
285             UpdateView();
286         }
287
288         /// <summary>
289         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
290         /// </summary>
291         /// <since_tizen> 6 </since_tizen>
292         [Obsolete("Deprecated in API8; Will be removed in API10")]
293         public event EventHandler<ButtonClickEventArgs> PopupButtonClickEvent;
294
295         /// <summary>
296         /// Popup Title.
297         /// </summary>
298         [EditorBrowsable(EditorBrowsableState.Never)]
299         public TextLabel Title
300         {
301             get
302             {
303                 if (null == titleText)
304                 {
305                     titleText = new TextLabel
306                     {
307                         PositionUsesPivotPoint = true,
308                         ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
309                         PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
310                         HorizontalAlignment = HorizontalAlignment.Begin,
311                         VerticalAlignment = VerticalAlignment.Bottom,
312                         Text = "Title"
313                     };
314                     Add(titleText);
315                 }
316                 return titleText;
317             }
318             internal set
319             {
320                 titleText = value;
321             }
322         }
323
324         /// <summary>
325         /// Title text string in Popup.
326         /// </summary>
327         /// <since_tizen> 6 </since_tizen>
328         [Obsolete("Deprecated in API8; Will be removed in API10")]
329         public string TitleText
330         {
331             get
332             {
333                 return GetValue(TitleTextProperty) as string;
334             }
335             set
336             {
337                 SetValue(TitleTextProperty, value);
338                 NotifyPropertyChanged();
339             }
340         }
341         private string InternalTitleText
342         {
343             get => Title.Text;
344             set => Title.Text = value;
345         }
346
347         /// <summary>
348         /// Title text point size in Popup.
349         /// </summary>
350         /// <since_tizen> 6 </since_tizen>
351         [Obsolete("Deprecated in API8; Will be removed in API10")]
352         public float TitlePointSize
353         {
354             get
355             {
356                 return (float)GetValue(TitlePointSizeProperty);
357             }
358             set
359             {
360                 SetValue(TitlePointSizeProperty, value);
361                 NotifyPropertyChanged();
362             }
363         }
364         private float InternalTitlePointSize
365         {
366             get => Title.PointSize;
367             set => Title.PointSize = value;
368         }
369
370         /// <summary>
371         /// Title text color in Popup.
372         /// </summary>
373         /// <since_tizen> 6 </since_tizen>
374         [Obsolete("Deprecated in API8; Will be removed in API10")]
375         public Color TitleTextColor
376         {
377             get
378             {
379                 return GetValue(TitleTextColorProperty) as Color;
380             }
381             set
382             {
383                 SetValue(TitleTextColorProperty, value);
384                 NotifyPropertyChanged();
385             }
386         }
387         private Color InternalTitleTextColor
388         {
389             get => Title.TextColor;
390             set => Title.TextColor = value;
391         }
392
393         /// <summary>
394         /// Title text horizontal alignment in Popup.
395         /// </summary>
396         /// <since_tizen> 6 </since_tizen>
397         [Obsolete("Deprecated in API8; Will be removed in API10")]
398         public HorizontalAlignment TitleTextHorizontalAlignment
399         {
400             get
401             {
402                 return (HorizontalAlignment)GetValue(TitleTextHorizontalAlignmentProperty);
403             }
404             set
405             {
406                 SetValue(TitleTextHorizontalAlignmentProperty, value);
407                 NotifyPropertyChanged();
408             }
409         }
410         private HorizontalAlignment InternalTitleTextHorizontalAlignment
411         {
412             get => Title.HorizontalAlignment;
413             set => Title.HorizontalAlignment = value;
414         }
415
416         /// <summary>
417         /// Title text's position in Popup.
418         /// </summary>
419         /// <since_tizen> 6 </since_tizen>
420         [Obsolete("Deprecated in API8; Will be removed in API10")]
421         public Position TitleTextPosition
422         {
423             get
424             {
425                 return GetValue(TitleTextPositionProperty) as Position;
426             }
427             set
428             {
429                 SetValue(TitleTextPositionProperty, value);
430                 NotifyPropertyChanged();
431             }
432         }
433         private Position InternalTitleTextPosition
434         {
435             get => Title.Position;
436             set => Title.Position = value;
437         }
438
439         /// <summary>
440         /// Title text's height in Popup.
441         /// </summary>
442         /// <since_tizen> 6 </since_tizen>
443         [Obsolete("Deprecated in API8; Will be removed in API10")]
444         public int TitleHeight
445         {
446             get
447             {
448                 return (int)GetValue(TitleHeightProperty);
449             }
450             set
451             {
452                 SetValue(TitleHeightProperty, value);
453                 NotifyPropertyChanged();
454             }
455         }
456         private int InternalTitleHeight
457         {
458             get => (int)Title.SizeHeight;
459             set => Title.SizeHeight = (int)value;
460         }
461
462         /// <summary>
463         /// Content view in Popup, only can be gotten.
464         /// </summary>
465         /// <since_tizen> 6 </since_tizen>
466         [Obsolete("Deprecated in API8; Will be removed in API10")]
467         public View ContentView
468         {
469             get;
470             private set;
471         }
472
473         /// <summary>
474         /// Button count in Popup.
475         /// </summary>
476         /// <since_tizen> 6 </since_tizen>
477         [Obsolete("Deprecated in API8; Will be removed in API10")]
478         public int ButtonCount
479         {
480             get
481             {
482                 return (int)GetValue(ButtonCountProperty);
483             }
484             set
485             {
486                 SetValue(ButtonCountProperty, value);
487                 NotifyPropertyChanged();
488             }
489         }
490         private int InternalButtonCount
491         {
492             get;
493             set;
494         }
495
496         /// <summary>
497         /// Button height in Popup.
498         /// </summary>
499         /// <since_tizen> 6 </since_tizen>
500         [Obsolete("Deprecated in API8; Will be removed in API10")]
501         public int ButtonHeight
502         {
503             get
504             {
505                 return (int)GetValue(ButtonHeightProperty);
506             }
507             set
508             {
509                 SetValue(ButtonHeightProperty, value);
510             }
511         }
512
513         /// <summary>
514         /// Button text point size in Popup.
515         /// </summary>
516         /// <since_tizen> 6 </since_tizen>
517         [Obsolete("Deprecated in API8; Will be removed in API10")]
518         public float ButtonTextPointSize
519         {
520             get
521             {
522                 return (float)GetValue(ButtonTextPointSizeProperty);
523             }
524             set
525             {
526                 SetValue(ButtonTextPointSizeProperty, value);
527             }
528         }
529
530         /// <summary>
531         /// Button text font family in Popup.
532         /// </summary>
533         /// <since_tizen> 6 </since_tizen>
534         [Obsolete("Deprecated in API8; Will be removed in API10")]
535         public string ButtonFontFamily
536         {
537             get
538             {
539                 return (string)GetValue(ButtonFontFamilyProperty);
540             }
541             set
542             {
543                 SetValue(ButtonFontFamilyProperty, value);
544             }
545         }
546
547         /// <summary>
548         /// Button text color in Popup.
549         /// </summary>
550         /// <since_tizen> 6 </since_tizen>
551         [Obsolete("Deprecated in API8; Will be removed in API10")]
552         public Color ButtonTextColor
553         {
554             get
555             {
556                 return (Color)GetValue(ButtonTextColorProperty);
557             }
558             set
559             {
560                 SetValue(ButtonTextColorProperty, value);
561             }
562         }
563
564         /// <summary>
565         /// Button overlay background color selector in Popup.
566         /// </summary>
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 Selector<Color> ButtonOverLayBackgroundColorSelector
571         {
572             get
573             {
574                 return (Selector<Color>)GetValue(ButtonOverLayBackgroundColorSelectorProperty);
575             }
576             set
577             {
578                 SetValue(ButtonOverLayBackgroundColorSelectorProperty, value);
579             }
580         }
581
582         /// <summary>
583         /// Button text horizontal alignment in Popup.
584         /// </summary>
585         /// <since_tizen> 6 </since_tizen>
586         [Obsolete("Deprecated in API8; Will be removed in API10")]
587         public HorizontalAlignment ButtonTextAlignment
588         {
589             get
590             {
591                 return (HorizontalAlignment)GetValue(ButtonTextAlignmentProperty);
592             }
593             set
594             {
595                 SetValue(ButtonTextAlignmentProperty, value);
596             }
597         }
598
599         /// <summary>
600         /// Button background image's resource url in Popup.
601         /// </summary>
602         /// <since_tizen> 6 </since_tizen>
603         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
604         [EditorBrowsable(EditorBrowsableState.Never)]
605         public string ButtonBackground
606         {
607             get
608             {
609                 return (string)GetValue(ButtonBackgroundProperty);
610             }
611             set
612             {
613                 SetValue(ButtonBackgroundProperty, value);
614             }
615         }
616
617         /// <summary>
618         /// Button background image's border in Popup.
619         /// </summary>
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         public Rectangle ButtonBackgroundBorder
624         {
625             get
626             {
627
628                 return (Rectangle)GetValue(ButtonBackgroundBorderProperty);
629             }
630             set
631             {
632                 SetValue(ButtonBackgroundBorderProperty, value);
633             }
634         }
635
636         /// <summary>
637         /// Button's image shadow in Popup.
638         /// </summary>
639         /// <since_tizen> 6 </since_tizen>
640         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
641         [EditorBrowsable(EditorBrowsableState.Never)]
642         public ImageShadow ButtonImageShadow
643         {
644             get => (ImageShadow)GetValue(ButtonImageShadowProperty);
645             set => SetValue(ButtonImageShadowProperty, value);
646         }
647
648
649         /// <summary>
650         /// Set button text by index.
651         /// </summary>
652         /// <param name="index">Button index.</param>
653         /// <param name="text">Button text string.</param>
654         /// <since_tizen> 6 </since_tizen>
655         [Obsolete("Deprecated in API8; Will be removed in API10")]
656         public void SetButtonText(int index, string text)
657         {
658             AddButton(text);
659         }
660
661         /// <summary>
662         /// Dispose Popup and all children on it.
663         /// </summary>
664         /// <param name="type">Dispose type.</param>
665         /// <since_tizen> 6 </since_tizen>
666         [Obsolete("Deprecated in API8; Will be removed in API10")]
667 #pragma warning disable CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
668         protected override void Dispose(DisposeTypes type)
669 #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
670         {
671             if (disposed)
672             {
673                 return;
674             }
675
676             if (type == DisposeTypes.Explicit)
677             {
678                 if (titleText != null)
679                 {
680                     Remove(titleText);
681                     titleText.Dispose();
682                     titleText = null;
683                 }
684                 if (ContentView != null)
685                 {
686                     Remove(ContentView);
687                     ContentView.Dispose();
688                     ContentView = null;
689                 }
690
691                 if (btGroup != null)
692                 {
693                     btGroup.Dispose();
694                     btGroup = null;
695                 }
696
697                 buttonStyle?.Dispose();
698             }
699
700             base.Dispose(type);
701         }
702
703         /// <summary>
704         /// Focus gained callback.
705         /// </summary>
706         /// <since_tizen> 6 </since_tizen>
707         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
708         [EditorBrowsable(EditorBrowsableState.Never)]
709         public override void OnFocusGained()
710         {
711             base.OnFocusGained();
712         }
713
714         /// <summary>
715         /// Focus lost callback.
716         /// </summary>
717         /// <since_tizen> 6 </since_tizen>
718         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
719         [EditorBrowsable(EditorBrowsableState.Never)]
720         public override void OnFocusLost()
721         {
722             base.OnFocusLost();
723         }
724
725         /// <summary>
726         /// Apply style to popup.
727         /// </summary>
728         /// <param name="viewStyle">The style to apply.</param>
729         [EditorBrowsable(EditorBrowsableState.Never)]
730         public override void ApplyStyle(ViewStyle viewStyle)
731         {
732             base.ApplyStyle(viewStyle);
733
734             if (viewStyle is PopupStyle ppStyle)
735             {
736                 if (ppStyle.Buttons?.SizeHeight != null)
737                 {
738                     ButtonHeight = (int)ppStyle.Buttons.SizeHeight;
739                 }
740
741                 buttonStyle = (ButtonStyle)ppStyle.Buttons?.Clone();
742                 if (buttonStyle.PositionUsesPivotPoint == null) buttonStyle.PositionUsesPivotPoint = true;
743                 if (buttonStyle.ParentOrigin == null) buttonStyle.ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft;
744                 if (buttonStyle.PivotPoint == null) buttonStyle.PivotPoint = Tizen.NUI.PivotPoint.BottomLeft;
745
746                 if (btGroup != null)
747                 {
748                     for (int i = 0; i < btGroup.Count; i++)
749                     {
750                         var button = GetButton(i);
751                         button.ApplyStyle(buttonStyle);
752                     }
753                 }
754
755                 Title.ApplyStyle(ppStyle.Title);
756                 Title.RaiseToTop();
757             }
758         }
759
760         /// <summary>
761         /// Get Popup style.
762         /// </summary>
763         /// <returns>The default popup style.</returns>
764         [EditorBrowsable(EditorBrowsableState.Never)]
765         protected override ViewStyle CreateViewStyle()
766         {
767             return new PopupStyle();
768         }
769
770         /// <inheritdoc/>
771         [EditorBrowsable(EditorBrowsableState.Never)]
772         protected override void OnUpdate()
773         {
774             base.OnUpdate();
775             UpdateView();
776         }
777
778         /// <summary>
779         /// Initialize AT-SPI object.
780         /// </summary>
781         [EditorBrowsable(EditorBrowsableState.Never)]
782         public override void OnInitialize()
783         {
784             base.OnInitialize();
785             AccessibilityRole = Role.Dialog;
786
787             container.Add(this);
788             container.SetTouchConsumed(true);
789             container.SetHoverConsumed(true);
790
791             LeaveRequired = true;
792             PropertyChanged += PopupStylePropertyChanged;
793
794             // ContentView
795             ContentView = new View()
796             {
797                 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
798                 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
799                 PositionUsesPivotPoint = true
800             };
801             Add(ContentView);
802             ContentView.RaiseToTop();
803
804             // Button
805             btGroup = new ButtonGroup(this);
806         }
807
808         /// <summary>
809         /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object.
810         /// </summary>
811         [EditorBrowsable(EditorBrowsableState.Never)]
812         protected override AccessibilityStates AccessibilityCalculateStates()
813         {
814             var states = base.AccessibilityCalculateStates();
815
816             states[AccessibilityState.Modal] = true;
817
818             return states;
819         }
820
821         private void UpdateView()
822         {
823             btGroup.UpdateButton(buttonStyle);
824             UpdateContentView();
825             UpdateTitle();
826         }
827
828         private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
829         {
830             if (PopupButtonClickEvent != null && btGroup.Count > 0)
831             {
832                 Button button = sender as Button;
833                 for (int i = 0; i < btGroup.Count; i++)
834                 {
835                     if (button == GetButton(i))
836                     {
837                         ButtonClickEventArgs args = new ButtonClickEventArgs();
838                         args.ButtonIndex = i;
839                         PopupButtonClickEvent(this, args);
840                     }
841                 }
842             }
843         }
844
845         private void PopupStylePropertyChanged(object sender, PropertyChangedEventArgs e)
846         {
847             if (e.PropertyName is var propName && propName != null && propName.Equals("LayoutDirection"))
848             {
849                 btGroup.UpdateButton(buttonStyle);
850             }
851         }
852
853         private void UpdateContentView()
854         {
855             int titleX = 0;
856             int titleY = 0;
857             int titleH = 0;
858             int buttonH = 0;
859             string strText = Title.Text;
860             if (!string.IsNullOrEmpty(strText) && Title.Size != null)
861             {
862                 titleH = (int)titleText.Size.Height;
863             }
864
865             if (!string.IsNullOrEmpty(strText) && Title.Position != null)
866             {
867                 titleX = (int)Title.Position.X;
868                 titleY = (int)Title.Position.Y;
869             }
870
871             if (btGroup.Count != 0)
872             {
873                 buttonH = ButtonHeight;
874             }
875             ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
876             ContentView.Position = new Position(titleX, titleY + titleH);
877             ContentView.RaiseToTop();
878         }
879
880         private void UpdateTitle()
881         {
882             if (titleText != null && string.IsNullOrEmpty(Title.Text) && Title.Size != null)
883             {
884                 titleText.RaiseToTop();
885             }
886         }
887         /// <summary>
888         /// ButtonClickEventArgs is a class to record button click event arguments which will sent to user.
889         /// </summary>
890         /// <since_tizen> 6 </since_tizen>
891         [Obsolete("Deprecated in API8; Will be removed in API10")]
892         [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
893         public class ButtonClickEventArgs : EventArgs
894         {
895             /// <summary> Button index which is clicked in Popup </summary>
896             /// <since_tizen> 6 </since_tizen>
897             /// It will be removed in API10
898             [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
899             [Obsolete("Deprecated in API8; Will be removed in API10")]
900             public int ButtonIndex;
901         }
902     }
903 }