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 graphics view interface</summary>
13 [Efl.Gfx.IViewConcrete.NativeMethods]
14 public interface IView :
15 Efl.Eo.IWrapper, IDisposable
17 /// <summary>The dimensions of this object's viewport.
18 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
20 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
22 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
24 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
26 /// Refer to each implementing class specific documentation for more details.</summary>
27 /// <returns>Size of the view.</returns>
28 Eina.Size2D GetViewSize();
29 /// <summary>The dimensions of this object's viewport.
30 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
32 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
34 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
36 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
38 /// Refer to each implementing class specific documentation for more details.</summary>
39 /// <param name="size">Size of the view.</param>
40 void SetViewSize(Eina.Size2D size);
41 /// <summary>The dimensions of this object's viewport.
42 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
44 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
46 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
48 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
50 /// Refer to each implementing class specific documentation for more details.</summary>
51 /// <value>Size of the view.</value>
52 Eina.Size2D ViewSize {
57 /// <summary>Efl graphics view interface</summary>
58 sealed public class IViewConcrete :
63 ///<summary>Pointer to the native class description.</summary>
64 public System.IntPtr NativeClass
68 if (((object)this).GetType() == typeof(IViewConcrete))
70 return GetEflClassStatic();
74 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
79 private System.IntPtr handle;
80 ///<summary>Pointer to the native instance.</summary>
81 public System.IntPtr NativeHandle
83 get { return handle; }
86 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
87 efl_gfx_view_interface_get();
88 /// <summary>Initializes a new instance of the <see cref="IView"/> class.
89 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
90 private IViewConcrete(System.IntPtr raw)
94 ///<summary>Destructor.</summary>
100 ///<summary>Releases the underlying native instance.</summary>
101 private void Dispose(bool disposing)
103 if (handle != System.IntPtr.Zero)
106 handle = IntPtr.Zero;
108 IntPtr gcHandlePtr = IntPtr.Zero;
111 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
115 Monitor.Enter(Efl.All.InitLock);
116 if (Efl.All.MainLoopInitialized)
118 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
121 Monitor.Exit(Efl.All.InitLock);
127 ///<summary>Releases the underlying native instance.</summary>
128 public void Dispose()
131 GC.SuppressFinalize(this);
134 /// <summary>Verifies if the given object is equal to this one.</summary>
135 /// <param name="instance">The object to compare to.</param>
136 /// <returns>True if both objects point to the same native object.</returns>
137 public override bool Equals(object instance)
139 var other = instance as Efl.Object;
144 return this.NativeHandle == other.NativeHandle;
147 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
148 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
149 public override int GetHashCode()
151 return this.NativeHandle.ToInt32();
154 /// <summary>Turns the native pointer into a string representation.</summary>
155 /// <returns>A string with the type and the native pointer for this object.</returns>
156 public override String ToString()
158 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
161 /// <summary>The dimensions of this object's viewport.
162 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
164 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
166 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
168 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
170 /// Refer to each implementing class specific documentation for more details.</summary>
171 /// <returns>Size of the view.</returns>
172 public Eina.Size2D GetViewSize() {
173 var _ret_var = Efl.Gfx.IViewConcrete.NativeMethods.efl_gfx_view_size_get_ptr.Value.Delegate(this.NativeHandle);
174 Eina.Error.RaiseIfUnhandledException();
177 /// <summary>The dimensions of this object's viewport.
178 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
180 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
182 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
184 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
186 /// Refer to each implementing class specific documentation for more details.</summary>
187 /// <param name="size">Size of the view.</param>
188 public void SetViewSize(Eina.Size2D size) {
189 Eina.Size2D.NativeStruct _in_size = size;
190 Efl.Gfx.IViewConcrete.NativeMethods.efl_gfx_view_size_set_ptr.Value.Delegate(this.NativeHandle,_in_size);
191 Eina.Error.RaiseIfUnhandledException();
193 /// <summary>The dimensions of this object's viewport.
194 /// This property represents the size of an image (file on disk, vector graphics, GL or 3D scene, ...) view: this is the logical size of a view, not the number of pixels in the buffer, nor its visible size on the window.
196 /// For scalable scenes (vector graphics, 3D or GL), this means scaling the contents of the scene and drawing more pixels as a result; For pixmaps this means zooming and stretching up or down the backing buffer to fit this view.
198 /// In most cases the view should have the same dimensions as the object on the canvas, for best quality.
200 /// <see cref="Efl.Gfx.IView.SetViewSize"/> may not be implemented. If it is, it might trigger a complete recalculation of the scene, or reload of the pixel data.
202 /// Refer to each implementing class specific documentation for more details.</summary>
203 /// <value>Size of the view.</value>
204 public Eina.Size2D ViewSize {
205 get { return GetViewSize(); }
206 set { SetViewSize(value); }
208 private static IntPtr GetEflClassStatic()
210 return Efl.Gfx.IViewConcrete.efl_gfx_view_interface_get();
212 /// <summary>Wrapper for native methods and virtual method delegates.
213 /// For internal use by generated code only.</summary>
214 public class NativeMethods : Efl.Eo.NativeClass
216 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
217 /// <summary>Gets the list of Eo operations to override.</summary>
218 /// <returns>The list of Eo operations to be overload.</returns>
219 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
221 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
222 var methods = Efl.Eo.Globals.GetUserMethods(type);
224 if (efl_gfx_view_size_get_static_delegate == null)
226 efl_gfx_view_size_get_static_delegate = new efl_gfx_view_size_get_delegate(view_size_get);
229 if (methods.FirstOrDefault(m => m.Name == "GetViewSize") != null)
231 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_view_size_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_view_size_get_static_delegate) });
234 if (efl_gfx_view_size_set_static_delegate == null)
236 efl_gfx_view_size_set_static_delegate = new efl_gfx_view_size_set_delegate(view_size_set);
239 if (methods.FirstOrDefault(m => m.Name == "SetViewSize") != null)
241 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_view_size_set"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_view_size_set_static_delegate) });
246 /// <summary>Returns the Eo class for the native methods of this class.</summary>
247 /// <returns>The native class pointer.</returns>
248 public override IntPtr GetEflClass()
250 return Efl.Gfx.IViewConcrete.efl_gfx_view_interface_get();
253 #pragma warning disable CA1707, SA1300, SA1600
256 private delegate Eina.Size2D.NativeStruct efl_gfx_view_size_get_delegate(System.IntPtr obj, System.IntPtr pd);
259 public delegate Eina.Size2D.NativeStruct efl_gfx_view_size_get_api_delegate(System.IntPtr obj);
261 public static Efl.Eo.FunctionWrapper<efl_gfx_view_size_get_api_delegate> efl_gfx_view_size_get_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_view_size_get_api_delegate>(Module, "efl_gfx_view_size_get");
263 private static Eina.Size2D.NativeStruct view_size_get(System.IntPtr obj, System.IntPtr pd)
265 Eina.Log.Debug("function efl_gfx_view_size_get was called");
266 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
269 Eina.Size2D _ret_var = default(Eina.Size2D);
272 _ret_var = ((IView)wrapper).GetViewSize();
276 Eina.Log.Warning($"Callback error: {e.ToString()}");
277 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
285 return efl_gfx_view_size_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
289 private static efl_gfx_view_size_get_delegate efl_gfx_view_size_get_static_delegate;
292 private delegate void efl_gfx_view_size_set_delegate(System.IntPtr obj, System.IntPtr pd, Eina.Size2D.NativeStruct size);
295 public delegate void efl_gfx_view_size_set_api_delegate(System.IntPtr obj, Eina.Size2D.NativeStruct size);
297 public static Efl.Eo.FunctionWrapper<efl_gfx_view_size_set_api_delegate> efl_gfx_view_size_set_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_view_size_set_api_delegate>(Module, "efl_gfx_view_size_set");
299 private static void view_size_set(System.IntPtr obj, System.IntPtr pd, Eina.Size2D.NativeStruct size)
301 Eina.Log.Debug("function efl_gfx_view_size_set was called");
302 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
305 Eina.Size2D _in_size = size;
309 ((IView)wrapper).SetViewSize(_in_size);
313 Eina.Log.Warning($"Callback error: {e.ToString()}");
314 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
321 efl_gfx_view_size_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), size);
325 private static efl_gfx_view_size_set_delegate efl_gfx_view_size_set_static_delegate;
327 #pragma warning restore CA1707, SA1300, SA1600