1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.ComponentModel;
8 /// <summary>Efl text interface</summary>
10 public interface Text :
11 Efl.Eo.IWrapper, IDisposable
13 /// <summary>Retrieves the text string currently being displayed by the given text object.
14 /// Do not free() the return value.
16 /// See also <see cref="Efl.Text.GetText"/>.</summary>
17 /// <returns>Text string to display on it.</returns>
18 System.String GetText();
19 /// <summary>Sets the text string to be displayed by the given text object.
20 /// See also <see cref="Efl.Text.GetText"/>.</summary>
21 /// <param name="text">Text string to display on it.</param>
22 /// <returns></returns>
23 void SetText( System.String text);
25 /// <summary>Efl text interface</summary>
26 sealed public class TextConcrete :
31 ///<summary>Pointer to the native class description.</summary>
32 public System.IntPtr NativeClass {
34 if (((object)this).GetType() == typeof (TextConcrete))
35 return Efl.TextNativeInherit.GetEflClassStatic();
37 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
40 private System.IntPtr handle;
41 ///<summary>Pointer to the native instance.</summary>
42 public System.IntPtr NativeHandle {
43 get { return handle; }
45 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
46 efl_text_interface_get();
47 ///<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>
48 public TextConcrete(System.IntPtr raw)
51 register_event_proxies();
53 ///<summary>Destructor.</summary>
58 ///<summary>Releases the underlying native instance.</summary>
59 void Dispose(bool disposing)
61 if (handle != System.IntPtr.Zero) {
62 Efl.Eo.Globals.efl_unref(handle);
63 handle = System.IntPtr.Zero;
66 ///<summary>Releases the underlying native instance.</summary>
70 GC.SuppressFinalize(this);
72 ///<summary>Casts obj into an instance of this type.</summary>
73 public static TextConcrete static_cast(Efl.Object obj)
76 throw new System.ArgumentNullException("obj");
77 return new TextConcrete(obj.NativeHandle);
79 ///<summary>Verifies if the given object is equal to this one.</summary>
80 public override bool Equals(object obj)
82 var other = obj as Efl.Object;
85 return this.NativeHandle == other.NativeHandle;
87 ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
88 public override int GetHashCode()
90 return this.NativeHandle.ToInt32();
92 ///<summary>Turns the native pointer into a string representation.</summary>
93 public override String ToString()
95 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
97 void register_event_proxies()
100 /// <summary>Retrieves the text string currently being displayed by the given text object.
101 /// Do not free() the return value.
103 /// See also <see cref="Efl.Text.GetText"/>.</summary>
104 /// <returns>Text string to display on it.</returns>
105 public System.String GetText() {
106 var _ret_var = Efl.TextNativeInherit.efl_text_get_ptr.Value.Delegate(this.NativeHandle);
107 Eina.Error.RaiseIfUnhandledException();
110 /// <summary>Sets the text string to be displayed by the given text object.
111 /// See also <see cref="Efl.Text.GetText"/>.</summary>
112 /// <param name="text">Text string to display on it.</param>
113 /// <returns></returns>
114 public void SetText( System.String text) {
115 Efl.TextNativeInherit.efl_text_set_ptr.Value.Delegate(this.NativeHandle, text);
116 Eina.Error.RaiseIfUnhandledException();
119 public class TextNativeInherit : Efl.Eo.NativeClass{
120 public static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Efl);
121 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
123 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
124 if (efl_text_get_static_delegate == null)
125 efl_text_get_static_delegate = new efl_text_get_delegate(text_get);
126 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_text_get"), func = Marshal.GetFunctionPointerForDelegate(efl_text_get_static_delegate)});
127 if (efl_text_set_static_delegate == null)
128 efl_text_set_static_delegate = new efl_text_set_delegate(text_set);
129 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_text_set"), func = Marshal.GetFunctionPointerForDelegate(efl_text_set_static_delegate)});
132 public override IntPtr GetEflClass()
134 return Efl.TextConcrete.efl_text_interface_get();
136 public static IntPtr GetEflClassStatic()
138 return Efl.TextConcrete.efl_text_interface_get();
142 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] private delegate System.String efl_text_get_delegate(System.IntPtr obj, System.IntPtr pd);
145 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] public delegate System.String efl_text_get_api_delegate(System.IntPtr obj);
146 public static Efl.Eo.FunctionWrapper<efl_text_get_api_delegate> efl_text_get_ptr = new Efl.Eo.FunctionWrapper<efl_text_get_api_delegate>(_Module, "efl_text_get");
147 private static System.String text_get(System.IntPtr obj, System.IntPtr pd)
149 Eina.Log.Debug("function efl_text_get was called");
150 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
151 if(wrapper != null) {
152 System.String _ret_var = default( System.String);
154 _ret_var = ((Text)wrapper).GetText();
155 } catch (Exception e) {
156 Eina.Log.Warning($"Callback error: {e.ToString()}");
157 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
161 return efl_text_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
164 private static efl_text_get_delegate efl_text_get_static_delegate;
167 private delegate void efl_text_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text);
170 public delegate void efl_text_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text);
171 public static Efl.Eo.FunctionWrapper<efl_text_set_api_delegate> efl_text_set_ptr = new Efl.Eo.FunctionWrapper<efl_text_set_api_delegate>(_Module, "efl_text_set");
172 private static void text_set(System.IntPtr obj, System.IntPtr pd, System.String text)
174 Eina.Log.Debug("function efl_text_set was called");
175 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
176 if(wrapper != null) {
179 ((Text)wrapper).SetText( text);
180 } catch (Exception e) {
181 Eina.Log.Warning($"Callback error: {e.ToString()}");
182 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
185 efl_text_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), text);
188 private static efl_text_set_delegate efl_text_set_static_delegate;