#define EFL_BETA #pragma warning disable CS1591 using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Linq; using System.Threading; using System.ComponentModel; namespace Efl { namespace Ui { /// Event argument wrapper for event . [Efl.Eo.BindingEntity] public class AlertPopupButtonClickedEvt_Args : EventArgs { /// Actual event payload. /// Called when alert popup was clicked public Efl.Ui.AlertPopupButtonClickedEvent arg { get; set; } } /// EFL UI Alert Popup class /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. [Efl.Ui.AlertPopup.NativeMethods] [Efl.Eo.BindingEntity] public class AlertPopup : Efl.Ui.Popup { /// Pointer to the native class description. public override System.IntPtr NativeClass { get { if (((object)this).GetType() == typeof(AlertPopup)) { return GetEflClassStatic(); } else { return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()]; } } } [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr efl_ui_alert_popup_class_get(); /// Initializes a new instance of the class. /// Parent instance. /// The widget style to use. See public AlertPopup(Efl.Object parent , System.String style = null) : base(efl_ui_alert_popup_class_get(), parent) { if (Efl.Eo.Globals.ParamHelperCheck(style)) { SetStyle(Efl.Eo.Globals.GetParamHelper(style)); } FinishInstantiation(); } /// Subclasses should override this constructor if they are expected to be instantiated from native code. /// Do not call this constructor directly. /// Tag struct storing the native handle of the object being constructed. protected AlertPopup(ConstructingHandle ch) : base(ch) { } /// Initializes a new instance of the class. /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly. /// The native pointer to be wrapped. protected AlertPopup(Efl.Eo.Globals.WrappingHandle wh) : base(wh) { } /// Initializes a new instance of the class. /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly. /// The pointer to the base native Eo class. /// The Efl.Object parent of this instance. protected AlertPopup(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent) { } /// Called when alert popup was clicked /// public event EventHandler ButtonClickedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { Efl.Ui.AlertPopupButtonClickedEvt_Args args = new Efl.Ui.AlertPopupButtonClickedEvt_Args(); args.arg = evt.Info; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event ButtonClickedEvt. public void OnButtonClickedEvt(Efl.Ui.AlertPopupButtonClickedEvt_Args e) { var key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg)); try { Marshal.StructureToPtr(e.arg, info, false); Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info); } finally { Marshal.FreeHGlobal(info); } } /// Set popup buttons. /// Alert popup button type /// Alert string on button /// Alert icon on button virtual public void SetButton(Efl.Ui.AlertPopupButton type, System.String text, Efl.Object icon) { Efl.Ui.AlertPopup.NativeMethods.efl_ui_alert_popup_button_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),type, text, icon); Eina.Error.RaiseIfUnhandledException(); } /// Set popup buttons. /// Alert popup button type public (Efl.Ui.AlertPopupButton, System.String, Efl.Object) Button { set { SetButton( value.Item1, value.Item2, value.Item3); } } private static IntPtr GetEflClassStatic() { return Efl.Ui.AlertPopup.efl_ui_alert_popup_class_get(); } /// Wrapper for native methods and virtual method delegates. /// For internal use by generated code only. public new class NativeMethods : Efl.Ui.Popup.NativeMethods { private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary); /// Gets the list of Eo operations to override. /// The list of Eo operations to be overload. public override System.Collections.Generic.List GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_ui_alert_popup_button_set_static_delegate == null) { efl_ui_alert_popup_button_set_static_delegate = new efl_ui_alert_popup_button_set_delegate(button_set); } if (methods.FirstOrDefault(m => m.Name == "SetButton") != null) { descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_alert_popup_button_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_alert_popup_button_set_static_delegate) }); } descs.AddRange(base.GetEoOps(type)); return descs; } /// Returns the Eo class for the native methods of this class. /// The native class pointer. public override IntPtr GetEflClass() { return Efl.Ui.AlertPopup.efl_ui_alert_popup_class_get(); } #pragma warning disable CA1707, CS1591, SA1300, SA1600 private delegate void efl_ui_alert_popup_button_set_delegate(System.IntPtr obj, System.IntPtr pd, Efl.Ui.AlertPopupButton type, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo))] Efl.Object icon); public delegate void efl_ui_alert_popup_button_set_api_delegate(System.IntPtr obj, Efl.Ui.AlertPopupButton type, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo))] Efl.Object icon); public static Efl.Eo.FunctionWrapper efl_ui_alert_popup_button_set_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_alert_popup_button_set"); private static void button_set(System.IntPtr obj, System.IntPtr pd, Efl.Ui.AlertPopupButton type, System.String text, Efl.Object icon) { Eina.Log.Debug("function efl_ui_alert_popup_button_set was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { try { ((AlertPopup)ws.Target).SetButton(type, text, icon); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } else { efl_ui_alert_popup_button_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), type, text, icon); } } private static efl_ui_alert_popup_button_set_delegate efl_ui_alert_popup_button_set_static_delegate; #pragma warning restore CA1707, CS1591, SA1300, SA1600 } } } } #if EFL_BETA #pragma warning disable CS1591 public static class Efl_UiAlertPopup_ExtensionMethods { } #pragma warning restore CS1591 #endif namespace Efl { namespace Ui { /// Defines the type of the alert button. [Efl.Eo.BindingEntity] public enum AlertPopupButton { /// Button having positive meaning. e.g. "Yes" Positive = 0, /// Button having negative meaning. e.g. "No" Negative = 1, /// Button having user-defined meaning. e.g. "Cancel" User = 2, } } } namespace Efl { namespace Ui { /// Information of clicked event [StructLayout(LayoutKind.Sequential)] [Efl.Eo.BindingEntity] public struct AlertPopupButtonClickedEvent { /// Clicked button type /// Defines the type of the alert button. public Efl.Ui.AlertPopupButton Button_type; /// Constructor for AlertPopupButtonClickedEvent. /// Clicked button type; public AlertPopupButtonClickedEvent( Efl.Ui.AlertPopupButton Button_type = default(Efl.Ui.AlertPopupButton) ) { this.Button_type = Button_type; } /// Implicit conversion to the managed representation from a native pointer. /// Native pointer to be converted. public static implicit operator AlertPopupButtonClickedEvent(IntPtr ptr) { var tmp = (AlertPopupButtonClickedEvent.NativeStruct)Marshal.PtrToStructure(ptr, typeof(AlertPopupButtonClickedEvent.NativeStruct)); return tmp; } #pragma warning disable CS1591 /// Internal wrapper for struct AlertPopupButtonClickedEvent. [StructLayout(LayoutKind.Sequential)] public struct NativeStruct { public Efl.Ui.AlertPopupButton Button_type; /// Implicit conversion to the internal/marshalling representation. public static implicit operator AlertPopupButtonClickedEvent.NativeStruct(AlertPopupButtonClickedEvent _external_struct) { var _internal_struct = new AlertPopupButtonClickedEvent.NativeStruct(); _internal_struct.Button_type = _external_struct.Button_type; return _internal_struct; } /// Implicit conversion to the managed representation. public static implicit operator AlertPopupButtonClickedEvent(AlertPopupButtonClickedEvent.NativeStruct _internal_struct) { var _external_struct = new AlertPopupButtonClickedEvent(); _external_struct.Button_type = _internal_struct.Button_type; return _external_struct; } } #pragma warning restore CS1591 } } }