[EflSharp] Update Circle and efl cs files (#995)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_ui_selectable.eo.cs
1 #define EFL_BETA
2 #pragma warning disable CS1591
3 using System;
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
6 using System.Linq;
7 using System.Threading;
8 using System.ComponentModel;
9 namespace Efl {
10
11 namespace Ui {
12
13 /// <summary>Selectable interface for ui objects
14 /// A object implementing this can be selected. When the selected property of this object changes, the selected,changed event is emitted.</summary>
15 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
16 [Efl.Ui.ISelectableConcrete.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public interface ISelectable : 
19     Efl.Eo.IWrapper, IDisposable
20 {
21     /// <summary>The selected state of this object
22 /// A change to this property emits the changed event.</summary>
23 /// <returns>The selected state of this object</returns>
24 bool GetSelected();
25     /// <summary>The selected state of this object
26 /// A change to this property emits the changed event.</summary>
27 /// <param name="selected">The selected state of this object</param>
28 void SetSelected(bool selected);
29             /// <summary>Called when the selected state has changed</summary>
30     /// <value><see cref="Efl.Ui.ISelectableSelectedChangedEvt_Args"/></value>
31     event EventHandler<Efl.Ui.ISelectableSelectedChangedEvt_Args> SelectedChangedEvt;
32     /// <summary>The selected state of this object
33     /// A change to this property emits the changed event.</summary>
34     /// <value>The selected state of this object</value>
35     bool Selected {
36         get;
37         set;
38     }
39 }
40 /// <summary>Event argument wrapper for event <see cref="Efl.Ui.ISelectable.SelectedChangedEvt"/>.</summary>
41 [Efl.Eo.BindingEntity]
42 public class ISelectableSelectedChangedEvt_Args : EventArgs {
43     /// <summary>Actual event payload.</summary>
44     /// <value>Called when the selected state has changed</value>
45     public bool arg { get; set; }
46 }
47 /// <summary>Selectable interface for ui objects
48 /// A object implementing this can be selected. When the selected property of this object changes, the selected,changed event is emitted.</summary>
49 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
50 sealed public  class ISelectableConcrete :
51     Efl.Eo.EoWrapper
52     , ISelectable
53     
54 {
55     /// <summary>Pointer to the native class description.</summary>
56     public override System.IntPtr NativeClass
57     {
58         get
59         {
60             if (((object)this).GetType() == typeof(ISelectableConcrete))
61             {
62                 return GetEflClassStatic();
63             }
64             else
65             {
66                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
67             }
68         }
69     }
70
71     /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
72     /// Do not call this constructor directly.</summary>
73     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
74     private ISelectableConcrete(ConstructingHandle ch) : base(ch)
75     {
76     }
77
78     [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
79         efl_ui_selectable_interface_get();
80     /// <summary>Initializes a new instance of the <see cref="ISelectable"/> class.
81     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
82     /// <param name="wh">The native pointer to be wrapped.</param>
83     private ISelectableConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
84     {
85     }
86
87     /// <summary>Called when the selected state has changed</summary>
88     /// <value><see cref="Efl.Ui.ISelectableSelectedChangedEvt_Args"/></value>
89     public event EventHandler<Efl.Ui.ISelectableSelectedChangedEvt_Args> SelectedChangedEvt
90     {
91         add
92         {
93             lock (eflBindingEventLock)
94             {
95                 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
96                 {
97                     var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
98                     if (obj != null)
99                     {
100                         Efl.Ui.ISelectableSelectedChangedEvt_Args args = new Efl.Ui.ISelectableSelectedChangedEvt_Args();
101                         args.arg = Marshal.ReadByte(evt.Info) != 0;
102                         try
103                         {
104                             value?.Invoke(obj, args);
105                         }
106                         catch (Exception e)
107                         {
108                             Eina.Log.Error(e.ToString());
109                             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
110                         }
111                     }
112                 };
113
114                 string key = "_EFL_UI_EVENT_SELECTED_CHANGED";
115                 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
116             }
117         }
118
119         remove
120         {
121             lock (eflBindingEventLock)
122             {
123                 string key = "_EFL_UI_EVENT_SELECTED_CHANGED";
124                 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
125             }
126         }
127     }
128     /// <summary>Method to raise event SelectedChangedEvt.</summary>
129     public void OnSelectedChangedEvt(Efl.Ui.ISelectableSelectedChangedEvt_Args e)
130     {
131         var key = "_EFL_UI_EVENT_SELECTED_CHANGED";
132         IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
133         if (desc == IntPtr.Zero)
134         {
135             Eina.Log.Error($"Failed to get native event {key}");
136             return;
137         }
138
139         IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(e.arg ? (byte) 1 : (byte) 0);
140         try
141         {
142             Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
143         }
144         finally
145         {
146             Marshal.FreeHGlobal(info);
147         }
148     }
149     /// <summary>The selected state of this object
150     /// A change to this property emits the changed event.</summary>
151     /// <returns>The selected state of this object</returns>
152     public bool GetSelected() {
153          var _ret_var = Efl.Ui.ISelectableConcrete.NativeMethods.efl_ui_selectable_selected_get_ptr.Value.Delegate(this.NativeHandle);
154         Eina.Error.RaiseIfUnhandledException();
155         return _ret_var;
156  }
157     /// <summary>The selected state of this object
158     /// A change to this property emits the changed event.</summary>
159     /// <param name="selected">The selected state of this object</param>
160     public void SetSelected(bool selected) {
161                                  Efl.Ui.ISelectableConcrete.NativeMethods.efl_ui_selectable_selected_set_ptr.Value.Delegate(this.NativeHandle,selected);
162         Eina.Error.RaiseIfUnhandledException();
163                          }
164     /// <summary>The selected state of this object
165     /// A change to this property emits the changed event.</summary>
166     /// <value>The selected state of this object</value>
167     public bool Selected {
168         get { return GetSelected(); }
169         set { SetSelected(value); }
170     }
171     private static IntPtr GetEflClassStatic()
172     {
173         return Efl.Ui.ISelectableConcrete.efl_ui_selectable_interface_get();
174     }
175     /// <summary>Wrapper for native methods and virtual method delegates.
176     /// For internal use by generated code only.</summary>
177     public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
178     {
179         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Elementary);
180         /// <summary>Gets the list of Eo operations to override.</summary>
181         /// <returns>The list of Eo operations to be overload.</returns>
182         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
183         {
184             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
185             var methods = Efl.Eo.Globals.GetUserMethods(type);
186
187             if (efl_ui_selectable_selected_get_static_delegate == null)
188             {
189                 efl_ui_selectable_selected_get_static_delegate = new efl_ui_selectable_selected_get_delegate(selected_get);
190             }
191
192             if (methods.FirstOrDefault(m => m.Name == "GetSelected") != null)
193             {
194                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selectable_selected_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selectable_selected_get_static_delegate) });
195             }
196
197             if (efl_ui_selectable_selected_set_static_delegate == null)
198             {
199                 efl_ui_selectable_selected_set_static_delegate = new efl_ui_selectable_selected_set_delegate(selected_set);
200             }
201
202             if (methods.FirstOrDefault(m => m.Name == "SetSelected") != null)
203             {
204                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selectable_selected_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selectable_selected_set_static_delegate) });
205             }
206
207             return descs;
208         }
209         /// <summary>Returns the Eo class for the native methods of this class.</summary>
210         /// <returns>The native class pointer.</returns>
211         public override IntPtr GetEflClass()
212         {
213             return Efl.Ui.ISelectableConcrete.efl_ui_selectable_interface_get();
214         }
215
216         #pragma warning disable CA1707, CS1591, SA1300, SA1600
217
218         [return: MarshalAs(UnmanagedType.U1)]
219         private delegate bool efl_ui_selectable_selected_get_delegate(System.IntPtr obj, System.IntPtr pd);
220
221         [return: MarshalAs(UnmanagedType.U1)]
222         public delegate bool efl_ui_selectable_selected_get_api_delegate(System.IntPtr obj);
223
224         public static Efl.Eo.FunctionWrapper<efl_ui_selectable_selected_get_api_delegate> efl_ui_selectable_selected_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selectable_selected_get_api_delegate>(Module, "efl_ui_selectable_selected_get");
225
226         private static bool selected_get(System.IntPtr obj, System.IntPtr pd)
227         {
228             Eina.Log.Debug("function efl_ui_selectable_selected_get was called");
229             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
230             if (ws != null)
231             {
232             bool _ret_var = default(bool);
233                 try
234                 {
235                     _ret_var = ((ISelectable)ws.Target).GetSelected();
236                 }
237                 catch (Exception e)
238                 {
239                     Eina.Log.Warning($"Callback error: {e.ToString()}");
240                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
241                 }
242
243         return _ret_var;
244
245             }
246             else
247             {
248                 return efl_ui_selectable_selected_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
249             }
250         }
251
252         private static efl_ui_selectable_selected_get_delegate efl_ui_selectable_selected_get_static_delegate;
253
254         
255         private delegate void efl_ui_selectable_selected_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.U1)] bool selected);
256
257         
258         public delegate void efl_ui_selectable_selected_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool selected);
259
260         public static Efl.Eo.FunctionWrapper<efl_ui_selectable_selected_set_api_delegate> efl_ui_selectable_selected_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selectable_selected_set_api_delegate>(Module, "efl_ui_selectable_selected_set");
261
262         private static void selected_set(System.IntPtr obj, System.IntPtr pd, bool selected)
263         {
264             Eina.Log.Debug("function efl_ui_selectable_selected_set was called");
265             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
266             if (ws != null)
267             {
268                                     
269                 try
270                 {
271                     ((ISelectable)ws.Target).SetSelected(selected);
272                 }
273                 catch (Exception e)
274                 {
275                     Eina.Log.Warning($"Callback error: {e.ToString()}");
276                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
277                 }
278
279                         
280             }
281             else
282             {
283                 efl_ui_selectable_selected_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), selected);
284             }
285         }
286
287         private static efl_ui_selectable_selected_set_delegate efl_ui_selectable_selected_set_static_delegate;
288
289         #pragma warning restore CA1707, CS1591, SA1300, SA1600
290
291 }
292 }
293 }
294
295 }
296
297 #if EFL_BETA
298 #pragma warning disable CS1591
299 public static class Efl_UiISelectableConcrete_ExtensionMethods {
300     public static Efl.BindableProperty<bool> Selected<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Ui.ISelectable, T>magic = null) where T : Efl.Ui.ISelectable {
301         return new Efl.BindableProperty<bool>("selected", fac);
302     }
303
304 }
305 #pragma warning restore CS1591
306 #endif