1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
10 /// <summary>Efl model interface</summary>
11 [Efl.IModelConcrete.NativeMethods]
12 [Efl.Eo.BindingEntity]
13 public interface IModel :
14 Efl.Eo.IWrapper, IDisposable
16 /// <summary>Get properties from model.
17 /// properties_get is due to provide callers a way the fetch the current properties implemented/used by the model. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> will be raised to notify listeners of any modifications in the properties.
19 /// See also <see cref="Efl.IModel.PropertiesChangedEvt"/>.</summary>
20 /// <returns>Array of current properties</returns>
21 Eina.Iterator<System.String> GetProperties();
22 /// <summary>Retrieve the value of a given property name.
23 /// At this point the caller is free to get values from properties. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> may be raised to notify listeners of the property/value.
25 /// See <see cref="Efl.IModel.GetProperties"/>, <see cref="Efl.IModel.PropertiesChangedEvt"/></summary>
26 /// <param name="property">Property name</param>
27 /// <returns>Property value</returns>
28 Eina.Value GetProperty(System.String property);
29 /// <summary>Set a property value of a given property name.
30 /// The caller must ensure to call at least efl_model_prop_list before being able to see/set properties. This function sets a new property value into given property name. Once the operation is completed the concrete implementation should raise <see cref="Efl.IModel.PropertiesChangedEvt"/> event in order to notify listeners of the new value of the property.
32 /// If the model doesn't have the property then there are two possibilities, either raise an error or create the new property in model
34 /// See <see cref="Efl.IModel.GetProperty"/>, <see cref="Efl.IModel.PropertiesChangedEvt"/></summary>
35 /// <param name="property">Property name</param>
36 /// <param name="value">Property value</param>
37 /// <returns>Return an error in case the property could not be set, the value that was set otherwise.</returns>
38 Eina.Future SetProperty(System.String property, Eina.Value value);
39 /// <summary>Get children count.
40 /// When efl_model_load is completed <see cref="Efl.IModel.GetChildrenCount"/> can be used to get the number of children. <see cref="Efl.IModel.GetChildrenCount"/> can also be used before calling <see cref="Efl.IModel.GetChildrenSlice"/> so a valid range is known. Event <see cref="Efl.IModel.ChildrenCountChangedEvt"/> is emitted when count is finished.
42 /// See also <see cref="Efl.IModel.GetChildrenSlice"/>.</summary>
43 /// <returns>Current known children count</returns>
44 uint GetChildrenCount();
45 /// <summary>Get a future value when it changes to something that is not error:EAGAIN
46 /// <see cref="Efl.IModel.GetProperty"/> can return an error with code EAGAIN when it doesn't have any meaningful value. To make life easier, this future will resolve when the error:EAGAIN disapears. Either into a failed future in case the error code changed to something else or a success with the value of the property whenever the property finally changes.
48 /// The future can also be canceled if the model itself gets destroyed.</summary>
49 /// <param name="property">Property name.</param>
50 /// <returns>Future to be resolved when the property changes to anything other than error:EAGAIN</returns>
51 Eina.Future GetPropertyReady(System.String property);
52 /// <summary>Get children slice OR full range.
53 /// <see cref="Efl.IModel.GetChildrenSlice"/> behaves in two different ways, it may provide the slice if <c>count</c> is non-zero OR full range otherwise.
55 /// Since 'slice' is a range, for example if we have 20 children a slice could be the range from 3(start) with 4(count), see:
57 /// child 0 [no] child 1 [no] child 2 [no] child 3 [yes] child 4 [yes] child 5 [yes] child 6 [yes] child 7 [no]
59 /// Optionally the user can call <see cref="Efl.IModel.GetChildrenCount"/> to know the number of children so a valid range can be known in advance.
61 /// See <see cref="Efl.IModel.GetChildrenCount"/>
63 /// Note: The returned children will live only as long as the future itself. Once the future is done, if you want to keep the object alive, you need to take a reference for yourself.</summary>
64 /// <param name="start">Range begin - start from here.</param>
65 /// <param name="count">Range size. If count is 0, start is ignored.</param>
66 /// <returns>Array of children</returns>
67 Eina.Future GetChildrenSlice(uint start, uint count);
68 /// <summary>Add a new child.
69 /// Add a new child, possibly dummy, depending on the implementation, of a internal keeping. When the child is effectively added the event <see cref="Efl.IModel.ChildAddedEvt"/> is then raised and the new child is kept along with other children.</summary>
70 /// <returns>Child object</returns>
71 Efl.Object AddChild();
72 /// <summary>Remove a child.
73 /// Remove a child of a internal keeping. When the child is effectively removed the event <see cref="Efl.IModel.ChildRemovedEvt"/> is then raised to give a chance for listeners to perform any cleanup and/or update references.</summary>
74 /// <param name="child">Child to be removed</param>
75 void DelChild(Efl.Object child);
76 /// <summary>Async wrapper for <see cref="SetProperty" />.</summary>
77 /// <param name="property">Property name</param>
78 /// <param name="value">Property value</param>
79 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
80 /// <returns>An async task wrapping the result of the operation.</returns>
81 System.Threading.Tasks.Task<Eina.Value> SetPropertyAsync(System.String property,Eina.Value value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken));
83 /// <summary>Async wrapper for <see cref="GetPropertyReady" />.</summary>
84 /// <param name="property">Property name.</param>
85 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
86 /// <returns>An async task wrapping the result of the operation.</returns>
87 System.Threading.Tasks.Task<Eina.Value> GetPropertyReadyAsync(System.String property, System.Threading.CancellationToken token = default(System.Threading.CancellationToken));
89 /// <summary>Async wrapper for <see cref="GetChildrenSlice" />.</summary>
90 /// <param name="start">Range begin - start from here.</param>
91 /// <param name="count">Range size. If count is 0, start is ignored.</param>
92 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
93 /// <returns>An async task wrapping the result of the operation.</returns>
94 System.Threading.Tasks.Task<Eina.Value> GetChildrenSliceAsync(uint start,uint count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken));
96 /// <summary>Event dispatched when properties list is available.</summary>
97 event EventHandler<Efl.IModelPropertiesChangedEvt_Args> PropertiesChangedEvt;
98 /// <summary>Event dispatched when new child is added.</summary>
99 event EventHandler<Efl.IModelChildAddedEvt_Args> ChildAddedEvt;
100 /// <summary>Event dispatched when child is removed.</summary>
101 event EventHandler<Efl.IModelChildRemovedEvt_Args> ChildRemovedEvt;
102 /// <summary>Event dispatched when children count is finished.</summary>
103 event EventHandler ChildrenCountChangedEvt;
104 /// <summary>Get properties from model.
105 /// properties_get is due to provide callers a way the fetch the current properties implemented/used by the model. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> will be raised to notify listeners of any modifications in the properties.
107 /// See also <see cref="Efl.IModel.PropertiesChangedEvt"/>.</summary>
108 /// <value>Array of current properties</value>
109 Eina.Iterator<System.String> Properties {
112 /// <summary>Get children count.
113 /// When efl_model_load is completed <see cref="Efl.IModel.GetChildrenCount"/> can be used to get the number of children. <see cref="Efl.IModel.GetChildrenCount"/> can also be used before calling <see cref="Efl.IModel.GetChildrenSlice"/> so a valid range is known. Event <see cref="Efl.IModel.ChildrenCountChangedEvt"/> is emitted when count is finished.
115 /// See also <see cref="Efl.IModel.GetChildrenSlice"/>.</summary>
116 /// <value>Current known children count</value>
121 ///<summary>Event argument wrapper for event <see cref="Efl.IModel.PropertiesChangedEvt"/>.</summary>
122 [Efl.Eo.BindingEntity]
123 public class IModelPropertiesChangedEvt_Args : EventArgs {
124 ///<summary>Actual event payload.</summary>
125 public Efl.ModelPropertyEvent arg { get; set; }
127 ///<summary>Event argument wrapper for event <see cref="Efl.IModel.ChildAddedEvt"/>.</summary>
128 [Efl.Eo.BindingEntity]
129 public class IModelChildAddedEvt_Args : EventArgs {
130 ///<summary>Actual event payload.</summary>
131 public Efl.ModelChildrenEvent arg { get; set; }
133 ///<summary>Event argument wrapper for event <see cref="Efl.IModel.ChildRemovedEvt"/>.</summary>
134 [Efl.Eo.BindingEntity]
135 public class IModelChildRemovedEvt_Args : EventArgs {
136 ///<summary>Actual event payload.</summary>
137 public Efl.ModelChildrenEvent arg { get; set; }
139 /// <summary>Efl model interface</summary>
140 sealed public class IModelConcrete :
145 ///<summary>Pointer to the native class description.</summary>
146 public override System.IntPtr NativeClass
150 if (((object)this).GetType() == typeof(IModelConcrete))
152 return GetEflClassStatic();
156 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
161 /// <summary>Constructor to be used when objects are expected to be constructed from native code.</summary>
162 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
163 private IModelConcrete(ConstructingHandle ch) : base(ch)
167 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
168 efl_model_interface_get();
169 /// <summary>Initializes a new instance of the <see cref="IModel"/> class.
170 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
171 /// <param name="wh">The native pointer to be wrapped.</param>
172 private IModelConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
176 /// <summary>Event dispatched when properties list is available.</summary>
177 public event EventHandler<Efl.IModelPropertiesChangedEvt_Args> PropertiesChangedEvt
181 lock (eflBindingEventLock)
183 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
185 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
188 Efl.IModelPropertiesChangedEvt_Args args = new Efl.IModelPropertiesChangedEvt_Args();
192 value?.Invoke(obj, args);
196 Eina.Log.Error(e.ToString());
197 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
202 string key = "_EFL_MODEL_EVENT_PROPERTIES_CHANGED";
203 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
209 lock (eflBindingEventLock)
211 string key = "_EFL_MODEL_EVENT_PROPERTIES_CHANGED";
212 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
216 ///<summary>Method to raise event PropertiesChangedEvt.</summary>
217 public void OnPropertiesChangedEvt(Efl.IModelPropertiesChangedEvt_Args e)
219 var key = "_EFL_MODEL_EVENT_PROPERTIES_CHANGED";
220 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
221 if (desc == IntPtr.Zero)
223 Eina.Log.Error($"Failed to get native event {key}");
227 IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));
230 Marshal.StructureToPtr(e.arg, info, false);
231 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
235 Marshal.FreeHGlobal(info);
238 /// <summary>Event dispatched when new child is added.</summary>
239 public event EventHandler<Efl.IModelChildAddedEvt_Args> ChildAddedEvt
243 lock (eflBindingEventLock)
245 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
247 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
250 Efl.IModelChildAddedEvt_Args args = new Efl.IModelChildAddedEvt_Args();
254 value?.Invoke(obj, args);
258 Eina.Log.Error(e.ToString());
259 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
264 string key = "_EFL_MODEL_EVENT_CHILD_ADDED";
265 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
271 lock (eflBindingEventLock)
273 string key = "_EFL_MODEL_EVENT_CHILD_ADDED";
274 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
278 ///<summary>Method to raise event ChildAddedEvt.</summary>
279 public void OnChildAddedEvt(Efl.IModelChildAddedEvt_Args e)
281 var key = "_EFL_MODEL_EVENT_CHILD_ADDED";
282 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
283 if (desc == IntPtr.Zero)
285 Eina.Log.Error($"Failed to get native event {key}");
289 IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));
292 Marshal.StructureToPtr(e.arg, info, false);
293 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
297 Marshal.FreeHGlobal(info);
300 /// <summary>Event dispatched when child is removed.</summary>
301 public event EventHandler<Efl.IModelChildRemovedEvt_Args> ChildRemovedEvt
305 lock (eflBindingEventLock)
307 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
309 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
312 Efl.IModelChildRemovedEvt_Args args = new Efl.IModelChildRemovedEvt_Args();
316 value?.Invoke(obj, args);
320 Eina.Log.Error(e.ToString());
321 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
326 string key = "_EFL_MODEL_EVENT_CHILD_REMOVED";
327 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
333 lock (eflBindingEventLock)
335 string key = "_EFL_MODEL_EVENT_CHILD_REMOVED";
336 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
340 ///<summary>Method to raise event ChildRemovedEvt.</summary>
341 public void OnChildRemovedEvt(Efl.IModelChildRemovedEvt_Args e)
343 var key = "_EFL_MODEL_EVENT_CHILD_REMOVED";
344 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
345 if (desc == IntPtr.Zero)
347 Eina.Log.Error($"Failed to get native event {key}");
351 IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));
354 Marshal.StructureToPtr(e.arg, info, false);
355 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
359 Marshal.FreeHGlobal(info);
362 /// <summary>Event dispatched when children count is finished.</summary>
363 public event EventHandler ChildrenCountChangedEvt
367 lock (eflBindingEventLock)
369 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
371 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
374 EventArgs args = EventArgs.Empty;
377 value?.Invoke(obj, args);
381 Eina.Log.Error(e.ToString());
382 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
387 string key = "_EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED";
388 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
394 lock (eflBindingEventLock)
396 string key = "_EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED";
397 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
401 ///<summary>Method to raise event ChildrenCountChangedEvt.</summary>
402 public void OnChildrenCountChangedEvt(EventArgs e)
404 var key = "_EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED";
405 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
406 if (desc == IntPtr.Zero)
408 Eina.Log.Error($"Failed to get native event {key}");
412 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
414 /// <summary>Get properties from model.
415 /// properties_get is due to provide callers a way the fetch the current properties implemented/used by the model. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> will be raised to notify listeners of any modifications in the properties.
417 /// See also <see cref="Efl.IModel.PropertiesChangedEvt"/>.</summary>
418 /// <returns>Array of current properties</returns>
419 public Eina.Iterator<System.String> GetProperties() {
420 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_properties_get_ptr.Value.Delegate(this.NativeHandle);
421 Eina.Error.RaiseIfUnhandledException();
422 return new Eina.Iterator<System.String>(_ret_var, true);
424 /// <summary>Retrieve the value of a given property name.
425 /// At this point the caller is free to get values from properties. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> may be raised to notify listeners of the property/value.
427 /// See <see cref="Efl.IModel.GetProperties"/>, <see cref="Efl.IModel.PropertiesChangedEvt"/></summary>
428 /// <param name="property">Property name</param>
429 /// <returns>Property value</returns>
430 public Eina.Value GetProperty(System.String property) {
431 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_property_get_ptr.Value.Delegate(this.NativeHandle,property);
432 Eina.Error.RaiseIfUnhandledException();
435 /// <summary>Set a property value of a given property name.
436 /// The caller must ensure to call at least efl_model_prop_list before being able to see/set properties. This function sets a new property value into given property name. Once the operation is completed the concrete implementation should raise <see cref="Efl.IModel.PropertiesChangedEvt"/> event in order to notify listeners of the new value of the property.
438 /// If the model doesn't have the property then there are two possibilities, either raise an error or create the new property in model
440 /// See <see cref="Efl.IModel.GetProperty"/>, <see cref="Efl.IModel.PropertiesChangedEvt"/></summary>
441 /// <param name="property">Property name</param>
442 /// <param name="value">Property value</param>
443 /// <returns>Return an error in case the property could not be set, the value that was set otherwise.</returns>
444 public Eina.Future SetProperty(System.String property, Eina.Value value) {
445 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_property_set_ptr.Value.Delegate(this.NativeHandle,property, value);
446 Eina.Error.RaiseIfUnhandledException();
449 /// <summary>Get children count.
450 /// When efl_model_load is completed <see cref="Efl.IModel.GetChildrenCount"/> can be used to get the number of children. <see cref="Efl.IModel.GetChildrenCount"/> can also be used before calling <see cref="Efl.IModel.GetChildrenSlice"/> so a valid range is known. Event <see cref="Efl.IModel.ChildrenCountChangedEvt"/> is emitted when count is finished.
452 /// See also <see cref="Efl.IModel.GetChildrenSlice"/>.</summary>
453 /// <returns>Current known children count</returns>
454 public uint GetChildrenCount() {
455 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_children_count_get_ptr.Value.Delegate(this.NativeHandle);
456 Eina.Error.RaiseIfUnhandledException();
459 /// <summary>Get a future value when it changes to something that is not error:EAGAIN
460 /// <see cref="Efl.IModel.GetProperty"/> can return an error with code EAGAIN when it doesn't have any meaningful value. To make life easier, this future will resolve when the error:EAGAIN disapears. Either into a failed future in case the error code changed to something else or a success with the value of the property whenever the property finally changes.
462 /// The future can also be canceled if the model itself gets destroyed.</summary>
463 /// <param name="property">Property name.</param>
464 /// <returns>Future to be resolved when the property changes to anything other than error:EAGAIN</returns>
465 public Eina.Future GetPropertyReady(System.String property) {
466 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_property_ready_get_ptr.Value.Delegate(this.NativeHandle,property);
467 Eina.Error.RaiseIfUnhandledException();
470 /// <summary>Get children slice OR full range.
471 /// <see cref="Efl.IModel.GetChildrenSlice"/> behaves in two different ways, it may provide the slice if <c>count</c> is non-zero OR full range otherwise.
473 /// Since 'slice' is a range, for example if we have 20 children a slice could be the range from 3(start) with 4(count), see:
475 /// child 0 [no] child 1 [no] child 2 [no] child 3 [yes] child 4 [yes] child 5 [yes] child 6 [yes] child 7 [no]
477 /// Optionally the user can call <see cref="Efl.IModel.GetChildrenCount"/> to know the number of children so a valid range can be known in advance.
479 /// See <see cref="Efl.IModel.GetChildrenCount"/>
481 /// Note: The returned children will live only as long as the future itself. Once the future is done, if you want to keep the object alive, you need to take a reference for yourself.</summary>
482 /// <param name="start">Range begin - start from here.</param>
483 /// <param name="count">Range size. If count is 0, start is ignored.</param>
484 /// <returns>Array of children</returns>
485 public Eina.Future GetChildrenSlice(uint start, uint count) {
486 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_children_slice_get_ptr.Value.Delegate(this.NativeHandle,start, count);
487 Eina.Error.RaiseIfUnhandledException();
490 /// <summary>Add a new child.
491 /// Add a new child, possibly dummy, depending on the implementation, of a internal keeping. When the child is effectively added the event <see cref="Efl.IModel.ChildAddedEvt"/> is then raised and the new child is kept along with other children.</summary>
492 /// <returns>Child object</returns>
493 public Efl.Object AddChild() {
494 var _ret_var = Efl.IModelConcrete.NativeMethods.efl_model_child_add_ptr.Value.Delegate(this.NativeHandle);
495 Eina.Error.RaiseIfUnhandledException();
498 /// <summary>Remove a child.
499 /// Remove a child of a internal keeping. When the child is effectively removed the event <see cref="Efl.IModel.ChildRemovedEvt"/> is then raised to give a chance for listeners to perform any cleanup and/or update references.</summary>
500 /// <param name="child">Child to be removed</param>
501 public void DelChild(Efl.Object child) {
502 Efl.IModelConcrete.NativeMethods.efl_model_child_del_ptr.Value.Delegate(this.NativeHandle,child);
503 Eina.Error.RaiseIfUnhandledException();
505 /// <summary>Async wrapper for <see cref="SetProperty" />.</summary>
506 /// <param name="property">Property name</param>
507 /// <param name="value">Property value</param>
508 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
509 /// <returns>An async task wrapping the result of the operation.</returns>
510 public System.Threading.Tasks.Task<Eina.Value> SetPropertyAsync(System.String property,Eina.Value value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
512 Eina.Future future = SetProperty( property, value);
513 return Efl.Eo.Globals.WrapAsync(future, token);
516 /// <summary>Async wrapper for <see cref="GetPropertyReady" />.</summary>
517 /// <param name="property">Property name.</param>
518 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
519 /// <returns>An async task wrapping the result of the operation.</returns>
520 public System.Threading.Tasks.Task<Eina.Value> GetPropertyReadyAsync(System.String property, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
522 Eina.Future future = GetPropertyReady( property);
523 return Efl.Eo.Globals.WrapAsync(future, token);
526 /// <summary>Async wrapper for <see cref="GetChildrenSlice" />.</summary>
527 /// <param name="start">Range begin - start from here.</param>
528 /// <param name="count">Range size. If count is 0, start is ignored.</param>
529 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
530 /// <returns>An async task wrapping the result of the operation.</returns>
531 public System.Threading.Tasks.Task<Eina.Value> GetChildrenSliceAsync(uint start,uint count, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
533 Eina.Future future = GetChildrenSlice( start, count);
534 return Efl.Eo.Globals.WrapAsync(future, token);
537 /// <summary>Get properties from model.
538 /// properties_get is due to provide callers a way the fetch the current properties implemented/used by the model. The event <see cref="Efl.IModel.PropertiesChangedEvt"/> will be raised to notify listeners of any modifications in the properties.
540 /// See also <see cref="Efl.IModel.PropertiesChangedEvt"/>.</summary>
541 /// <value>Array of current properties</value>
542 public Eina.Iterator<System.String> Properties {
543 get { return GetProperties(); }
545 /// <summary>Get children count.
546 /// When efl_model_load is completed <see cref="Efl.IModel.GetChildrenCount"/> can be used to get the number of children. <see cref="Efl.IModel.GetChildrenCount"/> can also be used before calling <see cref="Efl.IModel.GetChildrenSlice"/> so a valid range is known. Event <see cref="Efl.IModel.ChildrenCountChangedEvt"/> is emitted when count is finished.
548 /// See also <see cref="Efl.IModel.GetChildrenSlice"/>.</summary>
549 /// <value>Current known children count</value>
550 public uint ChildrenCount {
551 get { return GetChildrenCount(); }
553 private static IntPtr GetEflClassStatic()
555 return Efl.IModelConcrete.efl_model_interface_get();
557 /// <summary>Wrapper for native methods and virtual method delegates.
558 /// For internal use by generated code only.</summary>
559 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
561 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
562 /// <summary>Gets the list of Eo operations to override.</summary>
563 /// <returns>The list of Eo operations to be overload.</returns>
564 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
566 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
567 var methods = Efl.Eo.Globals.GetUserMethods(type);
569 if (efl_model_properties_get_static_delegate == null)
571 efl_model_properties_get_static_delegate = new efl_model_properties_get_delegate(properties_get);
574 if (methods.FirstOrDefault(m => m.Name == "GetProperties") != null)
576 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_properties_get"), func = Marshal.GetFunctionPointerForDelegate(efl_model_properties_get_static_delegate) });
579 if (efl_model_property_get_static_delegate == null)
581 efl_model_property_get_static_delegate = new efl_model_property_get_delegate(property_get);
584 if (methods.FirstOrDefault(m => m.Name == "GetProperty") != null)
586 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_property_get"), func = Marshal.GetFunctionPointerForDelegate(efl_model_property_get_static_delegate) });
589 if (efl_model_property_set_static_delegate == null)
591 efl_model_property_set_static_delegate = new efl_model_property_set_delegate(property_set);
594 if (methods.FirstOrDefault(m => m.Name == "SetProperty") != null)
596 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_property_set"), func = Marshal.GetFunctionPointerForDelegate(efl_model_property_set_static_delegate) });
599 if (efl_model_children_count_get_static_delegate == null)
601 efl_model_children_count_get_static_delegate = new efl_model_children_count_get_delegate(children_count_get);
604 if (methods.FirstOrDefault(m => m.Name == "GetChildrenCount") != null)
606 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_children_count_get"), func = Marshal.GetFunctionPointerForDelegate(efl_model_children_count_get_static_delegate) });
609 if (efl_model_property_ready_get_static_delegate == null)
611 efl_model_property_ready_get_static_delegate = new efl_model_property_ready_get_delegate(property_ready_get);
614 if (methods.FirstOrDefault(m => m.Name == "GetPropertyReady") != null)
616 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_property_ready_get"), func = Marshal.GetFunctionPointerForDelegate(efl_model_property_ready_get_static_delegate) });
619 if (efl_model_children_slice_get_static_delegate == null)
621 efl_model_children_slice_get_static_delegate = new efl_model_children_slice_get_delegate(children_slice_get);
624 if (methods.FirstOrDefault(m => m.Name == "GetChildrenSlice") != null)
626 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_children_slice_get"), func = Marshal.GetFunctionPointerForDelegate(efl_model_children_slice_get_static_delegate) });
629 if (efl_model_child_add_static_delegate == null)
631 efl_model_child_add_static_delegate = new efl_model_child_add_delegate(child_add);
634 if (methods.FirstOrDefault(m => m.Name == "AddChild") != null)
636 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_child_add"), func = Marshal.GetFunctionPointerForDelegate(efl_model_child_add_static_delegate) });
639 if (efl_model_child_del_static_delegate == null)
641 efl_model_child_del_static_delegate = new efl_model_child_del_delegate(child_del);
644 if (methods.FirstOrDefault(m => m.Name == "DelChild") != null)
646 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_model_child_del"), func = Marshal.GetFunctionPointerForDelegate(efl_model_child_del_static_delegate) });
651 /// <summary>Returns the Eo class for the native methods of this class.</summary>
652 /// <returns>The native class pointer.</returns>
653 public override IntPtr GetEflClass()
655 return Efl.IModelConcrete.efl_model_interface_get();
658 #pragma warning disable CA1707, CS1591, SA1300, SA1600
661 private delegate System.IntPtr efl_model_properties_get_delegate(System.IntPtr obj, System.IntPtr pd);
664 public delegate System.IntPtr efl_model_properties_get_api_delegate(System.IntPtr obj);
666 public static Efl.Eo.FunctionWrapper<efl_model_properties_get_api_delegate> efl_model_properties_get_ptr = new Efl.Eo.FunctionWrapper<efl_model_properties_get_api_delegate>(Module, "efl_model_properties_get");
668 private static System.IntPtr properties_get(System.IntPtr obj, System.IntPtr pd)
670 Eina.Log.Debug("function efl_model_properties_get was called");
671 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
674 Eina.Iterator<System.String> _ret_var = default(Eina.Iterator<System.String>);
677 _ret_var = ((IModel)ws.Target).GetProperties();
681 Eina.Log.Warning($"Callback error: {e.ToString()}");
682 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
685 _ret_var.Own = false; return _ret_var.Handle;
690 return efl_model_properties_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
694 private static efl_model_properties_get_delegate efl_model_properties_get_static_delegate;
696 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]
697 private delegate Eina.Value efl_model_property_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property);
699 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]
700 public delegate Eina.Value efl_model_property_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property);
702 public static Efl.Eo.FunctionWrapper<efl_model_property_get_api_delegate> efl_model_property_get_ptr = new Efl.Eo.FunctionWrapper<efl_model_property_get_api_delegate>(Module, "efl_model_property_get");
704 private static Eina.Value property_get(System.IntPtr obj, System.IntPtr pd, System.String property)
706 Eina.Log.Debug("function efl_model_property_get was called");
707 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
710 Eina.Value _ret_var = default(Eina.Value);
713 _ret_var = ((IModel)ws.Target).GetProperty(property);
717 Eina.Log.Warning($"Callback error: {e.ToString()}");
718 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
726 return efl_model_property_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), property);
730 private static efl_model_property_get_delegate efl_model_property_get_static_delegate;
732 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
733 private delegate Eina.Future efl_model_property_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))] Eina.Value value);
735 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
736 public delegate Eina.Future efl_model_property_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))] Eina.Value value);
738 public static Efl.Eo.FunctionWrapper<efl_model_property_set_api_delegate> efl_model_property_set_ptr = new Efl.Eo.FunctionWrapper<efl_model_property_set_api_delegate>(Module, "efl_model_property_set");
740 private static Eina.Future property_set(System.IntPtr obj, System.IntPtr pd, System.String property, Eina.Value value)
742 Eina.Log.Debug("function efl_model_property_set was called");
743 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
746 Eina.Future _ret_var = default( Eina.Future);
749 _ret_var = ((IModel)ws.Target).SetProperty(property, value);
753 Eina.Log.Warning($"Callback error: {e.ToString()}");
754 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
762 return efl_model_property_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), property, value);
766 private static efl_model_property_set_delegate efl_model_property_set_static_delegate;
769 private delegate uint efl_model_children_count_get_delegate(System.IntPtr obj, System.IntPtr pd);
772 public delegate uint efl_model_children_count_get_api_delegate(System.IntPtr obj);
774 public static Efl.Eo.FunctionWrapper<efl_model_children_count_get_api_delegate> efl_model_children_count_get_ptr = new Efl.Eo.FunctionWrapper<efl_model_children_count_get_api_delegate>(Module, "efl_model_children_count_get");
776 private static uint children_count_get(System.IntPtr obj, System.IntPtr pd)
778 Eina.Log.Debug("function efl_model_children_count_get was called");
779 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
782 uint _ret_var = default(uint);
785 _ret_var = ((IModel)ws.Target).GetChildrenCount();
789 Eina.Log.Warning($"Callback error: {e.ToString()}");
790 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
798 return efl_model_children_count_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
802 private static efl_model_children_count_get_delegate efl_model_children_count_get_static_delegate;
804 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
805 private delegate Eina.Future efl_model_property_ready_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property);
807 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
808 public delegate Eina.Future efl_model_property_ready_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String property);
810 public static Efl.Eo.FunctionWrapper<efl_model_property_ready_get_api_delegate> efl_model_property_ready_get_ptr = new Efl.Eo.FunctionWrapper<efl_model_property_ready_get_api_delegate>(Module, "efl_model_property_ready_get");
812 private static Eina.Future property_ready_get(System.IntPtr obj, System.IntPtr pd, System.String property)
814 Eina.Log.Debug("function efl_model_property_ready_get was called");
815 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
818 Eina.Future _ret_var = default( Eina.Future);
821 _ret_var = ((IModel)ws.Target).GetPropertyReady(property);
825 Eina.Log.Warning($"Callback error: {e.ToString()}");
826 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
834 return efl_model_property_ready_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), property);
838 private static efl_model_property_ready_get_delegate efl_model_property_ready_get_static_delegate;
840 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
841 private delegate Eina.Future efl_model_children_slice_get_delegate(System.IntPtr obj, System.IntPtr pd, uint start, uint count);
843 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
844 public delegate Eina.Future efl_model_children_slice_get_api_delegate(System.IntPtr obj, uint start, uint count);
846 public static Efl.Eo.FunctionWrapper<efl_model_children_slice_get_api_delegate> efl_model_children_slice_get_ptr = new Efl.Eo.FunctionWrapper<efl_model_children_slice_get_api_delegate>(Module, "efl_model_children_slice_get");
848 private static Eina.Future children_slice_get(System.IntPtr obj, System.IntPtr pd, uint start, uint count)
850 Eina.Log.Debug("function efl_model_children_slice_get was called");
851 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
854 Eina.Future _ret_var = default( Eina.Future);
857 _ret_var = ((IModel)ws.Target).GetChildrenSlice(start, count);
861 Eina.Log.Warning($"Callback error: {e.ToString()}");
862 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
870 return efl_model_children_slice_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), start, count);
874 private static efl_model_children_slice_get_delegate efl_model_children_slice_get_static_delegate;
876 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
877 private delegate Efl.Object efl_model_child_add_delegate(System.IntPtr obj, System.IntPtr pd);
879 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
880 public delegate Efl.Object efl_model_child_add_api_delegate(System.IntPtr obj);
882 public static Efl.Eo.FunctionWrapper<efl_model_child_add_api_delegate> efl_model_child_add_ptr = new Efl.Eo.FunctionWrapper<efl_model_child_add_api_delegate>(Module, "efl_model_child_add");
884 private static Efl.Object child_add(System.IntPtr obj, System.IntPtr pd)
886 Eina.Log.Debug("function efl_model_child_add was called");
887 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
890 Efl.Object _ret_var = default(Efl.Object);
893 _ret_var = ((IModel)ws.Target).AddChild();
897 Eina.Log.Warning($"Callback error: {e.ToString()}");
898 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
906 return efl_model_child_add_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
910 private static efl_model_child_add_delegate efl_model_child_add_static_delegate;
913 private delegate void efl_model_child_del_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object child);
916 public delegate void efl_model_child_del_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object child);
918 public static Efl.Eo.FunctionWrapper<efl_model_child_del_api_delegate> efl_model_child_del_ptr = new Efl.Eo.FunctionWrapper<efl_model_child_del_api_delegate>(Module, "efl_model_child_del");
920 private static void child_del(System.IntPtr obj, System.IntPtr pd, Efl.Object child)
922 Eina.Log.Debug("function efl_model_child_del was called");
923 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
929 ((IModel)ws.Target).DelChild(child);
933 Eina.Log.Warning($"Callback error: {e.ToString()}");
934 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
941 efl_model_child_del_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), child);
945 private static efl_model_child_del_delegate efl_model_child_del_static_delegate;
947 #pragma warning restore CA1707, CS1591, SA1300, SA1600
955 /// <summary>EFL model property event data structure</summary>
956 [StructLayout(LayoutKind.Sequential)]
957 [Efl.Eo.BindingEntity]
958 public struct ModelPropertyEvent
960 /// <summary>List of changed properties</summary>
961 public Eina.Array<Eina.Stringshare> Changed_properties;
962 /// <summary>Removed properties identified by name</summary>
963 public Eina.Array<Eina.Stringshare> Invalidated_properties;
964 ///<summary>Constructor for ModelPropertyEvent.</summary>
965 public ModelPropertyEvent(
966 Eina.Array<Eina.Stringshare> Changed_properties = default(Eina.Array<Eina.Stringshare>),
967 Eina.Array<Eina.Stringshare> Invalidated_properties = default(Eina.Array<Eina.Stringshare>) )
969 this.Changed_properties = Changed_properties;
970 this.Invalidated_properties = Invalidated_properties;
973 ///<summary>Implicit conversion to the managed representation from a native pointer.</summary>
974 ///<param name="ptr">Native pointer to be converted.</param>
975 public static implicit operator ModelPropertyEvent(IntPtr ptr)
977 var tmp = (ModelPropertyEvent.NativeStruct)Marshal.PtrToStructure(ptr, typeof(ModelPropertyEvent.NativeStruct));
981 #pragma warning disable CS1591
983 ///<summary>Internal wrapper for struct ModelPropertyEvent.</summary>
984 [StructLayout(LayoutKind.Sequential)]
985 public struct NativeStruct
988 public System.IntPtr Changed_properties;
990 public System.IntPtr Invalidated_properties;
991 ///<summary>Implicit conversion to the internal/marshalling representation.</summary>
992 public static implicit operator ModelPropertyEvent.NativeStruct(ModelPropertyEvent _external_struct)
994 var _internal_struct = new ModelPropertyEvent.NativeStruct();
995 _internal_struct.Changed_properties = _external_struct.Changed_properties.Handle;
996 _internal_struct.Invalidated_properties = _external_struct.Invalidated_properties.Handle;
997 return _internal_struct;
1000 ///<summary>Implicit conversion to the managed representation.</summary>
1001 public static implicit operator ModelPropertyEvent(ModelPropertyEvent.NativeStruct _internal_struct)
1003 var _external_struct = new ModelPropertyEvent();
1004 _external_struct.Changed_properties = new Eina.Array<Eina.Stringshare>(_internal_struct.Changed_properties, false, false);
1005 _external_struct.Invalidated_properties = new Eina.Array<Eina.Stringshare>(_internal_struct.Invalidated_properties, false, false);
1006 return _external_struct;
1011 #pragma warning restore CS1591
1019 /// <summary>Every time a child is added the event <see cref="Efl.IModel.ChildAddedEvt"/> is dispatched passing along this structure.</summary>
1020 [StructLayout(LayoutKind.Sequential)]
1021 [Efl.Eo.BindingEntity]
1022 public struct ModelChildrenEvent
1024 /// <summary>index is a hint and is intended to provide a way for applications to control/know children relative positions through listings.</summary>
1026 /// <summary>If an object has been built for this index and it is currently tracked by the parent, it will be available here.</summary>
1027 public Efl.Object Child;
1028 ///<summary>Constructor for ModelChildrenEvent.</summary>
1029 public ModelChildrenEvent(
1030 uint Index = default(uint),
1031 Efl.Object Child = default(Efl.Object) )
1037 ///<summary>Implicit conversion to the managed representation from a native pointer.</summary>
1038 ///<param name="ptr">Native pointer to be converted.</param>
1039 public static implicit operator ModelChildrenEvent(IntPtr ptr)
1041 var tmp = (ModelChildrenEvent.NativeStruct)Marshal.PtrToStructure(ptr, typeof(ModelChildrenEvent.NativeStruct));
1045 #pragma warning disable CS1591
1047 ///<summary>Internal wrapper for struct ModelChildrenEvent.</summary>
1048 [StructLayout(LayoutKind.Sequential)]
1049 public struct NativeStruct
1053 ///<summary>Internal wrapper for field Child</summary>
1054 public System.IntPtr Child;
1055 ///<summary>Implicit conversion to the internal/marshalling representation.</summary>
1056 public static implicit operator ModelChildrenEvent.NativeStruct(ModelChildrenEvent _external_struct)
1058 var _internal_struct = new ModelChildrenEvent.NativeStruct();
1059 _internal_struct.Index = _external_struct.Index;
1060 _internal_struct.Child = _external_struct.Child?.NativeHandle ?? System.IntPtr.Zero;
1061 return _internal_struct;
1064 ///<summary>Implicit conversion to the managed representation.</summary>
1065 public static implicit operator ModelChildrenEvent(ModelChildrenEvent.NativeStruct _internal_struct)
1067 var _external_struct = new ModelChildrenEvent();
1068 _external_struct.Index = _internal_struct.Index;
1070 _external_struct.Child = (Efl.Object) Efl.Eo.Globals.CreateWrapperFor(_internal_struct.Child);
1071 return _external_struct;
1076 #pragma warning restore CS1591