2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
11 /// <summary>Efl screen interface
12 /// (Since EFL 1.22)</summary>
13 [Efl.IScreenConcrete.NativeMethods]
14 [Efl.Eo.BindingEntity]
15 public interface IScreen :
16 Efl.Eo.IWrapper, IDisposable
18 /// <summary>Get screen size (in pixels) for the screen.
19 /// Note that on some display systems this information is not available and a value of 0x0 will be returned.
20 /// (Since EFL 1.22)</summary>
21 /// <returns>The screen size in pixels.</returns>
22 Eina.Size2D GetScreenSizeInPixels();
23 /// <summary>Get screen scaling factor.
24 /// This is the factor by which window contents will be scaled on the screen.
26 /// Note that on some display systems this information is not available and a value of 1.0 will be returned.
27 /// (Since EFL 1.22)</summary>
28 /// <returns>The screen scaling factor.</returns>
29 float GetScreenScaleFactor();
30 /// <summary>Get the rotation of the screen.
31 /// Most engines only return multiples of 90.
32 /// (Since EFL 1.22)</summary>
33 /// <returns>Screen rotation in degrees.</returns>
34 int GetScreenRotation();
35 /// <summary>Get the pixel density in DPI (Dots Per Inch) for the screen that a window is on.
36 /// (Since EFL 1.22)</summary>
37 /// <param name="xdpi">Horizontal DPI.</param>
38 /// <param name="ydpi">Vertical DPI.</param>
39 void GetScreenDpi(out int xdpi, out int ydpi);
40 /// <summary>Get screen size (in pixels) for the screen.
41 /// Note that on some display systems this information is not available and a value of 0x0 will be returned.
42 /// (Since EFL 1.22)</summary>
43 /// <value>The screen size in pixels.</value>
44 Eina.Size2D ScreenSizeInPixels {
47 /// <summary>Get screen scaling factor.
48 /// This is the factor by which window contents will be scaled on the screen.
50 /// Note that on some display systems this information is not available and a value of 1.0 will be returned.
51 /// (Since EFL 1.22)</summary>
52 /// <value>The screen scaling factor.</value>
53 float ScreenScaleFactor {
56 /// <summary>Get the rotation of the screen.
57 /// Most engines only return multiples of 90.
58 /// (Since EFL 1.22)</summary>
59 /// <value>Screen rotation in degrees.</value>
63 /// <summary>Get the pixel density in DPI (Dots Per Inch) for the screen that a window is on.
64 /// (Since EFL 1.22)</summary>
65 (int, int) ScreenDpi {
69 /// <summary>Efl screen interface
70 /// (Since EFL 1.22)</summary>
71 sealed public class IScreenConcrete :
76 /// <summary>Pointer to the native class description.</summary>
77 public override System.IntPtr NativeClass
81 if (((object)this).GetType() == typeof(IScreenConcrete))
83 return GetEflClassStatic();
87 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
92 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
93 /// Do not call this constructor directly.</summary>
94 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
95 private IScreenConcrete(ConstructingHandle ch) : base(ch)
99 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
100 efl_screen_interface_get();
101 /// <summary>Initializes a new instance of the <see cref="IScreen"/> class.
102 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
103 /// <param name="wh">The native pointer to be wrapped.</param>
104 private IScreenConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
108 /// <summary>Get screen size (in pixels) for the screen.
109 /// Note that on some display systems this information is not available and a value of 0x0 will be returned.
110 /// (Since EFL 1.22)</summary>
111 /// <returns>The screen size in pixels.</returns>
112 public Eina.Size2D GetScreenSizeInPixels() {
113 var _ret_var = Efl.IScreenConcrete.NativeMethods.efl_screen_size_in_pixels_get_ptr.Value.Delegate(this.NativeHandle);
114 Eina.Error.RaiseIfUnhandledException();
117 /// <summary>Get screen scaling factor.
118 /// This is the factor by which window contents will be scaled on the screen.
120 /// Note that on some display systems this information is not available and a value of 1.0 will be returned.
121 /// (Since EFL 1.22)</summary>
122 /// <returns>The screen scaling factor.</returns>
123 public float GetScreenScaleFactor() {
124 var _ret_var = Efl.IScreenConcrete.NativeMethods.efl_screen_scale_factor_get_ptr.Value.Delegate(this.NativeHandle);
125 Eina.Error.RaiseIfUnhandledException();
128 /// <summary>Get the rotation of the screen.
129 /// Most engines only return multiples of 90.
130 /// (Since EFL 1.22)</summary>
131 /// <returns>Screen rotation in degrees.</returns>
132 public int GetScreenRotation() {
133 var _ret_var = Efl.IScreenConcrete.NativeMethods.efl_screen_rotation_get_ptr.Value.Delegate(this.NativeHandle);
134 Eina.Error.RaiseIfUnhandledException();
137 /// <summary>Get the pixel density in DPI (Dots Per Inch) for the screen that a window is on.
138 /// (Since EFL 1.22)</summary>
139 /// <param name="xdpi">Horizontal DPI.</param>
140 /// <param name="ydpi">Vertical DPI.</param>
141 public void GetScreenDpi(out int xdpi, out int ydpi) {
142 Efl.IScreenConcrete.NativeMethods.efl_screen_dpi_get_ptr.Value.Delegate(this.NativeHandle,out xdpi, out ydpi);
143 Eina.Error.RaiseIfUnhandledException();
145 /// <summary>Get screen size (in pixels) for the screen.
146 /// Note that on some display systems this information is not available and a value of 0x0 will be returned.
147 /// (Since EFL 1.22)</summary>
148 /// <value>The screen size in pixels.</value>
149 public Eina.Size2D ScreenSizeInPixels {
150 get { return GetScreenSizeInPixels(); }
152 /// <summary>Get screen scaling factor.
153 /// This is the factor by which window contents will be scaled on the screen.
155 /// Note that on some display systems this information is not available and a value of 1.0 will be returned.
156 /// (Since EFL 1.22)</summary>
157 /// <value>The screen scaling factor.</value>
158 public float ScreenScaleFactor {
159 get { return GetScreenScaleFactor(); }
161 /// <summary>Get the rotation of the screen.
162 /// Most engines only return multiples of 90.
163 /// (Since EFL 1.22)</summary>
164 /// <value>Screen rotation in degrees.</value>
165 public int ScreenRotation {
166 get { return GetScreenRotation(); }
168 /// <summary>Get the pixel density in DPI (Dots Per Inch) for the screen that a window is on.
169 /// (Since EFL 1.22)</summary>
170 public (int, int) ScreenDpi {
172 int _out_xdpi = default(int);
173 int _out_ydpi = default(int);
174 GetScreenDpi(out _out_xdpi,out _out_ydpi);
175 return (_out_xdpi,_out_ydpi);
178 private static IntPtr GetEflClassStatic()
180 return Efl.IScreenConcrete.efl_screen_interface_get();
182 /// <summary>Wrapper for native methods and virtual method delegates.
183 /// For internal use by generated code only.</summary>
184 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
186 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
187 /// <summary>Gets the list of Eo operations to override.</summary>
188 /// <returns>The list of Eo operations to be overload.</returns>
189 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
191 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
192 var methods = Efl.Eo.Globals.GetUserMethods(type);
194 if (efl_screen_size_in_pixels_get_static_delegate == null)
196 efl_screen_size_in_pixels_get_static_delegate = new efl_screen_size_in_pixels_get_delegate(screen_size_in_pixels_get);
199 if (methods.FirstOrDefault(m => m.Name == "GetScreenSizeInPixels") != null)
201 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_screen_size_in_pixels_get"), func = Marshal.GetFunctionPointerForDelegate(efl_screen_size_in_pixels_get_static_delegate) });
204 if (efl_screen_scale_factor_get_static_delegate == null)
206 efl_screen_scale_factor_get_static_delegate = new efl_screen_scale_factor_get_delegate(screen_scale_factor_get);
209 if (methods.FirstOrDefault(m => m.Name == "GetScreenScaleFactor") != null)
211 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_screen_scale_factor_get"), func = Marshal.GetFunctionPointerForDelegate(efl_screen_scale_factor_get_static_delegate) });
214 if (efl_screen_rotation_get_static_delegate == null)
216 efl_screen_rotation_get_static_delegate = new efl_screen_rotation_get_delegate(screen_rotation_get);
219 if (methods.FirstOrDefault(m => m.Name == "GetScreenRotation") != null)
221 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_screen_rotation_get"), func = Marshal.GetFunctionPointerForDelegate(efl_screen_rotation_get_static_delegate) });
224 if (efl_screen_dpi_get_static_delegate == null)
226 efl_screen_dpi_get_static_delegate = new efl_screen_dpi_get_delegate(screen_dpi_get);
229 if (methods.FirstOrDefault(m => m.Name == "GetScreenDpi") != null)
231 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_screen_dpi_get"), func = Marshal.GetFunctionPointerForDelegate(efl_screen_dpi_get_static_delegate) });
236 /// <summary>Returns the Eo class for the native methods of this class.</summary>
237 /// <returns>The native class pointer.</returns>
238 public override IntPtr GetEflClass()
240 return Efl.IScreenConcrete.efl_screen_interface_get();
243 #pragma warning disable CA1707, CS1591, SA1300, SA1600
246 private delegate Eina.Size2D.NativeStruct efl_screen_size_in_pixels_get_delegate(System.IntPtr obj, System.IntPtr pd);
249 public delegate Eina.Size2D.NativeStruct efl_screen_size_in_pixels_get_api_delegate(System.IntPtr obj);
251 public static Efl.Eo.FunctionWrapper<efl_screen_size_in_pixels_get_api_delegate> efl_screen_size_in_pixels_get_ptr = new Efl.Eo.FunctionWrapper<efl_screen_size_in_pixels_get_api_delegate>(Module, "efl_screen_size_in_pixels_get");
253 private static Eina.Size2D.NativeStruct screen_size_in_pixels_get(System.IntPtr obj, System.IntPtr pd)
255 Eina.Log.Debug("function efl_screen_size_in_pixels_get was called");
256 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
259 Eina.Size2D _ret_var = default(Eina.Size2D);
262 _ret_var = ((IScreen)ws.Target).GetScreenSizeInPixels();
266 Eina.Log.Warning($"Callback error: {e.ToString()}");
267 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
275 return efl_screen_size_in_pixels_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
279 private static efl_screen_size_in_pixels_get_delegate efl_screen_size_in_pixels_get_static_delegate;
282 private delegate float efl_screen_scale_factor_get_delegate(System.IntPtr obj, System.IntPtr pd);
285 public delegate float efl_screen_scale_factor_get_api_delegate(System.IntPtr obj);
287 public static Efl.Eo.FunctionWrapper<efl_screen_scale_factor_get_api_delegate> efl_screen_scale_factor_get_ptr = new Efl.Eo.FunctionWrapper<efl_screen_scale_factor_get_api_delegate>(Module, "efl_screen_scale_factor_get");
289 private static float screen_scale_factor_get(System.IntPtr obj, System.IntPtr pd)
291 Eina.Log.Debug("function efl_screen_scale_factor_get was called");
292 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
295 float _ret_var = default(float);
298 _ret_var = ((IScreen)ws.Target).GetScreenScaleFactor();
302 Eina.Log.Warning($"Callback error: {e.ToString()}");
303 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
311 return efl_screen_scale_factor_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
315 private static efl_screen_scale_factor_get_delegate efl_screen_scale_factor_get_static_delegate;
318 private delegate int efl_screen_rotation_get_delegate(System.IntPtr obj, System.IntPtr pd);
321 public delegate int efl_screen_rotation_get_api_delegate(System.IntPtr obj);
323 public static Efl.Eo.FunctionWrapper<efl_screen_rotation_get_api_delegate> efl_screen_rotation_get_ptr = new Efl.Eo.FunctionWrapper<efl_screen_rotation_get_api_delegate>(Module, "efl_screen_rotation_get");
325 private static int screen_rotation_get(System.IntPtr obj, System.IntPtr pd)
327 Eina.Log.Debug("function efl_screen_rotation_get was called");
328 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
331 int _ret_var = default(int);
334 _ret_var = ((IScreen)ws.Target).GetScreenRotation();
338 Eina.Log.Warning($"Callback error: {e.ToString()}");
339 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
347 return efl_screen_rotation_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
351 private static efl_screen_rotation_get_delegate efl_screen_rotation_get_static_delegate;
354 private delegate void efl_screen_dpi_get_delegate(System.IntPtr obj, System.IntPtr pd, out int xdpi, out int ydpi);
357 public delegate void efl_screen_dpi_get_api_delegate(System.IntPtr obj, out int xdpi, out int ydpi);
359 public static Efl.Eo.FunctionWrapper<efl_screen_dpi_get_api_delegate> efl_screen_dpi_get_ptr = new Efl.Eo.FunctionWrapper<efl_screen_dpi_get_api_delegate>(Module, "efl_screen_dpi_get");
361 private static void screen_dpi_get(System.IntPtr obj, System.IntPtr pd, out int xdpi, out int ydpi)
363 Eina.Log.Debug("function efl_screen_dpi_get was called");
364 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
367 xdpi = default(int); ydpi = default(int);
370 ((IScreen)ws.Target).GetScreenDpi(out xdpi, out ydpi);
374 Eina.Log.Warning($"Callback error: {e.ToString()}");
375 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
382 efl_screen_dpi_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out xdpi, out ydpi);
386 private static efl_screen_dpi_get_delegate efl_screen_dpi_get_static_delegate;
388 #pragma warning restore CA1707, CS1591, SA1300, SA1600
395 #pragma warning disable CS1591
396 public static class EflIScreenConcrete_ExtensionMethods {
402 #pragma warning restore CS1591