a36e24784680dc6113af63b50ec817ec00e38057
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Widget / WidgetView.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.ComponentModel;
18
19 namespace Tizen.NUI
20 {
21     using System;
22     using System.Runtime.InteropServices;
23     using Tizen.NUI.BaseComponents;
24
25     /// <summary>
26     /// The WidgetView is a class for displaying the widget image and controlling the widget.<br />
27     /// Input events that the WidgetView gets are delivered to the widget.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public class WidgetView : View
31     {
32         private EventHandler<WidgetViewEventArgs> widgetAddedEventHandler;
33         private WidgetAddedEventCallbackType widgetAddedEventCallback;
34         private EventHandler<WidgetViewEventArgs> widgetContentUpdatedEventHandler;
35         private WidgetContentUpdatedEventCallbackType widgetContentUpdatedEventCallback;
36         private EventHandler<WidgetViewEventArgs> widgetDeletedEventHandler;
37         private WidgetDeletedEventCallbackType widgetDeletedEventCallback;
38         private EventHandler<WidgetViewEventArgs> widgetCreationAbortedEventHandler;
39         private WidgetCreationAbortedEventCallbackType widgetCreationAbortedEventCallback;
40         private EventHandler<WidgetViewEventArgs> widgetUpdatePeriodChangedEventHandler;
41         private WidgetUpdatePeriodChangedEventCallbackType widgetUpdatePeriodChangedEventCallback;
42         private EventHandler<WidgetViewEventArgs> widgetFaultedEventHandler;
43         private WidgetFaultedEventCallbackType widgetFaultedEventCallback;
44
45         /// <summary>
46         /// Used in xaml as factory method to create WidgetView.
47         /// </summary>
48         /// <param name="widgetId"></param>
49         /// <param name="contentInfo"></param>
50         /// <param name="width"></param>
51         /// <param name="height"></param>
52         /// <param name="updatePeriod"></param>
53         /// <returns></returns>
54         [EditorBrowsable(EditorBrowsableState.Never)]
55         public static WidgetView CreateWidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod)
56         {
57             return WidgetViewManager.Instance.AddWidget(widgetId, contentInfo, width, height, updatePeriod);
58         }
59
60         /// <summary>
61         /// Creates a new WidgetView.
62         /// </summary>
63         /// <since_tizen> 3 </since_tizen>
64         public WidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod) : this(Interop.WidgetView.New(widgetId, contentInfo, width, height, updatePeriod), true)
65         {
66             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67
68         }
69
70         internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
71         {
72         }
73         internal WidgetView(WidgetView handle) : this(Interop.WidgetView.NewWidgetView(WidgetView.getCPtr(handle)), true)
74         {
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76         }
77
78         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79         private delegate void WidgetAddedEventCallbackType(IntPtr data);
80         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
81         private delegate void WidgetContentUpdatedEventCallbackType(IntPtr data);
82         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83         private delegate void WidgetDeletedEventCallbackType(IntPtr data);
84         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
85         private delegate void WidgetCreationAbortedEventCallbackType(IntPtr data);
86         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
87         private delegate void WidgetUpdatePeriodChangedEventCallbackType(IntPtr data);
88         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
89         private delegate void WidgetFaultedEventCallbackType(IntPtr data);
90
91         /// <summary>
92         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
93         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
94         /// Most resources are only loaded when the control is placed on the stage.<br />
95         /// </summary>
96         /// <since_tizen> 3 </since_tizen>
97         public event EventHandler<WidgetViewEventArgs> WidgetAdded
98         {
99             add
100             {
101                 if (widgetAddedEventHandler == null)
102                 {
103                     widgetAddedEventCallback = OnWidgetAdded;
104                     WidgetViewSignal widgetAdded = WidgetAddedSignal();
105                     widgetAdded?.Connect(widgetAddedEventCallback);
106                     widgetAdded?.Dispose();
107                 }
108
109                 widgetAddedEventHandler += value;
110             }
111
112             remove
113             {
114                 widgetAddedEventHandler -= value;
115
116                 WidgetViewSignal widgetAdded = WidgetAddedSignal();
117                 if (widgetAddedEventHandler == null && widgetAdded?.Empty() == false)
118                 {
119                     widgetAdded?.Disconnect(widgetAddedEventCallback);
120                 }
121                 widgetAdded?.Dispose();
122             }
123         }
124
125         /// <summary>
126         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
127         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
128         /// Most resources are only loaded when the control is placed on the stage.<br />
129         /// </summary>
130         /// <since_tizen> 3 </since_tizen>
131         public event EventHandler<WidgetViewEventArgs> WidgetContentUpdated
132         {
133             add
134             {
135                 if (widgetContentUpdatedEventHandler == null)
136                 {
137                     widgetContentUpdatedEventCallback = OnWidgetContentUpdated;
138                     WidgetViewSignal widgetContentUpdated = WidgetContentUpdatedSignal();
139                     widgetContentUpdated?.Connect(widgetContentUpdatedEventCallback);
140                     widgetContentUpdated?.Dispose();
141                 }
142
143                 widgetContentUpdatedEventHandler += value;
144             }
145
146             remove
147             {
148                 widgetContentUpdatedEventHandler -= value;
149
150                 WidgetViewSignal widgetContentUpdated = WidgetContentUpdatedSignal();
151                 if (widgetContentUpdatedEventHandler == null && widgetContentUpdated?.Empty() == false)
152                 {
153                     widgetContentUpdated?.Disconnect(widgetContentUpdatedEventCallback);
154                 }
155                 widgetContentUpdated?.Dispose();
156             }
157         }
158
159         /// <summary>
160         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
161         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
162         /// Most resources are only loaded when the control is placed on the stage.<br />
163         /// </summary>
164         /// <since_tizen> 3 </since_tizen>
165         public event EventHandler<WidgetViewEventArgs> WidgetDeleted
166         {
167             add
168             {
169                 if (widgetDeletedEventHandler == null)
170                 {
171                     widgetDeletedEventCallback = OnWidgetDeleted;
172                     WidgetViewSignal widgetDeleted = WidgetDeletedSignal();
173                     widgetDeleted?.Connect(widgetDeletedEventCallback);
174                     widgetDeleted?.Dispose();
175                 }
176
177                 widgetDeletedEventHandler += value;
178             }
179
180             remove
181             {
182                 widgetDeletedEventHandler -= value;
183
184                 WidgetViewSignal widgetDeleted = WidgetDeletedSignal();
185                 if (widgetDeletedEventHandler == null && widgetDeleted?.Empty() == false)
186                 {
187                     widgetDeleted?.Disconnect(widgetDeletedEventCallback);
188                 }
189                 widgetDeleted?.Dispose();
190             }
191         }
192
193         /// <summary>
194         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
195         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
196         /// Most resources are only loaded when the control is placed on the stage.<br />
197         /// </summary>
198         /// <since_tizen> 3 </since_tizen>
199         public event EventHandler<WidgetViewEventArgs> WidgetCreationAborted
200         {
201             add
202             {
203                 if (widgetCreationAbortedEventHandler == null)
204                 {
205                     widgetCreationAbortedEventCallback = OnWidgetCreationAborted;
206                     WidgetViewSignal widgetCreationAborted = WidgetCreationAbortedSignal();
207                     widgetCreationAborted?.Connect(widgetCreationAbortedEventCallback);
208                     widgetCreationAborted?.Dispose();
209                 }
210
211                 widgetCreationAbortedEventHandler += value;
212             }
213
214             remove
215             {
216                 widgetCreationAbortedEventHandler -= value;
217
218                 WidgetViewSignal widgetCreationAborted = WidgetCreationAbortedSignal();
219                 if (widgetCreationAbortedEventHandler == null && widgetCreationAborted?.Empty() == false)
220                 {
221                     widgetCreationAborted?.Disconnect(widgetCreationAbortedEventCallback);
222                 }
223                 widgetCreationAborted?.Dispose();
224             }
225         }
226
227         /// <summary>
228         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
229         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
230         /// Most resources are only loaded when the control is placed on the stage.<br />
231         /// </summary>
232         /// <since_tizen> 3 </since_tizen>
233         public event EventHandler<WidgetViewEventArgs> WidgetUpdatePeriodChanged
234         {
235             add
236             {
237                 if (widgetUpdatePeriodChangedEventHandler == null)
238                 {
239                     widgetUpdatePeriodChangedEventCallback = OnWidgetUpdatePeriodChanged;
240                     WidgetViewSignal widgetUpdatePeriodChanged = WidgetUpdatePeriodChangedSignal();
241                     widgetUpdatePeriodChanged?.Connect(widgetUpdatePeriodChangedEventCallback);
242                     widgetUpdatePeriodChanged?.Dispose();
243                 }
244
245                 widgetUpdatePeriodChangedEventHandler += value;
246             }
247
248             remove
249             {
250                 widgetUpdatePeriodChangedEventHandler -= value;
251
252                 WidgetViewSignal widgetUpdatePeriodChanged = WidgetUpdatePeriodChangedSignal();
253                 if (widgetUpdatePeriodChangedEventHandler == null && widgetUpdatePeriodChanged?.Empty() == false)
254                 {
255                     widgetUpdatePeriodChanged?.Disconnect(widgetUpdatePeriodChangedEventCallback);
256                 }
257                 widgetUpdatePeriodChanged?.Dispose();
258             }
259         }
260
261         /// <summary>
262         /// An event for the ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
263         /// This signal is emitted after all resources required by a control are loaded and ready.<br />
264         /// Most resources are only loaded when the control is placed on the stage.<br />
265         /// </summary>
266         /// <since_tizen> 3 </since_tizen>
267         public event EventHandler<WidgetViewEventArgs> WidgetFaulted
268         {
269             add
270             {
271                 if (widgetFaultedEventHandler == null)
272                 {
273                     widgetFaultedEventCallback = OnWidgetFaulted;
274                     WidgetViewSignal widgetFaulted = WidgetFaultedSignal();
275                     widgetFaulted?.Connect(widgetFaultedEventCallback);
276                     widgetFaulted?.Dispose();
277                 }
278
279                 widgetFaultedEventHandler += value;
280             }
281
282             remove
283             {
284                 widgetFaultedEventHandler -= value;
285
286                 WidgetViewSignal widgetFaulted = WidgetFaultedSignal();
287                 if (widgetFaultedEventHandler == null && widgetFaulted?.Empty() == false)
288                 {
289                     widgetFaulted?.Disconnect(widgetFaultedEventCallback);
290                 }
291                 widgetFaulted?.Dispose();
292             }
293         }
294
295         /// <summary>
296         /// Gets the ID of the widget.
297         /// </summary>
298         /// <since_tizen> 3 </since_tizen>
299         public string WidgetID
300         {
301             get
302             {
303                 string retValue = "";
304                 PropertyValue widgetId = GetProperty(WidgetView.Property.WidgetId);
305                 widgetId?.Get(out retValue);
306                 widgetId?.Dispose();
307                 return retValue;
308             }
309         }
310
311         /// <summary>
312         /// Gets the ID of the instance.
313         /// </summary>
314         /// <since_tizen> 3 </since_tizen>
315         public string InstanceID
316         {
317             get
318             {
319                 string retValue = "";
320                 PropertyValue instanceId = GetProperty(WidgetView.Property.InstanceId);
321                 instanceId?.Get(out retValue);
322                 instanceId?.Dispose();
323                 return retValue;
324             }
325         }
326
327         /// <summary>
328         /// Gets the content info.
329         /// </summary>
330         /// <since_tizen> 3 </since_tizen>
331         public string ContentInfo
332         {
333             get
334             {
335                 string retValue = "";
336                 PropertyValue contentInfo = GetProperty(WidgetView.Property.ContentInfo);
337                 contentInfo?.Get(out retValue);
338                 contentInfo?.Dispose();
339                 return retValue;
340             }
341         }
342
343         /// <summary>
344         /// Gets the title.
345         /// </summary>
346         /// <since_tizen> 3 </since_tizen>
347         public string Title
348         {
349             get
350             {
351                 string retValue = "";
352                 PropertyValue title = GetProperty(WidgetView.Property.TITLE);
353                 title?.Get(out retValue);
354                 title?.Dispose();
355                 return retValue;
356             }
357         }
358
359         /// <summary>
360         /// Gets the update period.
361         /// </summary>
362         /// <since_tizen> 3 </since_tizen>
363         public float UpdatePeriod
364         {
365             get
366             {
367                 float retValue = 0;
368                 PropertyValue updatePeriod = GetProperty(WidgetView.Property.UpdatePeriod);
369                 updatePeriod?.Get(out retValue);
370                 updatePeriod?.Dispose();
371                 return retValue;
372             }
373         }
374
375         /// <summary>
376         /// Gets or sets the preview.
377         /// </summary>
378         /// <since_tizen> 3 </since_tizen>
379         public bool Preview
380         {
381             get
382             {
383                 bool retValue = false;
384                 PropertyValue preview = GetProperty(WidgetView.Property.PREVIEW);
385                 preview?.Get(out retValue);
386                 preview?.Dispose();
387                 return retValue;
388             }
389             set
390             {
391                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
392                 SetProperty(WidgetView.Property.PREVIEW, setValue);
393                 setValue?.Dispose();
394             }
395         }
396
397         /// <summary>
398         /// Gets or sets the loading text.
399         /// </summary>
400         /// <since_tizen> 3 </since_tizen>
401         public bool LoadingText
402         {
403             get
404             {
405                 bool retValue = false;
406                 PropertyValue loadingText = GetProperty(WidgetView.Property.LoadingText);
407                 loadingText?.Get(out retValue);
408                 loadingText?.Dispose();
409                 return retValue;
410             }
411             set
412             {
413                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
414                 SetProperty(WidgetView.Property.LoadingText, setValue);
415                 setValue?.Dispose();
416             }
417         }
418
419         /// <summary>
420         /// Gets or sets whether the widget state is faulted or not.
421         /// </summary>
422         /// <since_tizen> 3 </since_tizen>
423         public bool WidgetStateFaulted
424         {
425             get
426             {
427                 bool retValue = false;
428                 PropertyValue widgetStateFaulted = GetProperty(WidgetView.Property.WidgetStateFaulted);
429                 widgetStateFaulted?.Get(out retValue);
430                 widgetStateFaulted?.Dispose();
431                 return retValue;
432             }
433             set
434             {
435                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
436                 SetProperty(WidgetView.Property.WidgetStateFaulted, setValue);
437                 setValue?.Dispose();
438             }
439         }
440
441         /// <summary>
442         /// Gets or sets whether the widget is to delete permanently or not.
443         /// </summary>
444         /// <since_tizen> 3 </since_tizen>
445         public bool PermanentDelete
446         {
447             get
448             {
449                 bool retValue = false;
450                 PropertyValue permanentDelete = GetProperty(WidgetView.Property.PermanentDelete);
451                 permanentDelete?.Get(out retValue);
452                 permanentDelete?.Dispose();
453                 return retValue;
454             }
455             set
456             {
457                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
458                 SetProperty(WidgetView.Property.PermanentDelete, setValue);
459                 setValue.Dispose();
460             }
461         }
462
463         /// <summary>
464         /// Gets or sets retry text.
465         /// </summary>
466         /// <since_tizen> 4 </since_tizen>
467         public PropertyMap RetryText
468         {
469             get
470             {
471                 PropertyMap retValue = new PropertyMap();
472                 PropertyValue retryText = GetProperty(WidgetView.Property.RetryText);
473                 retryText?.Get(retValue);
474                 retryText?.Dispose();
475                 return retValue;
476             }
477             set
478             {
479                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
480                 SetProperty(WidgetView.Property.RetryText, setValue);
481                 setValue?.Dispose();
482             }
483         }
484
485         /// <summary>
486         /// Gets or sets effect.
487         /// </summary>
488         /// <since_tizen> 4 </since_tizen>
489         public PropertyMap Effect
490         {
491             get
492             {
493                 PropertyMap retValue = new PropertyMap();
494                 PropertyValue effect = GetProperty(WidgetView.Property.EFFECT);
495                 effect?.Get(retValue);
496                 effect?.Dispose();
497                 return retValue;
498             }
499             set
500             {
501                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
502                 SetProperty(WidgetView.Property.EFFECT, setValue);
503                 setValue?.Dispose();
504             }
505         }
506
507         /// <summary>
508         /// Pauses a given widget.
509         /// </summary>
510         /// <returns>True on success, false otherwise.</returns>
511         /// <since_tizen> 3 </since_tizen>
512         public bool PauseWidget()
513         {
514             bool ret = Interop.WidgetView.PauseWidget(SwigCPtr);
515             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516             return ret;
517         }
518
519         /// <summary>
520         /// Resumes a given widget.
521         /// </summary>
522         /// <returns>True on success, false otherwise.</returns>
523         /// <since_tizen> 3 </since_tizen>
524         public bool ResumeWidget()
525         {
526             bool ret = Interop.WidgetView.ResumeWidget(SwigCPtr);
527             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528             return ret;
529         }
530
531         /// <summary>
532         /// Cancels the touch event procedure.
533         /// If you call this function after feed the touch down event, the widget will get ON_HOLD events.
534         ///  If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event.
535         /// </summary>
536         /// <returns>True on success, false otherwise.</returns>
537         /// <since_tizen> 3 </since_tizen>
538         public bool CancelTouchEvent()
539         {
540             bool ret = Interop.WidgetView.CancelTouchEvent(SwigCPtr);
541             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542             return ret;
543         }
544
545         /// <summary>
546         /// Activates a widget in the faulted state.
547         /// A widget in faulted state must be activated before adding the widget.
548         /// </summary>
549         /// <since_tizen> 3 </since_tizen>
550         public void ActivateFaultedWidget()
551         {
552             Interop.WidgetView.ActivateFaultedWidget(SwigCPtr);
553             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554         }
555
556         /// <summary>
557         /// Terminate a widget instance.
558         /// </summary>
559         /// <returns>True on success, false otherwise</returns>
560         /// <since_tizen> 4 </since_tizen>
561         public bool TerminateWidget()
562         {
563             bool ret = Interop.WidgetView.TerminateWidget(SwigCPtr);
564             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565             return ret;
566         }
567
568         internal static WidgetView DownCast(BaseHandle handle)
569         {
570             WidgetView ret = new WidgetView(Interop.WidgetView.DownCast(BaseHandle.getCPtr(handle)), true);
571             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572             return ret;
573         }
574
575         internal static WidgetView GetWidgetViewFromPtr(global::System.IntPtr cPtr)
576         {
577             WidgetView ret = new WidgetView(cPtr, false);
578             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579             return ret;
580         }
581
582         internal WidgetView Assign(WidgetView handle)
583         {
584             WidgetView ret = new WidgetView(Interop.WidgetView.Assign(SwigCPtr, WidgetView.getCPtr(handle)), false);
585             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586             return ret;
587         }
588
589         internal WidgetViewSignal WidgetAddedSignal()
590         {
591             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetAddedSignal(SwigCPtr), false);
592             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593             return ret;
594         }
595
596         internal WidgetViewSignal WidgetDeletedSignal()
597         {
598             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetDeletedSignal(SwigCPtr), false);
599             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
600             return ret;
601         }
602
603         internal WidgetViewSignal WidgetCreationAbortedSignal()
604         {
605             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetCreationAbortedSignal(SwigCPtr), false);
606             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607             return ret;
608         }
609
610         internal WidgetViewSignal WidgetContentUpdatedSignal()
611         {
612             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetContentUpdatedSignal(SwigCPtr), false);
613             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
614             return ret;
615         }
616
617         internal WidgetViewSignal WidgetUpdatePeriodChangedSignal()
618         {
619             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetUpdatePeriodChangedSignal(SwigCPtr), false);
620             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621             return ret;
622         }
623
624         internal WidgetViewSignal WidgetFaultedSignal()
625         {
626             WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetFaultedSignal(SwigCPtr), false);
627             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628             return ret;
629         }
630
631         /// <summary>
632         /// To make the Button instance be disposed.
633         /// </summary>
634         /// <since_tizen> 3 </since_tizen>
635         protected override void Dispose(DisposeTypes type)
636         {
637             if (disposed)
638             {
639                 return;
640             }
641
642             //Remove Widget from WidgetViewManager
643             WidgetViewManager.Instance.RemoveWidget(this);
644
645             //Release your own unmanaged resources here.
646             //You should not access any managed member here except static instance.
647             //because the execution order of Finalizes is non-deterministic.
648
649             if (widgetAddedEventCallback != null)
650             {
651                 WidgetViewSignal widgetAdded = this.WidgetAddedSignal();
652                 widgetAdded?.Disconnect(widgetAddedEventCallback);
653                 widgetAdded?.Dispose();
654             }
655
656             if (widgetContentUpdatedEventCallback != null)
657             {
658                 WidgetViewSignal widgetContentUpdated = this.WidgetContentUpdatedSignal();
659                 widgetContentUpdated?.Disconnect(widgetContentUpdatedEventCallback);
660                 widgetContentUpdated?.Dispose();
661             }
662
663             if (widgetCreationAbortedEventCallback != null)
664             {
665                 WidgetViewSignal widgetCreationAborted = this.WidgetCreationAbortedSignal();
666                 widgetCreationAborted?.Disconnect(widgetCreationAbortedEventCallback);
667                 widgetCreationAborted?.Dispose();
668             }
669
670             if (widgetDeletedEventCallback != null)
671             {
672                 WidgetViewSignal widgetDeleted = this.WidgetDeletedSignal();
673                 widgetDeleted?.Disconnect(widgetDeletedEventCallback);
674                 widgetDeleted?.Dispose();
675             }
676
677             if (widgetFaultedEventCallback != null)
678             {
679                 WidgetViewSignal widgetFaulted = this.WidgetFaultedSignal();
680                 widgetFaulted?.Disconnect(widgetFaultedEventCallback);
681                 widgetFaulted?.Dispose();
682             }
683
684             if (widgetUpdatePeriodChangedEventCallback != null)
685             {
686                 WidgetViewSignal widgetUpdatePeriodChanged = this.WidgetUpdatePeriodChangedSignal();
687                 widgetUpdatePeriodChanged?.Disconnect(widgetUpdatePeriodChangedEventCallback);
688                 widgetUpdatePeriodChanged?.Dispose();
689             }
690
691             base.Dispose(type);
692         }
693
694         /// This will not be public opened.
695         [EditorBrowsable(EditorBrowsableState.Never)]
696         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
697         {
698             Interop.WidgetView.DeleteWidgetView(swigCPtr);
699         }
700
701         // Callback for WidgetView WidgetAdded signal
702         private void OnWidgetAdded(IntPtr data)
703         {
704             WidgetViewEventArgs e = new WidgetViewEventArgs();
705             if (data != null)
706             {
707                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
708             }
709
710             if (widgetAddedEventHandler != null)
711             {
712                 widgetAddedEventHandler(this, e);
713             }
714         }
715
716         // Callback for WidgetView WidgetDeleted signal
717         private void OnWidgetDeleted(IntPtr data)
718         {
719             WidgetViewEventArgs e = new WidgetViewEventArgs();
720             if (data != null)
721             {
722                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
723             }
724
725             if (widgetDeletedEventHandler != null)
726             {
727                 widgetDeletedEventHandler(this, e);
728             }
729         }
730
731         // Callback for WidgetView WidgetCreationAborted signal
732         private void OnWidgetCreationAborted(IntPtr data)
733         {
734             WidgetViewEventArgs e = new WidgetViewEventArgs();
735             if (data != null)
736             {
737                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
738             }
739
740             if (widgetCreationAbortedEventHandler != null)
741             {
742                 widgetCreationAbortedEventHandler(this, e);
743             }
744         }
745
746
747
748         // Callback for WidgetView WidgetContentUpdated signal
749         private void OnWidgetContentUpdated(IntPtr data)
750         {
751             WidgetViewEventArgs e = new WidgetViewEventArgs();
752             if (data != null)
753             {
754                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
755             }
756
757             if (widgetContentUpdatedEventHandler != null)
758             {
759                 widgetContentUpdatedEventHandler(this, e);
760             }
761         }
762
763         // Callback for WidgetView WidgetUpdatePeriodChanged signal
764         private void OnWidgetUpdatePeriodChanged(IntPtr data)
765         {
766             WidgetViewEventArgs e = new WidgetViewEventArgs();
767             if (data != null)
768             {
769                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
770             }
771
772             if (widgetUpdatePeriodChangedEventHandler != null)
773             {
774                 widgetUpdatePeriodChangedEventHandler(this, e);
775             }
776         }
777
778         // Callback for WidgetView WidgetFaulted signal
779         private void OnWidgetFaulted(IntPtr data)
780         {
781             WidgetViewEventArgs e = new WidgetViewEventArgs();
782             if (data != null)
783             {
784                 e.WidgetView = WidgetView.GetWidgetViewFromPtr(data);
785             }
786
787             if (widgetFaultedEventHandler != null)
788             {
789                 widgetFaultedEventHandler(this, e);
790             }
791         }
792
793         /// <summary>
794         /// Event arguments of the widget view.
795         /// </summary>
796         /// <since_tizen> 3 </since_tizen>
797         public class WidgetViewEventArgs : EventArgs
798         {
799             private WidgetView _widgetView;
800
801             /// <summary>
802             /// The widget view.
803             /// </summary>
804             /// <since_tizen> 3 </since_tizen>
805             public WidgetView WidgetView
806             {
807                 get
808                 {
809                     return _widgetView;
810                 }
811                 set
812                 {
813                     _widgetView = value;
814                 }
815             }
816         }
817
818         internal new class Property
819         {
820             internal static readonly int WidgetId = Interop.WidgetView.WidgetIdGet();
821             internal static readonly int InstanceId = Interop.WidgetView.InstanceIdGet();
822             internal static readonly int ContentInfo = Interop.WidgetView.ContentInfoGet();
823             internal static readonly int TITLE = Interop.WidgetView.TitleGet();
824             internal static readonly int UpdatePeriod = Interop.WidgetView.UpdatePeriodGet();
825             internal static readonly int PREVIEW = Interop.WidgetView.PreviewGet();
826             internal static readonly int LoadingText = Interop.WidgetView.LoadingTextGet();
827             internal static readonly int WidgetStateFaulted = Interop.WidgetView.WidgetStateFaultedGet();
828             internal static readonly int PermanentDelete = Interop.WidgetView.PermanentDeleteGet();
829             internal static readonly int RetryText = Interop.WidgetView.RetryTextGet();
830             internal static readonly int EFFECT = Interop.WidgetView.EffectGet();
831
832
833             [Obsolete("Please do not use this! Deprecated in API9, will be removed in API11! Please use WidgetId instead!")]
834             internal static readonly int WIDGET_ID = Interop.WidgetView.WidgetIdGet();
835             [Obsolete("Please do not use this! Deprecated in API9, will be removed in API11! Please use ContentInfo instead!")]
836             internal static readonly int CONTENT_INFO = Interop.WidgetView.ContentInfoGet();
837             [Obsolete("Please do not use this! Deprecated in API9, will be removed in API11! Please use UpdatePeriod instead!")]
838             internal static readonly int UPDATE_PERIOD = Interop.WidgetView.UpdatePeriodGet();
839             [Obsolete("Please do not use this! Deprecated in API9, will be removed in API11! Please use LoadingText instead!")]
840             internal static readonly int LOADING_TEXT = Interop.WidgetView.LoadingTextGet();
841         }
842     }
843
844 }