1e4b51619ae356de5f89be1e31c0b479b3282668
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_canvas_pointer.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 namespace Canvas {
11
12 /// <summary>Efl Canvas Pointer interface
13 /// (Since EFL 1.22)</summary>
14 [Efl.Canvas.IPointerConcrete.NativeMethods]
15 public interface IPointer : 
16     Efl.Eo.IWrapper, IDisposable
17 {
18     /// <summary>Returns whether the mouse pointer is logically inside the canvas.
19 /// When this function is called it will return a value of either <c>false</c> or <c>true</c>, depending on whether a pointer,in or pointer,out event has been called previously.
20 /// 
21 /// A return value of <c>true</c> indicates the mouse is logically inside the canvas, and <c>false</c> implies it is logically outside the canvas.
22 /// 
23 /// A canvas begins with the mouse being assumed outside (<c>false</c>).
24 /// (Since EFL 1.22)</summary>
25 /// <param name="seat">The seat to consider, if <c>null</c> then the default seat will be used.</param>
26 /// <returns><c>true</c> if the mouse pointer is inside the canvas, <c>false</c> otherwise</returns>
27 bool GetPointerInside(Efl.Input.Device seat);
28     }
29 /// <summary>Efl Canvas Pointer interface
30 /// (Since EFL 1.22)</summary>
31 sealed public class IPointerConcrete : 
32
33 IPointer
34     
35 {
36     ///<summary>Pointer to the native class description.</summary>
37     public System.IntPtr NativeClass
38     {
39         get
40         {
41             if (((object)this).GetType() == typeof(IPointerConcrete))
42             {
43                 return GetEflClassStatic();
44             }
45             else
46             {
47                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
48             }
49         }
50     }
51
52     private  System.IntPtr handle;
53     ///<summary>Pointer to the native instance.</summary>
54     public System.IntPtr NativeHandle
55     {
56         get { return handle; }
57     }
58
59     [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
60         efl_canvas_pointer_interface_get();
61     /// <summary>Initializes a new instance of the <see cref="IPointer"/> class.
62     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
63     private IPointerConcrete(System.IntPtr raw)
64     {
65         handle = raw;
66     }
67     ///<summary>Destructor.</summary>
68     ~IPointerConcrete()
69     {
70         Dispose(false);
71     }
72
73     ///<summary>Releases the underlying native instance.</summary>
74     private void Dispose(bool disposing)
75     {
76         if (handle != System.IntPtr.Zero)
77         {
78             IntPtr h = handle;
79             handle = IntPtr.Zero;
80
81             IntPtr gcHandlePtr = IntPtr.Zero;
82             if (disposing)
83             {
84                 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
85             }
86             else
87             {
88                 Monitor.Enter(Efl.All.InitLock);
89                 if (Efl.All.MainLoopInitialized)
90                 {
91                     Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
92                 }
93
94                 Monitor.Exit(Efl.All.InitLock);
95             }
96         }
97
98     }
99
100     ///<summary>Releases the underlying native instance.</summary>
101     public void Dispose()
102     {
103         Dispose(true);
104         GC.SuppressFinalize(this);
105     }
106
107     /// <summary>Verifies if the given object is equal to this one.</summary>
108     /// <param name="instance">The object to compare to.</param>
109     /// <returns>True if both objects point to the same native object.</returns>
110     public override bool Equals(object instance)
111     {
112         var other = instance as Efl.Object;
113         if (other == null)
114         {
115             return false;
116         }
117         return this.NativeHandle == other.NativeHandle;
118     }
119
120     /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
121     /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
122     public override int GetHashCode()
123     {
124         return this.NativeHandle.ToInt32();
125     }
126
127     /// <summary>Turns the native pointer into a string representation.</summary>
128     /// <returns>A string with the type and the native pointer for this object.</returns>
129     public override String ToString()
130     {
131         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
132     }
133
134     /// <summary>Returns whether the mouse pointer is logically inside the canvas.
135     /// When this function is called it will return a value of either <c>false</c> or <c>true</c>, depending on whether a pointer,in or pointer,out event has been called previously.
136     /// 
137     /// A return value of <c>true</c> indicates the mouse is logically inside the canvas, and <c>false</c> implies it is logically outside the canvas.
138     /// 
139     /// A canvas begins with the mouse being assumed outside (<c>false</c>).
140     /// (Since EFL 1.22)</summary>
141     /// <param name="seat">The seat to consider, if <c>null</c> then the default seat will be used.</param>
142     /// <returns><c>true</c> if the mouse pointer is inside the canvas, <c>false</c> otherwise</returns>
143     public bool GetPointerInside(Efl.Input.Device seat) {
144                                  var _ret_var = Efl.Canvas.IPointerConcrete.NativeMethods.efl_canvas_pointer_inside_get_ptr.Value.Delegate(this.NativeHandle,seat);
145         Eina.Error.RaiseIfUnhandledException();
146                         return _ret_var;
147  }
148     private static IntPtr GetEflClassStatic()
149     {
150         return Efl.Canvas.IPointerConcrete.efl_canvas_pointer_interface_get();
151     }
152     /// <summary>Wrapper for native methods and virtual method delegates.
153     /// For internal use by generated code only.</summary>
154     public class NativeMethods  : Efl.Eo.NativeClass
155     {
156         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
157         /// <summary>Gets the list of Eo operations to override.</summary>
158         /// <returns>The list of Eo operations to be overload.</returns>
159         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
160         {
161             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
162             var methods = Efl.Eo.Globals.GetUserMethods(type);
163
164             if (efl_canvas_pointer_inside_get_static_delegate == null)
165             {
166                 efl_canvas_pointer_inside_get_static_delegate = new efl_canvas_pointer_inside_get_delegate(pointer_inside_get);
167             }
168
169             if (methods.FirstOrDefault(m => m.Name == "GetPointerInside") != null)
170             {
171                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_canvas_pointer_inside_get"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_pointer_inside_get_static_delegate) });
172             }
173
174             return descs;
175         }
176         /// <summary>Returns the Eo class for the native methods of this class.</summary>
177         /// <returns>The native class pointer.</returns>
178         public override IntPtr GetEflClass()
179         {
180             return Efl.Canvas.IPointerConcrete.efl_canvas_pointer_interface_get();
181         }
182
183         #pragma warning disable CA1707, SA1300, SA1600
184
185         [return: MarshalAs(UnmanagedType.U1)]
186         private delegate bool efl_canvas_pointer_inside_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Input.Device seat);
187
188         [return: MarshalAs(UnmanagedType.U1)]
189         public delegate bool efl_canvas_pointer_inside_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Input.Device seat);
190
191         public static Efl.Eo.FunctionWrapper<efl_canvas_pointer_inside_get_api_delegate> efl_canvas_pointer_inside_get_ptr = new Efl.Eo.FunctionWrapper<efl_canvas_pointer_inside_get_api_delegate>(Module, "efl_canvas_pointer_inside_get");
192
193         private static bool pointer_inside_get(System.IntPtr obj, System.IntPtr pd, Efl.Input.Device seat)
194         {
195             Eina.Log.Debug("function efl_canvas_pointer_inside_get was called");
196             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
197             if (wrapper != null)
198             {
199                                     bool _ret_var = default(bool);
200                 try
201                 {
202                     _ret_var = ((IPointer)wrapper).GetPointerInside(seat);
203                 }
204                 catch (Exception e)
205                 {
206                     Eina.Log.Warning($"Callback error: {e.ToString()}");
207                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
208                 }
209
210                         return _ret_var;
211
212             }
213             else
214             {
215                 return efl_canvas_pointer_inside_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), seat);
216             }
217         }
218
219         private static efl_canvas_pointer_inside_get_delegate efl_canvas_pointer_inside_get_static_delegate;
220
221         #pragma warning restore CA1707, SA1300, SA1600
222
223 }
224 }
225 }
226
227 }
228