1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.ComponentModel;
7 namespace Efl { namespace Canvas {
8 /// <summary>Represents a SWALLOW part of an Edje object.
9 /// Its lifetime is limited to one function call only, unless an extra reference is explicitely held.</summary>
10 [LayoutPartSwallowNativeInherit]
11 public class LayoutPartSwallow : Efl.Canvas.LayoutPart, Efl.Eo.IWrapper,Efl.Content
13 public new static System.IntPtr klass = System.IntPtr.Zero;
14 public new static Efl.Canvas.LayoutPartSwallowNativeInherit nativeInherit = new Efl.Canvas.LayoutPartSwallowNativeInherit();
15 ///<summary>Pointer to the native class description.</summary>
16 public override System.IntPtr NativeClass {
18 if (((object)this).GetType() == typeof (LayoutPartSwallow))
19 return Efl.Canvas.LayoutPartSwallowNativeInherit.GetEflClassStatic();
21 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
24 [System.Runtime.InteropServices.DllImport(efl.Libs.Edje)] internal static extern System.IntPtr
25 efl_canvas_layout_part_swallow_class_get();
26 ///<summary>Creates a new instance.</summary>
27 ///<param name="parent">Parent instance.</param>
28 public LayoutPartSwallow(Efl.Object parent= null
30 base(efl_canvas_layout_part_swallow_class_get(), typeof(LayoutPartSwallow), parent)
32 FinishInstantiation();
34 ///<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>
35 public LayoutPartSwallow(System.IntPtr raw) : base(raw)
37 register_event_proxies();
39 ///<summary>Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
40 protected LayoutPartSwallow(IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(base_klass, managed_type, parent) {}
41 ///<summary>Casts obj into an instance of this type.</summary>
42 public new static LayoutPartSwallow static_cast(Efl.Object obj)
45 throw new System.ArgumentNullException("obj");
46 return new LayoutPartSwallow(obj.NativeHandle);
48 ///<summary>Verifies if the given object is equal to this one.</summary>
49 public override bool Equals(object obj)
51 var other = obj as Efl.Object;
54 return this.NativeHandle == other.NativeHandle;
56 ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
57 public override int GetHashCode()
59 return this.NativeHandle.ToInt32();
61 ///<summary>Turns the native pointer into a string representation.</summary>
62 public override String ToString()
64 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
66 private static object ContentChangedEvtKey = new object();
67 /// <summary>Sent after the content is set or unset using the current content object.</summary>
68 public event EventHandler<Efl.ContentContentChangedEvt_Args> ContentChangedEvt
72 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
73 if (add_cpp_event_handler(efl.Libs.Efl, key, this.evt_ContentChangedEvt_delegate)) {
74 eventHandlers.AddHandler(ContentChangedEvtKey , value);
76 Eina.Log.Error($"Error adding proxy for event {key}");
81 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
82 if (remove_cpp_event_handler(key, this.evt_ContentChangedEvt_delegate)) {
83 eventHandlers.RemoveHandler(ContentChangedEvtKey , value);
85 Eina.Log.Error($"Error removing proxy for event {key}");
89 ///<summary>Method to raise event ContentChangedEvt.</summary>
90 public void On_ContentChangedEvt(Efl.ContentContentChangedEvt_Args e)
92 EventHandler<Efl.ContentContentChangedEvt_Args> evt;
94 evt = (EventHandler<Efl.ContentContentChangedEvt_Args>)eventHandlers[ContentChangedEvtKey];
98 Efl.EventCb evt_ContentChangedEvt_delegate;
99 private void on_ContentChangedEvt_NativeCallback(System.IntPtr data, ref Efl.Event_StructInternal evt)
101 Efl.ContentContentChangedEvt_Args args = new Efl.ContentContentChangedEvt_Args();
102 args.arg = new Efl.Gfx.EntityConcrete(evt.Info);
104 On_ContentChangedEvt(args);
105 } catch (Exception e) {
106 Eina.Log.Error(e.ToString());
107 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
111 protected override void register_event_proxies()
113 base.register_event_proxies();
114 evt_ContentChangedEvt_delegate = new Efl.EventCb(on_ContentChangedEvt_NativeCallback);
116 /// <summary>Swallowed sub-object contained in this object.</summary>
117 /// <returns>The object to swallow.</returns>
118 virtual public Efl.Gfx.Entity GetContent() {
119 var _ret_var = Efl.ContentNativeInherit.efl_content_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
120 Eina.Error.RaiseIfUnhandledException();
123 /// <summary>Swallowed sub-object contained in this object.</summary>
124 /// <param name="content">The object to swallow.</param>
125 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
126 virtual public bool SetContent( Efl.Gfx.Entity content) {
127 var _ret_var = Efl.ContentNativeInherit.efl_content_set_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), content);
128 Eina.Error.RaiseIfUnhandledException();
131 /// <summary>Unswallow the object in the current container and return it.</summary>
132 /// <returns>Unswallowed object</returns>
133 virtual public Efl.Gfx.Entity UnsetContent() {
134 var _ret_var = Efl.ContentNativeInherit.efl_content_unset_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
135 Eina.Error.RaiseIfUnhandledException();
138 /// <summary>Swallowed sub-object contained in this object.</summary>
139 /// <value>The object to swallow.</value>
140 public Efl.Gfx.Entity Content {
141 get { return GetContent(); }
142 set { SetContent( value); }
144 private static new IntPtr GetEflClassStatic()
146 return Efl.Canvas.LayoutPartSwallow.efl_canvas_layout_part_swallow_class_get();
149 public class LayoutPartSwallowNativeInherit : Efl.Canvas.LayoutPartNativeInherit{
150 public new static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Edje);
151 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
153 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
154 if (efl_content_get_static_delegate == null)
155 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
156 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_content_get"), func = Marshal.GetFunctionPointerForDelegate(efl_content_get_static_delegate)});
157 if (efl_content_set_static_delegate == null)
158 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
159 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_content_set"), func = Marshal.GetFunctionPointerForDelegate(efl_content_set_static_delegate)});
160 if (efl_content_unset_static_delegate == null)
161 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
162 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_content_unset"), func = Marshal.GetFunctionPointerForDelegate(efl_content_unset_static_delegate)});
163 descs.AddRange(base.GetEoOps(type));
166 public override IntPtr GetEflClass()
168 return Efl.Canvas.LayoutPartSwallow.efl_canvas_layout_part_swallow_class_get();
170 public static new IntPtr GetEflClassStatic()
172 return Efl.Canvas.LayoutPartSwallow.efl_canvas_layout_part_swallow_class_get();
176 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] private delegate Efl.Gfx.Entity efl_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
179 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] public delegate Efl.Gfx.Entity efl_content_get_api_delegate(System.IntPtr obj);
180 public static Efl.Eo.FunctionWrapper<efl_content_get_api_delegate> efl_content_get_ptr = new Efl.Eo.FunctionWrapper<efl_content_get_api_delegate>(_Module, "efl_content_get");
181 private static Efl.Gfx.Entity content_get(System.IntPtr obj, System.IntPtr pd)
183 Eina.Log.Debug("function efl_content_get was called");
184 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
185 if(wrapper != null) {
186 Efl.Gfx.Entity _ret_var = default(Efl.Gfx.Entity);
188 _ret_var = ((LayoutPartSwallow)wrapper).GetContent();
189 } catch (Exception e) {
190 Eina.Log.Warning($"Callback error: {e.ToString()}");
191 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
195 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
198 private static efl_content_get_delegate efl_content_get_static_delegate;
201 [return: MarshalAs(UnmanagedType.U1)] private delegate bool efl_content_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] Efl.Gfx.Entity content);
204 [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_content_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] Efl.Gfx.Entity content);
205 public static Efl.Eo.FunctionWrapper<efl_content_set_api_delegate> efl_content_set_ptr = new Efl.Eo.FunctionWrapper<efl_content_set_api_delegate>(_Module, "efl_content_set");
206 private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.Entity content)
208 Eina.Log.Debug("function efl_content_set was called");
209 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
210 if(wrapper != null) {
211 bool _ret_var = default(bool);
213 _ret_var = ((LayoutPartSwallow)wrapper).SetContent( content);
214 } catch (Exception e) {
215 Eina.Log.Warning($"Callback error: {e.ToString()}");
216 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
220 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
223 private static efl_content_set_delegate efl_content_set_static_delegate;
226 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] private delegate Efl.Gfx.Entity efl_content_unset_delegate(System.IntPtr obj, System.IntPtr pd);
229 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.Gfx.EntityConcrete, Efl.Eo.NonOwnTag>))] public delegate Efl.Gfx.Entity efl_content_unset_api_delegate(System.IntPtr obj);
230 public static Efl.Eo.FunctionWrapper<efl_content_unset_api_delegate> efl_content_unset_ptr = new Efl.Eo.FunctionWrapper<efl_content_unset_api_delegate>(_Module, "efl_content_unset");
231 private static Efl.Gfx.Entity content_unset(System.IntPtr obj, System.IntPtr pd)
233 Eina.Log.Debug("function efl_content_unset was called");
234 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
235 if(wrapper != null) {
236 Efl.Gfx.Entity _ret_var = default(Efl.Gfx.Entity);
238 _ret_var = ((LayoutPartSwallow)wrapper).UnsetContent();
239 } catch (Exception e) {
240 Eina.Log.Warning($"Callback error: {e.ToString()}");
241 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
245 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
248 private static efl_content_unset_delegate efl_content_unset_static_delegate;