[EflSharp] Introduce EflSharp project (#749)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / workaround.cs
1 #pragma warning disable 1591
2
3 using System;
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
6
7 ///<summary>Eo class description, passed to efl_class_new.</summary>
8 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
9 public struct ClassDescription
10 {
11     ///<summary>Current Eo version.</summary>
12     public uint version;
13     ///<summary>Name of the class.</summary>
14     [MarshalAs(UnmanagedType.LPStr)] public String name;
15     ///<summary>Class type.</summary>
16     public int class_type;
17     ///<summary>Size of data (private + protected + public) per instance.</summary>
18     public UIntPtr data_size;
19     ///<summary>Initializer for the class.</summary>
20     public IntPtr class_initializer;
21     ///<summary>Constructor of the class.</summary>
22     public IntPtr class_constructor;
23     ///<summary>Destructor of the class.</summary>
24     public IntPtr class_destructor;
25 }
26
27 ///<summary>Description of an Eo API operation.</summary>
28 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
29 public struct Efl_Op_Description
30 {
31     ///<summary>The EAPI function offering this op. (String with the name of the function on Windows)</summary>
32     public IntPtr api_func;
33     ///<summary>The static function to be called for this op</summary>
34     public IntPtr func;
35 }
36
37 ///<summary>List of operations on a given Object.</summary>
38 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
39 public struct Efl_Object_Ops
40 {
41     ///<summary>The op descriptions array of size count.</summary>
42     public IntPtr descs;
43     ///<summary>Number of op descriptions.</summary>
44     public UIntPtr count;
45 };
46
47 [StructLayout(LayoutKind.Sequential)]
48 public struct EolianPD
49 {
50     public IntPtr pointer;
51 }
52
53 #pragma warning disable 0169
54 public struct EvasObjectBoxLayout
55 {
56     IntPtr o;
57     IntPtr priv;
58     IntPtr user_data;
59 };
60 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
61 public struct EvasObjectBoxData
62 {
63 }
64 public struct EvasObjectBoxOption {
65     IntPtr obj;
66     [MarshalAsAttribute(UnmanagedType.U1)] bool max_reached;
67     [MarshalAsAttribute(UnmanagedType.U1)] bool min_reached;
68     Evas.Coord alloc_size;
69 };
70 #pragma warning restore 0169
71
72 namespace Efl {
73
74 [StructLayout(LayoutKind.Sequential)]
75 public struct EventDescription {
76     public IntPtr Name;
77     [MarshalAs(UnmanagedType.U1)] public bool Unfreezable;
78     [MarshalAs(UnmanagedType.U1)] public bool Legacy_is;
79     [MarshalAs(UnmanagedType.U1)] public bool Restart;
80
81     private static Dictionary<string, IntPtr> descriptions = new Dictionary<string, IntPtr>();
82
83     public EventDescription(string module, string name)
84     {
85         this.Name = GetNative(module, name);
86         this.Unfreezable = false;
87         this.Legacy_is = false;
88         this.Restart = false;
89     }
90
91     public static IntPtr GetNative(string module, string name)
92     {
93         if (!descriptions.ContainsKey(name))
94         {
95             IntPtr data = Efl.Eo.FunctionInterop.LoadFunctionPointer(module, name);
96
97             if (data == IntPtr.Zero) {
98                 string error = Eina.StringConversion.NativeUtf8ToManagedString(Efl.Eo.Globals.dlerror());
99                 throw new Exception(error);
100             }
101             descriptions.Add(name, data);
102         }
103         return descriptions[name];
104     }
105 };
106
107 public delegate void EventCb(System.IntPtr data, ref Event_StructInternal evt);
108
109 [StructLayout(LayoutKind.Sequential)]
110 public struct TextCursorCursor {
111     IntPtr obj;
112     UIntPtr pos; // UIntPtr to automatically change size_t between 32/64
113     IntPtr node;
114     [MarshalAsAttribute(UnmanagedType.U1)]bool changed;
115 }
116
117 [StructLayout(LayoutKind.Sequential)]
118 public struct TextAnnotateAnnotation {
119     IntPtr list;
120     IntPtr obj;
121     IntPtr start_node;
122     IntPtr end_node;
123     [MarshalAsAttribute(UnmanagedType.U1)]bool is_item;
124 }
125
126 public delegate void SignalCb(IntPtr data, IntPtr obj, IntPtr emission, IntPtr source);
127
128 namespace Access {
129
130 public delegate IntPtr ReadingInfoCb(System.IntPtr data, ref Efl.Canvas.Object obj);
131
132 public delegate bool GestureCb(System.IntPtr data, ref Efl.Access.GestureInfo info, ref Efl.Canvas.Object obj);
133
134 public struct ReadingInfoTypeMask {
135     private uint mask;
136
137     public static implicit operator ReadingInfoTypeMask(uint x)
138     {
139         return new ReadingInfoTypeMask{mask=x};
140     }
141     public static implicit operator uint(ReadingInfoTypeMask x)
142     {
143         return x.mask;
144     }
145 }
146
147 public struct ActionData {
148     public IntPtr name;
149     public IntPtr action;
150     public IntPtr param;
151     public IntPtr func;
152 }
153
154 } // namespace Access
155
156 } // namespace Efl
157
158 namespace Evas {
159
160 public struct Coord {
161     int val;
162
163     public Coord(int value) { val = value; }
164     static public implicit operator Coord(int val) {
165         return new Coord(val);
166     }
167     static public implicit operator int(Coord coord) {
168         return coord.val;
169     }
170 }
171
172 /* Copied from Evas_Legacy.h */
173 public enum TextStyleType
174 {
175    ///<summary> plain, standard text.</summary>
176    Plain = 0,
177    ///<summary> text with shadow underneath.</summary>
178    Shadow,
179    ///<summary> text with an outline.</summary>
180    Outline,
181    ///<summary> text with a soft outline.</summary>
182    SoftOutline,
183    ///<summary> text with a glow effect.</summary>
184    Glow,
185    ///<summary> text with both outline and shadow effects.</summary>
186    OutlineShadow,
187    ///<summary> text with (far) shadow underneath.</summary>
188    FarShadow,
189    ///<summary> text with outline and soft shadow effects combined.</summary>
190    OutlineSoftShadow,
191    ///<summary> text with (soft) shadow underneath.</summary>
192    SoftShadow,
193    ///<summary> text with (far soft) shadow underneath.</summary>
194    FarSoftShadow,
195
196    // Shadow direction modifiers
197    ///<summary> shadow growing to bottom right.</summary>
198    ShadowDirectionBottomRight = 0 /* 0 >> 4 */,
199   ///<summary> shadow growing to the bottom.</summary>
200    ShadowDirectionBottom= 16 /* 1 >> 4 */,
201    ///<summary> shadow growing to bottom left.</summary>
202    ShadowDirectionBottomLeft = 32 /* 2 >> 4 */,
203    ///<summary> shadow growing to the left.</summary>
204    ShadowDirectionLeft = 48 /* 3 >> 4 */,
205    ///<summary> shadow growing to top left.</summary>
206    ShadowDirectionTopLeft = 64 /* 4 >> 4 */,
207    ///<summary> shadow growing to the top.</summary>
208    ShadowDirectionTop = 80 /* 5 >> 4 */,
209    ///<summary> shadow growing to top right.</summary>
210    ShadowDirectionTopRight = 96 /* 6 >> 4 */,
211    ///<summary> shadow growing to the right.</summary>
212    ShadowDirectionRight = 112 /* 7 >> 4 */
213 };
214
215 } // namespace Evas
216
217 // Global delegates
218 public delegate int Eina_Compare_Cb(IntPtr a, IntPtr b);
219 public delegate void ElmInterfaceScrollableCb(IntPtr obj, IntPtr data);
220 public delegate void ElmInterfaceScrollableMinLimitCb(IntPtr obj,
221                                                      [MarshalAsAttribute(UnmanagedType.U1)]bool w,
222                                                      [MarshalAsAttribute(UnmanagedType.U1)]bool h);
223 public delegate void ElmInterfaceScrollableResizeCb(IntPtr obj, Evas.Coord w, Evas.Coord h);
224 [return: MarshalAsAttribute(UnmanagedType.U1)]
225 public delegate bool ElmMultibuttonentryItemFilterCb(IntPtr obj, IntPtr item_label, IntPtr item_data, IntPtr data);
226 public delegate IntPtr ElmMultibuttonentryFormatCb(int count, IntPtr data);
227 public delegate void EinaFreeCb(IntPtr data);
228 public delegate void EvasSmartCb(IntPtr data, IntPtr obj, IntPtr event_info);
229 public delegate void ElmObjectItemSignalCb(IntPtr data, IntPtr item, IntPtr emission, IntPtr source);
230 public delegate void ElmTooltipItemContentCb(IntPtr data, IntPtr obj, IntPtr tooltip, IntPtr item);