/// <summary>Set a filter function that will catch children from the composited model.</summary> /// <param name="filter">Filter callback</param> virtual public void SetFilter(EflFilterModel filter) { GCHandle filter_handle = GCHandle.Alloc(filter); Efl.FilterModel.NativeMethods.efl_filter_model_filter_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)), GCHandle.ToIntPtr(filter_handle), EflFilterModelWrapper.Cb, Efl.Eo.Globals.free_gchandle); Eina.Error.RaiseIfUnhandledException(); }
[return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Eina.FutureMarshaler))] internal static Eina.Future Cb(IntPtr cb_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Efl.Eo.MarshalEo <Efl.Eo.NonOwnTag>))] Efl.FilterModel parent, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Efl.Eo.MarshalEo <Efl.Eo.NonOwnTag>))] Efl.IModel child) { GCHandle handle = GCHandle.FromIntPtr(cb_data); EflFilterModel cb = (EflFilterModel)handle.Target; Eina.Future _ret_var = default(Eina.Future); try { _ret_var = cb(parent, child); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } return(_ret_var); }
/// <summary>Initializes a new instance of the <see cref="FilterModel"/> class.</summary> /// <param name="parent">Parent instance.</param> /// <param name="filterSet">Set a filter function that will catch children from the composited model. See <see cref="Efl.FilterModel.SetFilter" /></param> /// <param name="model">Model that is/will be See <see cref="Efl.Ui.IView.SetModel" /></param> /// <param name="index">Position of this object in the parent model. See <see cref="Efl.CompositeModel.SetIndex" /></param> public FilterModel(Efl.Object parent , EflFilterModel filterSet, Efl.IModel model, uint?index = null) : base(efl_filter_model_class_get(), parent) { if (Efl.Eo.Globals.ParamHelperCheck(filterSet)) { SetFilter(Efl.Eo.Globals.GetParamHelper(filterSet)); } if (Efl.Eo.Globals.ParamHelperCheck(model)) { SetModel(Efl.Eo.Globals.GetParamHelper(model)); } if (Efl.Eo.Globals.ParamHelperCheck(index)) { SetIndex(Efl.Eo.Globals.GetParamHelper(index)); } FinishInstantiation(); }