2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
13 /// <summary>Efl Ui Selection class</summary>
14 /// <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>
15 [Efl.Ui.ISelectionConcrete.NativeMethods]
16 [Efl.Eo.BindingEntity]
17 public interface ISelection :
18 Efl.Eo.IWrapper, IDisposable
20 /// <summary>Set the selection data to the object</summary>
21 /// <param name="type">Selection Type</param>
22 /// <param name="format">Selection Format</param>
23 /// <param name="data">Selection data</param>
24 /// <param name="seat">Specified seat for multiple seats case.</param>
25 /// <returns>Future for tracking when the selection is lost</returns>
26 Eina.Future SetSelection(Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Eina.Slice data, uint seat);
27 /// <summary>Get the data from the object that has selection</summary>
28 /// <param name="type">Selection Type</param>
29 /// <param name="format">Selection Format</param>
30 /// <param name="data_func">Data ready function pointer</param>
31 /// <param name="seat">Specified seat for multiple seats case.</param>
32 void GetSelection(Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Efl.Ui.SelectionDataReady data_func, uint seat);
33 /// <summary>Clear the selection data from the object</summary>
34 /// <param name="type">Selection Type</param>
35 /// <param name="seat">Specified seat for multiple seats case.</param>
36 void ClearSelection(Efl.Ui.SelectionType type, uint seat);
37 /// <summary>Determine whether the selection data has owner</summary>
38 /// <param name="type">Selection type</param>
39 /// <param name="seat">Specified seat for multiple seats case.</param>
40 /// <returns>EINA_TRUE if there is object owns selection, otherwise EINA_FALSE</returns>
41 bool HasOwner(Efl.Ui.SelectionType type, uint seat);
42 /// <summary>Async wrapper for <see cref="SetSelection" />.</summary>
43 /// <param name="type">Selection Type</param>
44 /// <param name="format">Selection Format</param>
45 /// <param name="data">Selection data</param>
46 /// <param name="seat">Specified seat for multiple seats case.</param>
47 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
48 /// <returns>An async task wrapping the result of the operation.</returns>
49 System.Threading.Tasks.Task<Eina.Value> SetSelectionAsync(Efl.Ui.SelectionType type,Efl.Ui.SelectionFormat format,Eina.Slice data,uint seat, System.Threading.CancellationToken token = default(System.Threading.CancellationToken));
51 /// <summary>Called when display server's selection has changed</summary>
52 /// <value><see cref="Efl.Ui.ISelectionWmSelectionChangedEvt_Args"/></value>
53 event EventHandler<Efl.Ui.ISelectionWmSelectionChangedEvt_Args> WmSelectionChangedEvt;
55 /// <summary>Event argument wrapper for event <see cref="Efl.Ui.ISelection.WmSelectionChangedEvt"/>.</summary>
56 [Efl.Eo.BindingEntity]
57 public class ISelectionWmSelectionChangedEvt_Args : EventArgs {
58 /// <summary>Actual event payload.</summary>
59 /// <value>Called when display server's selection has changed</value>
60 public Efl.Ui.SelectionChanged arg { get; set; }
62 /// <summary>Efl Ui Selection class</summary>
63 /// <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>
64 sealed public class ISelectionConcrete :
69 /// <summary>Pointer to the native class description.</summary>
70 public override System.IntPtr NativeClass
74 if (((object)this).GetType() == typeof(ISelectionConcrete))
76 return GetEflClassStatic();
80 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
85 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
86 /// Do not call this constructor directly.</summary>
87 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
88 private ISelectionConcrete(ConstructingHandle ch) : base(ch)
92 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
93 efl_ui_selection_mixin_get();
94 /// <summary>Initializes a new instance of the <see cref="ISelection"/> class.
95 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
96 /// <param name="wh">The native pointer to be wrapped.</param>
97 private ISelectionConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
101 /// <summary>Called when display server's selection has changed</summary>
102 /// <value><see cref="Efl.Ui.ISelectionWmSelectionChangedEvt_Args"/></value>
103 public event EventHandler<Efl.Ui.ISelectionWmSelectionChangedEvt_Args> WmSelectionChangedEvt
107 lock (eflBindingEventLock)
109 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
111 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
114 Efl.Ui.ISelectionWmSelectionChangedEvt_Args args = new Efl.Ui.ISelectionWmSelectionChangedEvt_Args();
118 value?.Invoke(obj, args);
122 Eina.Log.Error(e.ToString());
123 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
128 string key = "_EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED";
129 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
135 lock (eflBindingEventLock)
137 string key = "_EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED";
138 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
142 /// <summary>Method to raise event WmSelectionChangedEvt.</summary>
143 public void OnWmSelectionChangedEvt(Efl.Ui.ISelectionWmSelectionChangedEvt_Args e)
145 var key = "_EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED";
146 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
147 if (desc == IntPtr.Zero)
149 Eina.Log.Error($"Failed to get native event {key}");
153 IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));
156 Marshal.StructureToPtr(e.arg, info, false);
157 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
161 Marshal.FreeHGlobal(info);
164 /// <summary>Set the selection data to the object</summary>
165 /// <param name="type">Selection Type</param>
166 /// <param name="format">Selection Format</param>
167 /// <param name="data">Selection data</param>
168 /// <param name="seat">Specified seat for multiple seats case.</param>
169 /// <returns>Future for tracking when the selection is lost</returns>
170 public Eina.Future SetSelection(Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Eina.Slice data, uint seat) {
171 var _ret_var = Efl.Ui.ISelectionConcrete.NativeMethods.efl_ui_selection_set_ptr.Value.Delegate(this.NativeHandle,type, format, data, seat);
172 Eina.Error.RaiseIfUnhandledException();
175 /// <summary>Get the data from the object that has selection</summary>
176 /// <param name="type">Selection Type</param>
177 /// <param name="format">Selection Format</param>
178 /// <param name="data_func">Data ready function pointer</param>
179 /// <param name="seat">Specified seat for multiple seats case.</param>
180 public void GetSelection(Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Efl.Ui.SelectionDataReady data_func, uint seat) {
181 GCHandle data_func_handle = GCHandle.Alloc(data_func);
182 Efl.Ui.ISelectionConcrete.NativeMethods.efl_ui_selection_get_ptr.Value.Delegate(this.NativeHandle,type, format, GCHandle.ToIntPtr(data_func_handle), Efl.Ui.SelectionDataReadyWrapper.Cb, Efl.Eo.Globals.free_gchandle, seat);
183 Eina.Error.RaiseIfUnhandledException();
185 /// <summary>Clear the selection data from the object</summary>
186 /// <param name="type">Selection Type</param>
187 /// <param name="seat">Specified seat for multiple seats case.</param>
188 public void ClearSelection(Efl.Ui.SelectionType type, uint seat) {
189 Efl.Ui.ISelectionConcrete.NativeMethods.efl_ui_selection_clear_ptr.Value.Delegate(this.NativeHandle,type, seat);
190 Eina.Error.RaiseIfUnhandledException();
192 /// <summary>Determine whether the selection data has owner</summary>
193 /// <param name="type">Selection type</param>
194 /// <param name="seat">Specified seat for multiple seats case.</param>
195 /// <returns>EINA_TRUE if there is object owns selection, otherwise EINA_FALSE</returns>
196 public bool HasOwner(Efl.Ui.SelectionType type, uint seat) {
197 var _ret_var = Efl.Ui.ISelectionConcrete.NativeMethods.efl_ui_selection_has_owner_ptr.Value.Delegate(this.NativeHandle,type, seat);
198 Eina.Error.RaiseIfUnhandledException();
201 /// <summary>Async wrapper for <see cref="SetSelection" />.</summary>
202 /// <param name="type">Selection Type</param>
203 /// <param name="format">Selection Format</param>
204 /// <param name="data">Selection data</param>
205 /// <param name="seat">Specified seat for multiple seats case.</param>
206 /// <param name="token">Token to notify the async operation of external request to cancel.</param>
207 /// <returns>An async task wrapping the result of the operation.</returns>
208 public System.Threading.Tasks.Task<Eina.Value> SetSelectionAsync(Efl.Ui.SelectionType type,Efl.Ui.SelectionFormat format,Eina.Slice data,uint seat, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
210 Eina.Future future = SetSelection( type, format, data, seat);
211 return Efl.Eo.Globals.WrapAsync(future, token);
214 private static IntPtr GetEflClassStatic()
216 return Efl.Ui.ISelectionConcrete.efl_ui_selection_mixin_get();
218 /// <summary>Wrapper for native methods and virtual method delegates.
219 /// For internal use by generated code only.</summary>
220 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
222 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
223 /// <summary>Gets the list of Eo operations to override.</summary>
224 /// <returns>The list of Eo operations to be overload.</returns>
225 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
227 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
228 var methods = Efl.Eo.Globals.GetUserMethods(type);
230 if (efl_ui_selection_set_static_delegate == null)
232 efl_ui_selection_set_static_delegate = new efl_ui_selection_set_delegate(selection_set);
235 if (methods.FirstOrDefault(m => m.Name == "SetSelection") != null)
237 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selection_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selection_set_static_delegate) });
240 if (efl_ui_selection_get_static_delegate == null)
242 efl_ui_selection_get_static_delegate = new efl_ui_selection_get_delegate(selection_get);
245 if (methods.FirstOrDefault(m => m.Name == "GetSelection") != null)
247 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selection_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selection_get_static_delegate) });
250 if (efl_ui_selection_clear_static_delegate == null)
252 efl_ui_selection_clear_static_delegate = new efl_ui_selection_clear_delegate(selection_clear);
255 if (methods.FirstOrDefault(m => m.Name == "ClearSelection") != null)
257 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selection_clear"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selection_clear_static_delegate) });
260 if (efl_ui_selection_has_owner_static_delegate == null)
262 efl_ui_selection_has_owner_static_delegate = new efl_ui_selection_has_owner_delegate(has_owner);
265 if (methods.FirstOrDefault(m => m.Name == "HasOwner") != null)
267 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selection_has_owner"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selection_has_owner_static_delegate) });
272 /// <summary>Returns the Eo class for the native methods of this class.</summary>
273 /// <returns>The native class pointer.</returns>
274 public override IntPtr GetEflClass()
276 return Efl.Ui.ISelectionConcrete.efl_ui_selection_mixin_get();
279 #pragma warning disable CA1707, CS1591, SA1300, SA1600
281 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
282 private delegate Eina.Future efl_ui_selection_set_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Eina.Slice data, uint seat);
284 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
285 public delegate Eina.Future efl_ui_selection_set_api_delegate(System.IntPtr obj, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Eina.Slice data, uint seat);
287 public static Efl.Eo.FunctionWrapper<efl_ui_selection_set_api_delegate> efl_ui_selection_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selection_set_api_delegate>(Module, "efl_ui_selection_set");
289 private static Eina.Future selection_set(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, Eina.Slice data, uint seat)
291 Eina.Log.Debug("function efl_ui_selection_set was called");
292 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
295 Eina.Future _ret_var = default( Eina.Future);
298 _ret_var = ((ISelection)ws.Target).SetSelection(type, format, data, seat);
302 Eina.Log.Warning($"Callback error: {e.ToString()}");
303 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
311 return efl_ui_selection_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), type, format, data, seat);
315 private static efl_ui_selection_set_delegate efl_ui_selection_set_static_delegate;
318 private delegate void efl_ui_selection_get_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, IntPtr data_func_data, Efl.Ui.SelectionDataReadyInternal data_func, EinaFreeCb data_func_free_cb, uint seat);
321 public delegate void efl_ui_selection_get_api_delegate(System.IntPtr obj, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, IntPtr data_func_data, Efl.Ui.SelectionDataReadyInternal data_func, EinaFreeCb data_func_free_cb, uint seat);
323 public static Efl.Eo.FunctionWrapper<efl_ui_selection_get_api_delegate> efl_ui_selection_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selection_get_api_delegate>(Module, "efl_ui_selection_get");
325 private static void selection_get(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, Efl.Ui.SelectionFormat format, IntPtr data_func_data, Efl.Ui.SelectionDataReadyInternal data_func, EinaFreeCb data_func_free_cb, uint seat)
327 Eina.Log.Debug("function efl_ui_selection_get was called");
328 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
331 Efl.Ui.SelectionDataReadyWrapper data_func_wrapper = new Efl.Ui.SelectionDataReadyWrapper(data_func, data_func_data, data_func_free_cb);
335 ((ISelection)ws.Target).GetSelection(type, format, data_func_wrapper.ManagedCb, seat);
339 Eina.Log.Warning($"Callback error: {e.ToString()}");
340 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
347 efl_ui_selection_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), type, format, data_func_data, data_func, data_func_free_cb, seat);
351 private static efl_ui_selection_get_delegate efl_ui_selection_get_static_delegate;
354 private delegate void efl_ui_selection_clear_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, uint seat);
357 public delegate void efl_ui_selection_clear_api_delegate(System.IntPtr obj, Efl.Ui.SelectionType type, uint seat);
359 public static Efl.Eo.FunctionWrapper<efl_ui_selection_clear_api_delegate> efl_ui_selection_clear_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selection_clear_api_delegate>(Module, "efl_ui_selection_clear");
361 private static void selection_clear(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, uint seat)
363 Eina.Log.Debug("function efl_ui_selection_clear was called");
364 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
370 ((ISelection)ws.Target).ClearSelection(type, seat);
374 Eina.Log.Warning($"Callback error: {e.ToString()}");
375 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
382 efl_ui_selection_clear_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), type, seat);
386 private static efl_ui_selection_clear_delegate efl_ui_selection_clear_static_delegate;
388 [return: MarshalAs(UnmanagedType.U1)]
389 private delegate bool efl_ui_selection_has_owner_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, uint seat);
391 [return: MarshalAs(UnmanagedType.U1)]
392 public delegate bool efl_ui_selection_has_owner_api_delegate(System.IntPtr obj, Efl.Ui.SelectionType type, uint seat);
394 public static Efl.Eo.FunctionWrapper<efl_ui_selection_has_owner_api_delegate> efl_ui_selection_has_owner_ptr = new Efl.Eo.FunctionWrapper<efl_ui_selection_has_owner_api_delegate>(Module, "efl_ui_selection_has_owner");
396 private static bool has_owner(System.IntPtr obj, System.IntPtr pd, Efl.Ui.SelectionType type, uint seat)
398 Eina.Log.Debug("function efl_ui_selection_has_owner was called");
399 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
402 bool _ret_var = default(bool);
405 _ret_var = ((ISelection)ws.Target).HasOwner(type, seat);
409 Eina.Log.Warning($"Callback error: {e.ToString()}");
410 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
418 return efl_ui_selection_has_owner_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), type, seat);
422 private static efl_ui_selection_has_owner_delegate efl_ui_selection_has_owner_static_delegate;
424 #pragma warning restore CA1707, CS1591, SA1300, SA1600
433 #pragma warning disable CS1591
434 public static class Efl_UiISelectionConcrete_ExtensionMethods {
436 #pragma warning restore CS1591