1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
12 /// <summary>EFL UI object direction interface</summary>
13 [Efl.Ui.IDirectionConcrete.NativeMethods]
14 public interface IDirection :
15 Efl.Eo.IWrapper, IDisposable
17 /// <summary>Control the direction of a given widget.
18 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
20 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
21 /// <returns>Direction of the widget.</returns>
22 Efl.Ui.Dir GetDirection();
23 /// <summary>Control the direction of a given widget.
24 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
26 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
27 /// <param name="dir">Direction of the widget.</param>
28 void SetDirection(Efl.Ui.Dir dir);
29 /// <summary>Control the direction of a given widget.
30 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
32 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
33 /// <value>Direction of the widget.</value>
34 Efl.Ui.Dir Direction {
39 /// <summary>EFL UI object direction interface</summary>
40 sealed public class IDirectionConcrete :
45 ///<summary>Pointer to the native class description.</summary>
46 public System.IntPtr NativeClass
50 if (((object)this).GetType() == typeof(IDirectionConcrete))
52 return GetEflClassStatic();
56 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
61 private System.IntPtr handle;
62 ///<summary>Pointer to the native instance.</summary>
63 public System.IntPtr NativeHandle
65 get { return handle; }
68 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
69 efl_ui_direction_interface_get();
70 /// <summary>Initializes a new instance of the <see cref="IDirection"/> class.
71 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
72 private IDirectionConcrete(System.IntPtr raw)
76 ///<summary>Destructor.</summary>
82 ///<summary>Releases the underlying native instance.</summary>
83 private void Dispose(bool disposing)
85 if (handle != System.IntPtr.Zero)
90 IntPtr gcHandlePtr = IntPtr.Zero;
93 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
97 Monitor.Enter(Efl.All.InitLock);
98 if (Efl.All.MainLoopInitialized)
100 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
103 Monitor.Exit(Efl.All.InitLock);
109 ///<summary>Releases the underlying native instance.</summary>
110 public void Dispose()
113 GC.SuppressFinalize(this);
116 /// <summary>Verifies if the given object is equal to this one.</summary>
117 /// <param name="instance">The object to compare to.</param>
118 /// <returns>True if both objects point to the same native object.</returns>
119 public override bool Equals(object instance)
121 var other = instance as Efl.Object;
126 return this.NativeHandle == other.NativeHandle;
129 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
130 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
131 public override int GetHashCode()
133 return this.NativeHandle.ToInt32();
136 /// <summary>Turns the native pointer into a string representation.</summary>
137 /// <returns>A string with the type and the native pointer for this object.</returns>
138 public override String ToString()
140 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
143 /// <summary>Control the direction of a given widget.
144 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
146 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
147 /// <returns>Direction of the widget.</returns>
148 public Efl.Ui.Dir GetDirection() {
149 var _ret_var = Efl.Ui.IDirectionConcrete.NativeMethods.efl_ui_direction_get_ptr.Value.Delegate(this.NativeHandle);
150 Eina.Error.RaiseIfUnhandledException();
153 /// <summary>Control the direction of a given widget.
154 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
156 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
157 /// <param name="dir">Direction of the widget.</param>
158 public void SetDirection(Efl.Ui.Dir dir) {
159 Efl.Ui.IDirectionConcrete.NativeMethods.efl_ui_direction_set_ptr.Value.Delegate(this.NativeHandle,dir);
160 Eina.Error.RaiseIfUnhandledException();
162 /// <summary>Control the direction of a given widget.
163 /// Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.
165 /// Mirroring as defined in <see cref="Efl.Ui.II18n"/> can invert the <c>horizontal</c> direction: it is <c>ltr</c> by default, but becomes <c>rtl</c> if the object is mirrored.</summary>
166 /// <value>Direction of the widget.</value>
167 public Efl.Ui.Dir Direction {
168 get { return GetDirection(); }
169 set { SetDirection(value); }
171 private static IntPtr GetEflClassStatic()
173 return Efl.Ui.IDirectionConcrete.efl_ui_direction_interface_get();
175 /// <summary>Wrapper for native methods and virtual method delegates.
176 /// For internal use by generated code only.</summary>
177 public class NativeMethods : Efl.Eo.NativeClass
179 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
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)
184 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
185 var methods = Efl.Eo.Globals.GetUserMethods(type);
187 if (efl_ui_direction_get_static_delegate == null)
189 efl_ui_direction_get_static_delegate = new efl_ui_direction_get_delegate(direction_get);
192 if (methods.FirstOrDefault(m => m.Name == "GetDirection") != null)
194 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_direction_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_direction_get_static_delegate) });
197 if (efl_ui_direction_set_static_delegate == null)
199 efl_ui_direction_set_static_delegate = new efl_ui_direction_set_delegate(direction_set);
202 if (methods.FirstOrDefault(m => m.Name == "SetDirection") != null)
204 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_direction_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_direction_set_static_delegate) });
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()
213 return Efl.Ui.IDirectionConcrete.efl_ui_direction_interface_get();
216 #pragma warning disable CA1707, SA1300, SA1600
219 private delegate Efl.Ui.Dir efl_ui_direction_get_delegate(System.IntPtr obj, System.IntPtr pd);
222 public delegate Efl.Ui.Dir efl_ui_direction_get_api_delegate(System.IntPtr obj);
224 public static Efl.Eo.FunctionWrapper<efl_ui_direction_get_api_delegate> efl_ui_direction_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_direction_get_api_delegate>(Module, "efl_ui_direction_get");
226 private static Efl.Ui.Dir direction_get(System.IntPtr obj, System.IntPtr pd)
228 Eina.Log.Debug("function efl_ui_direction_get was called");
229 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
232 Efl.Ui.Dir _ret_var = default(Efl.Ui.Dir);
235 _ret_var = ((IDirection)wrapper).GetDirection();
239 Eina.Log.Warning($"Callback error: {e.ToString()}");
240 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
248 return efl_ui_direction_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
252 private static efl_ui_direction_get_delegate efl_ui_direction_get_static_delegate;
255 private delegate void efl_ui_direction_set_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.Dir dir);
258 public delegate void efl_ui_direction_set_api_delegate(System.IntPtr obj, Efl.Ui.Dir dir);
260 public static Efl.Eo.FunctionWrapper<efl_ui_direction_set_api_delegate> efl_ui_direction_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_direction_set_api_delegate>(Module, "efl_ui_direction_set");
262 private static void direction_set(System.IntPtr obj, System.IntPtr pd, Efl.Ui.Dir dir)
264 Eina.Log.Debug("function efl_ui_direction_set was called");
265 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
271 ((IDirection)wrapper).SetDirection(dir);
275 Eina.Log.Warning($"Callback error: {e.ToString()}");
276 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
283 efl_ui_direction_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), dir);
287 private static efl_ui_direction_set_delegate efl_ui_direction_set_static_delegate;
289 #pragma warning restore CA1707, SA1300, SA1600
301 /// <summary>Direction for UI objects and layouts.
302 /// Not to be confused with <see cref="Efl.Orient"/> which is for images and canvases. This enum is used to define how widgets should expand and orient themselves, not to rotate images.
304 /// See also <see cref="Efl.Ui.IDirection"/>.</summary>
307 /// <summary>Default direction. Each widget may have a different default.</summary>
309 /// <summary>Horizontal direction, along the X axis. Usually left-to-right, but may be inverted to right-to-left if mirroring is on.</summary>
311 /// <summary>Vertical direction, along the Y axis. Usually downwards.</summary>
313 /// <summary>Horizontal, left-to-right direction.</summary>
315 /// <summary>Horizontal, right-to-left direction.</summary>
317 /// <summary>Vertical, top-to-bottom direction.</summary>
319 /// <summary>Vertical, bottom-to-top direction.</summary>
321 /// <summary>Right is an alias for LTR.</summary>
323 /// <summary>Left is an alias for RTL.</summary>