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 orientation interface</summary>
11 [Efl.IOrientationConcrete.NativeMethods]
12 public interface IOrientation :
13 Efl.Eo.IWrapper, IDisposable
15 /// <summary>Control the orientation of a given object.
16 /// This can be used to set the rotation on an image or a window, for instance.</summary>
17 /// <returns>The rotation angle (CCW), see <see cref="Efl.Orient"/>.</returns>
18 Efl.Orient GetOrientation();
19 /// <summary>Control the orientation of a given object.
20 /// This can be used to set the rotation on an image or a window, for instance.</summary>
21 /// <param name="dir">The rotation angle (CCW), see <see cref="Efl.Orient"/>.</param>
22 void SetOrientation(Efl.Orient dir);
23 /// <summary>Control the flip of the given image
24 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
25 /// <returns>Flip method</returns>
27 /// <summary>Control the flip of the given image
28 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
29 /// <param name="flip">Flip method</param>
30 void SetFlip(Efl.Flip flip);
31 /// <summary>Control the orientation of a given object.
32 /// This can be used to set the rotation on an image or a window, for instance.</summary>
33 /// <value>The rotation angle (CCW), see <see cref="Efl.Orient"/>.</value>
34 Efl.Orient Orientation {
38 /// <summary>Control the flip of the given image
39 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
40 /// <value>Flip method</value>
46 /// <summary>Efl orientation interface</summary>
47 sealed public class IOrientationConcrete :
52 ///<summary>Pointer to the native class description.</summary>
53 public System.IntPtr NativeClass
57 if (((object)this).GetType() == typeof(IOrientationConcrete))
59 return GetEflClassStatic();
63 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
68 private System.IntPtr handle;
69 ///<summary>Pointer to the native instance.</summary>
70 public System.IntPtr NativeHandle
72 get { return handle; }
75 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
76 efl_orientation_interface_get();
77 /// <summary>Initializes a new instance of the <see cref="IOrientation"/> class.
78 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
79 private IOrientationConcrete(System.IntPtr raw)
83 ///<summary>Destructor.</summary>
84 ~IOrientationConcrete()
89 ///<summary>Releases the underlying native instance.</summary>
90 private void Dispose(bool disposing)
92 if (handle != System.IntPtr.Zero)
97 IntPtr gcHandlePtr = IntPtr.Zero;
100 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
104 Monitor.Enter(Efl.All.InitLock);
105 if (Efl.All.MainLoopInitialized)
107 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
110 Monitor.Exit(Efl.All.InitLock);
116 ///<summary>Releases the underlying native instance.</summary>
117 public void Dispose()
120 GC.SuppressFinalize(this);
123 /// <summary>Verifies if the given object is equal to this one.</summary>
124 /// <param name="instance">The object to compare to.</param>
125 /// <returns>True if both objects point to the same native object.</returns>
126 public override bool Equals(object instance)
128 var other = instance as Efl.Object;
133 return this.NativeHandle == other.NativeHandle;
136 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
137 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
138 public override int GetHashCode()
140 return this.NativeHandle.ToInt32();
143 /// <summary>Turns the native pointer into a string representation.</summary>
144 /// <returns>A string with the type and the native pointer for this object.</returns>
145 public override String ToString()
147 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
150 /// <summary>Control the orientation of a given object.
151 /// This can be used to set the rotation on an image or a window, for instance.</summary>
152 /// <returns>The rotation angle (CCW), see <see cref="Efl.Orient"/>.</returns>
153 public Efl.Orient GetOrientation() {
154 var _ret_var = Efl.IOrientationConcrete.NativeMethods.efl_orientation_get_ptr.Value.Delegate(this.NativeHandle);
155 Eina.Error.RaiseIfUnhandledException();
158 /// <summary>Control the orientation of a given object.
159 /// This can be used to set the rotation on an image or a window, for instance.</summary>
160 /// <param name="dir">The rotation angle (CCW), see <see cref="Efl.Orient"/>.</param>
161 public void SetOrientation(Efl.Orient dir) {
162 Efl.IOrientationConcrete.NativeMethods.efl_orientation_set_ptr.Value.Delegate(this.NativeHandle,dir);
163 Eina.Error.RaiseIfUnhandledException();
165 /// <summary>Control the flip of the given image
166 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
167 /// <returns>Flip method</returns>
168 public Efl.Flip GetFlip() {
169 var _ret_var = Efl.IOrientationConcrete.NativeMethods.efl_orientation_flip_get_ptr.Value.Delegate(this.NativeHandle);
170 Eina.Error.RaiseIfUnhandledException();
173 /// <summary>Control the flip of the given image
174 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
175 /// <param name="flip">Flip method</param>
176 public void SetFlip(Efl.Flip flip) {
177 Efl.IOrientationConcrete.NativeMethods.efl_orientation_flip_set_ptr.Value.Delegate(this.NativeHandle,flip);
178 Eina.Error.RaiseIfUnhandledException();
180 /// <summary>Control the orientation of a given object.
181 /// This can be used to set the rotation on an image or a window, for instance.</summary>
182 /// <value>The rotation angle (CCW), see <see cref="Efl.Orient"/>.</value>
183 public Efl.Orient Orientation {
184 get { return GetOrientation(); }
185 set { SetOrientation(value); }
187 /// <summary>Control the flip of the given image
188 /// Use this function to change how your image is to be flipped: vertically or horizontally or transpose or traverse.</summary>
189 /// <value>Flip method</value>
190 public Efl.Flip Flip {
191 get { return GetFlip(); }
192 set { SetFlip(value); }
194 private static IntPtr GetEflClassStatic()
196 return Efl.IOrientationConcrete.efl_orientation_interface_get();
198 /// <summary>Wrapper for native methods and virtual method delegates.
199 /// For internal use by generated code only.</summary>
200 public class NativeMethods : Efl.Eo.NativeClass
202 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
203 /// <summary>Gets the list of Eo operations to override.</summary>
204 /// <returns>The list of Eo operations to be overload.</returns>
205 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
207 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
208 var methods = Efl.Eo.Globals.GetUserMethods(type);
210 if (efl_orientation_get_static_delegate == null)
212 efl_orientation_get_static_delegate = new efl_orientation_get_delegate(orientation_get);
215 if (methods.FirstOrDefault(m => m.Name == "GetOrientation") != null)
217 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_orientation_get"), func = Marshal.GetFunctionPointerForDelegate(efl_orientation_get_static_delegate) });
220 if (efl_orientation_set_static_delegate == null)
222 efl_orientation_set_static_delegate = new efl_orientation_set_delegate(orientation_set);
225 if (methods.FirstOrDefault(m => m.Name == "SetOrientation") != null)
227 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_orientation_set"), func = Marshal.GetFunctionPointerForDelegate(efl_orientation_set_static_delegate) });
230 if (efl_orientation_flip_get_static_delegate == null)
232 efl_orientation_flip_get_static_delegate = new efl_orientation_flip_get_delegate(flip_get);
235 if (methods.FirstOrDefault(m => m.Name == "GetFlip") != null)
237 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_orientation_flip_get"), func = Marshal.GetFunctionPointerForDelegate(efl_orientation_flip_get_static_delegate) });
240 if (efl_orientation_flip_set_static_delegate == null)
242 efl_orientation_flip_set_static_delegate = new efl_orientation_flip_set_delegate(flip_set);
245 if (methods.FirstOrDefault(m => m.Name == "SetFlip") != null)
247 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_orientation_flip_set"), func = Marshal.GetFunctionPointerForDelegate(efl_orientation_flip_set_static_delegate) });
252 /// <summary>Returns the Eo class for the native methods of this class.</summary>
253 /// <returns>The native class pointer.</returns>
254 public override IntPtr GetEflClass()
256 return Efl.IOrientationConcrete.efl_orientation_interface_get();
259 #pragma warning disable CA1707, SA1300, SA1600
262 private delegate Efl.Orient efl_orientation_get_delegate(System.IntPtr obj, System.IntPtr pd);
265 public delegate Efl.Orient efl_orientation_get_api_delegate(System.IntPtr obj);
267 public static Efl.Eo.FunctionWrapper<efl_orientation_get_api_delegate> efl_orientation_get_ptr = new Efl.Eo.FunctionWrapper<efl_orientation_get_api_delegate>(Module, "efl_orientation_get");
269 private static Efl.Orient orientation_get(System.IntPtr obj, System.IntPtr pd)
271 Eina.Log.Debug("function efl_orientation_get was called");
272 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
275 Efl.Orient _ret_var = default(Efl.Orient);
278 _ret_var = ((IOrientation)wrapper).GetOrientation();
282 Eina.Log.Warning($"Callback error: {e.ToString()}");
283 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
291 return efl_orientation_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
295 private static efl_orientation_get_delegate efl_orientation_get_static_delegate;
298 private delegate void efl_orientation_set_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Orient dir);
301 public delegate void efl_orientation_set_api_delegate(System.IntPtr obj, Efl.Orient dir);
303 public static Efl.Eo.FunctionWrapper<efl_orientation_set_api_delegate> efl_orientation_set_ptr = new Efl.Eo.FunctionWrapper<efl_orientation_set_api_delegate>(Module, "efl_orientation_set");
305 private static void orientation_set(System.IntPtr obj, System.IntPtr pd, Efl.Orient dir)
307 Eina.Log.Debug("function efl_orientation_set was called");
308 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
314 ((IOrientation)wrapper).SetOrientation(dir);
318 Eina.Log.Warning($"Callback error: {e.ToString()}");
319 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
326 efl_orientation_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), dir);
330 private static efl_orientation_set_delegate efl_orientation_set_static_delegate;
333 private delegate Efl.Flip efl_orientation_flip_get_delegate(System.IntPtr obj, System.IntPtr pd);
336 public delegate Efl.Flip efl_orientation_flip_get_api_delegate(System.IntPtr obj);
338 public static Efl.Eo.FunctionWrapper<efl_orientation_flip_get_api_delegate> efl_orientation_flip_get_ptr = new Efl.Eo.FunctionWrapper<efl_orientation_flip_get_api_delegate>(Module, "efl_orientation_flip_get");
340 private static Efl.Flip flip_get(System.IntPtr obj, System.IntPtr pd)
342 Eina.Log.Debug("function efl_orientation_flip_get was called");
343 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
346 Efl.Flip _ret_var = default(Efl.Flip);
349 _ret_var = ((IOrientation)wrapper).GetFlip();
353 Eina.Log.Warning($"Callback error: {e.ToString()}");
354 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
362 return efl_orientation_flip_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
366 private static efl_orientation_flip_get_delegate efl_orientation_flip_get_static_delegate;
369 private delegate void efl_orientation_flip_set_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Flip flip);
372 public delegate void efl_orientation_flip_set_api_delegate(System.IntPtr obj, Efl.Flip flip);
374 public static Efl.Eo.FunctionWrapper<efl_orientation_flip_set_api_delegate> efl_orientation_flip_set_ptr = new Efl.Eo.FunctionWrapper<efl_orientation_flip_set_api_delegate>(Module, "efl_orientation_flip_set");
376 private static void flip_set(System.IntPtr obj, System.IntPtr pd, Efl.Flip flip)
378 Eina.Log.Debug("function efl_orientation_flip_set was called");
379 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
385 ((IOrientation)wrapper).SetFlip(flip);
389 Eina.Log.Warning($"Callback error: {e.ToString()}");
390 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
397 efl_orientation_flip_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), flip);
401 private static efl_orientation_flip_set_delegate efl_orientation_flip_set_static_delegate;
403 #pragma warning restore CA1707, SA1300, SA1600
411 /// <summary>An orientation type, to rotate visual objects.
412 /// Not to be confused with <see cref="Efl.Ui.Dir"/> which is meant for widgets, rather than images and canvases. This enum is used to rotate images, videos and the like.
414 /// See also <see cref="Efl.IOrientation"/>.</summary>
417 /// <summary>Default, same as up</summary>
419 /// <summary>Orient up, do not rotate.</summary>
421 /// <summary>Orient right, rotate 90 degrees counter clock-wise.</summary>
423 /// <summary>Orient down, rotate 180 degrees.</summary>
425 /// <summary>Orient left, rotate 90 degrees clock-wise.</summary>
433 /// <summary>A flip type, to flip visual objects.
434 /// See also <see cref="Efl.IOrientation"/>.</summary>
437 /// <summary>No flip</summary>
439 /// <summary>Flip image horizontally</summary>
441 /// <summary>Flip image vertically</summary>