1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.ComponentModel;
7 namespace Efl { namespace Ui {
8 /// <summary>An off-screen window to be displayed in a remote process.
9 /// 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>
10 [WinSocketNativeInherit]
11 public class WinSocket : Efl.Ui.Win, Efl.Eo.IWrapper
13 public new static System.IntPtr klass = System.IntPtr.Zero;
14 public new static Efl.Ui.WinSocketNativeInherit nativeInherit = new Efl.Ui.WinSocketNativeInherit();
15 ///<summary>Pointer to the native class description.</summary>
16 public override System.IntPtr NativeClass {
18 if (((object)this).GetType() == typeof (WinSocket))
19 return Efl.Ui.WinSocketNativeInherit.GetEflClassStatic();
21 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
24 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
25 efl_ui_win_socket_class_get();
26 ///<summary>Creates a new instance.</summary>
27 ///<param name="parent">Parent instance.</param>
28 ///<param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle"/></param>
29 ///<param name="winName">The window name. See <see cref="Efl.Ui.Win.SetWinName"/></param>
30 ///<param name="winType">The type of the window. See <see cref="Efl.Ui.Win.SetWinType"/></param>
31 ///<param name="accelPreference">The hardware acceleration preference for this window. See <see cref="Efl.Ui.Win.SetAccelPreference"/></param>
32 public WinSocket(Efl.Object parent
33 , System.String style = null, System.String winName = null, Efl.Ui.WinType? winType = null, System.String accelPreference = null) :
34 base(efl_ui_win_socket_class_get(), typeof(WinSocket), parent)
36 if (Efl.Eo.Globals.ParamHelperCheck(style))
37 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
38 if (Efl.Eo.Globals.ParamHelperCheck(winName))
39 SetWinName(Efl.Eo.Globals.GetParamHelper(winName));
40 if (Efl.Eo.Globals.ParamHelperCheck(winType))
41 SetWinType(Efl.Eo.Globals.GetParamHelper(winType));
42 if (Efl.Eo.Globals.ParamHelperCheck(accelPreference))
43 SetAccelPreference(Efl.Eo.Globals.GetParamHelper(accelPreference));
44 FinishInstantiation();
46 ///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
47 public WinSocket(System.IntPtr raw) : base(raw)
49 register_event_proxies();
51 ///<summary>Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
52 protected WinSocket(IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(base_klass, managed_type, parent) {}
53 ///<summary>Casts obj into an instance of this type.</summary>
54 public new static WinSocket static_cast(Efl.Object obj)
57 throw new System.ArgumentNullException("obj");
58 return new WinSocket(obj.NativeHandle);
60 ///<summary>Verifies if the given object is equal to this one.</summary>
61 public override bool Equals(object obj)
63 var other = obj as Efl.Object;
66 return this.NativeHandle == other.NativeHandle;
68 ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
69 public override int GetHashCode()
71 return this.NativeHandle.ToInt32();
73 ///<summary>Turns the native pointer into a string representation.</summary>
74 public override String ToString()
76 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
78 protected override void register_event_proxies()
80 base.register_event_proxies();
82 /// <summary>Create a socket to provide the service for Plug widget.</summary>
83 /// <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>
84 /// <param name="svcnum">A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name.</param>
85 /// <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>
86 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
87 virtual public bool SocketListen( System.String svcname, int svcnum, bool svcsys) {
88 var _ret_var = Efl.Ui.WinSocketNativeInherit.efl_ui_win_socket_listen_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), svcname, svcnum, svcsys);
89 Eina.Error.RaiseIfUnhandledException();
92 private static new IntPtr GetEflClassStatic()
94 return Efl.Ui.WinSocket.efl_ui_win_socket_class_get();
97 public class WinSocketNativeInherit : Efl.Ui.WinNativeInherit{
98 public new static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Elementary);
99 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
101 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
102 if (efl_ui_win_socket_listen_static_delegate == null)
103 efl_ui_win_socket_listen_static_delegate = new efl_ui_win_socket_listen_delegate(socket_listen);
104 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)});
105 descs.AddRange(base.GetEoOps(type));
108 public override IntPtr GetEflClass()
110 return Efl.Ui.WinSocket.efl_ui_win_socket_class_get();
112 public static new IntPtr GetEflClassStatic()
114 return Efl.Ui.WinSocket.efl_ui_win_socket_class_get();
118 [return: MarshalAs(UnmanagedType.U1)] 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);
121 [return: MarshalAs(UnmanagedType.U1)] 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);
122 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");
123 private static bool socket_listen(System.IntPtr obj, System.IntPtr pd, System.String svcname, int svcnum, bool svcsys)
125 Eina.Log.Debug("function efl_ui_win_socket_listen was called");
126 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
127 if(wrapper != null) {
128 bool _ret_var = default(bool);
130 _ret_var = ((WinSocket)wrapper).SocketListen( svcname, svcnum, svcsys);
131 } catch (Exception e) {
132 Eina.Log.Warning($"Callback error: {e.ToString()}");
133 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
137 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);
140 private static efl_ui_win_socket_listen_delegate efl_ui_win_socket_listen_static_delegate;