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>An off-screen window to be displayed in a remote process.
14 /// The window is rendered onto an image buffer to be displayed in another process' plug image object. No actual window is created for this type. The window contents can then be sent over a socket so that another process displays it inside a plug image.</summary>
15 /// <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>
16 [Efl.Ui.WinSocket.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public class WinSocket : Efl.Ui.Win
20 /// <summary>Pointer to the native class description.</summary>
21 public override System.IntPtr NativeClass
25 if (((object)this).GetType() == typeof(WinSocket))
27 return GetEflClassStatic();
31 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
36 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
37 efl_ui_win_socket_class_get();
38 /// <summary>Initializes a new instance of the <see cref="WinSocket"/> class.</summary>
39 /// <param name="parent">Parent instance.</param>
40 /// <param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle" /></param>
41 /// <param name="winName">The window name. See <see cref="Efl.Ui.Win.SetWinName" /></param>
42 /// <param name="winType">The type of the window. See <see cref="Efl.Ui.Win.SetWinType" /></param>
43 /// <param name="accelPreference">The hardware acceleration preference for this window. See <see cref="Efl.Ui.Win.SetAccelPreference" /></param>
44 public WinSocket(Efl.Object parent
45 , System.String style = null, System.String winName = null, Efl.Ui.WinType? winType = null, System.String accelPreference = null) : base(efl_ui_win_socket_class_get(), parent)
47 if (Efl.Eo.Globals.ParamHelperCheck(style))
49 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
52 if (Efl.Eo.Globals.ParamHelperCheck(winName))
54 SetWinName(Efl.Eo.Globals.GetParamHelper(winName));
57 if (Efl.Eo.Globals.ParamHelperCheck(winType))
59 SetWinType(Efl.Eo.Globals.GetParamHelper(winType));
62 if (Efl.Eo.Globals.ParamHelperCheck(accelPreference))
64 SetAccelPreference(Efl.Eo.Globals.GetParamHelper(accelPreference));
67 FinishInstantiation();
70 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
71 /// Do not call this constructor directly.</summary>
72 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
73 protected WinSocket(ConstructingHandle ch) : base(ch)
77 /// <summary>Initializes a new instance of the <see cref="WinSocket"/> class.
78 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
79 /// <param name="wh">The native pointer to be wrapped.</param>
80 protected WinSocket(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
84 /// <summary>Initializes a new instance of the <see cref="WinSocket"/> class.
85 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
86 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
87 /// <param name="parent">The Efl.Object parent of this instance.</param>
88 protected WinSocket(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
92 /// <summary>Create a socket to provide the service for Plug widget.</summary>
93 /// <param name="svcname">The name of the service to be advertised. Ensure that it is unique (when combined with <c>svcnum</c>) otherwise creation may fail.</param>
94 /// <param name="svcnum">A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name.</param>
95 /// <param name="svcsys">A boolean which when true specifies the creation of a system-wide service to which all users can connect, otherwise the service is private to the user id that created it.</param>
96 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
97 virtual public bool SocketListen(System.String svcname, int svcnum, bool svcsys) {
98 var _ret_var = Efl.Ui.WinSocket.NativeMethods.efl_ui_win_socket_listen_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),svcname, svcnum, svcsys);
99 Eina.Error.RaiseIfUnhandledException();
102 private static IntPtr GetEflClassStatic()
104 return Efl.Ui.WinSocket.efl_ui_win_socket_class_get();
106 /// <summary>Wrapper for native methods and virtual method delegates.
107 /// For internal use by generated code only.</summary>
108 public new class NativeMethods : Efl.Ui.Win.NativeMethods
110 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
111 /// <summary>Gets the list of Eo operations to override.</summary>
112 /// <returns>The list of Eo operations to be overload.</returns>
113 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
115 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
116 var methods = Efl.Eo.Globals.GetUserMethods(type);
118 if (efl_ui_win_socket_listen_static_delegate == null)
120 efl_ui_win_socket_listen_static_delegate = new efl_ui_win_socket_listen_delegate(socket_listen);
123 if (methods.FirstOrDefault(m => m.Name == "SocketListen") != null)
125 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_win_socket_listen"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_win_socket_listen_static_delegate) });
128 descs.AddRange(base.GetEoOps(type));
131 /// <summary>Returns the Eo class for the native methods of this class.</summary>
132 /// <returns>The native class pointer.</returns>
133 public override IntPtr GetEflClass()
135 return Efl.Ui.WinSocket.efl_ui_win_socket_class_get();
138 #pragma warning disable CA1707, CS1591, SA1300, SA1600
140 [return: MarshalAs(UnmanagedType.U1)]
141 private delegate bool efl_ui_win_socket_listen_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String svcname, int svcnum, [MarshalAs(UnmanagedType.U1)] bool svcsys);
143 [return: MarshalAs(UnmanagedType.U1)]
144 public delegate bool efl_ui_win_socket_listen_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String svcname, int svcnum, [MarshalAs(UnmanagedType.U1)] bool svcsys);
146 public static Efl.Eo.FunctionWrapper<efl_ui_win_socket_listen_api_delegate> efl_ui_win_socket_listen_ptr = new Efl.Eo.FunctionWrapper<efl_ui_win_socket_listen_api_delegate>(Module, "efl_ui_win_socket_listen");
148 private static bool socket_listen(System.IntPtr obj, System.IntPtr pd, System.String svcname, int svcnum, bool svcsys)
150 Eina.Log.Debug("function efl_ui_win_socket_listen was called");
151 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
154 bool _ret_var = default(bool);
157 _ret_var = ((WinSocket)ws.Target).SocketListen(svcname, svcnum, svcsys);
161 Eina.Log.Warning($"Callback error: {e.ToString()}");
162 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
170 return efl_ui_win_socket_listen_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), svcname, svcnum, svcsys);
174 private static efl_ui_win_socket_listen_delegate efl_ui_win_socket_listen_static_delegate;
176 #pragma warning restore CA1707, CS1591, SA1300, SA1600
185 #pragma warning disable CS1591
186 public static class Efl_UiWinSocket_ExtensionMethods {
188 #pragma warning restore CS1591