1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
12 ///<summary>Event argument wrapper for event <see cref="Efl.Ui.AlertPopup.ButtonClickedEvt"/>.</summary>
13 [Efl.Eo.BindingEntity]
14 public class AlertPopupButtonClickedEvt_Args : EventArgs {
15 ///<summary>Actual event payload.</summary>
16 public Efl.Ui.AlertPopupButtonClickedEvent arg { get; set; }
18 /// <summary>EFL UI Alert Popup class</summary>
19 [Efl.Ui.AlertPopup.NativeMethods]
20 [Efl.Eo.BindingEntity]
21 public class AlertPopup : Efl.Ui.Popup
23 ///<summary>Pointer to the native class description.</summary>
24 public override System.IntPtr NativeClass
28 if (((object)this).GetType() == typeof(AlertPopup))
30 return GetEflClassStatic();
34 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
39 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
40 efl_ui_alert_popup_class_get();
41 /// <summary>Initializes a new instance of the <see cref="AlertPopup"/> class.</summary>
42 /// <param name="parent">Parent instance.</param>
43 /// <param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle" /></param>
44 public AlertPopup(Efl.Object parent
45 , System.String style = null) : base(efl_ui_alert_popup_class_get(), parent)
47 if (Efl.Eo.Globals.ParamHelperCheck(style))
49 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
52 FinishInstantiation();
55 /// <summary>Constructor to be used when objects are expected to be constructed from native code.</summary>
56 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
57 protected AlertPopup(ConstructingHandle ch) : base(ch)
61 /// <summary>Initializes a new instance of the <see cref="AlertPopup"/> class.
62 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
63 /// <param name="wh">The native pointer to be wrapped.</param>
64 protected AlertPopup(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
68 /// <summary>Initializes a new instance of the <see cref="AlertPopup"/> class.
69 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
70 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
71 /// <param name="parent">The Efl.Object parent of this instance.</param>
72 protected AlertPopup(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
76 /// <summary>Called when alert popup was clicked</summary>
77 public event EventHandler<Efl.Ui.AlertPopupButtonClickedEvt_Args> ButtonClickedEvt
81 lock (eflBindingEventLock)
83 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
85 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
88 Efl.Ui.AlertPopupButtonClickedEvt_Args args = new Efl.Ui.AlertPopupButtonClickedEvt_Args();
92 value?.Invoke(obj, args);
96 Eina.Log.Error(e.ToString());
97 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
102 string key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED";
103 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
109 lock (eflBindingEventLock)
111 string key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED";
112 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
116 ///<summary>Method to raise event ButtonClickedEvt.</summary>
117 public void OnButtonClickedEvt(Efl.Ui.AlertPopupButtonClickedEvt_Args e)
119 var key = "_EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED";
120 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
121 if (desc == IntPtr.Zero)
123 Eina.Log.Error($"Failed to get native event {key}");
127 IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));
130 Marshal.StructureToPtr(e.arg, info, false);
131 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
135 Marshal.FreeHGlobal(info);
138 /// <summary>Set popup buttons.</summary>
139 /// <param name="type">Alert popup button type</param>
140 /// <param name="text">Alert string on button</param>
141 /// <param name="icon">Alert icon on button</param>
142 virtual public void SetButton(Efl.Ui.AlertPopupButton type, System.String text, Efl.Object icon) {
143 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);
144 Eina.Error.RaiseIfUnhandledException();
146 private static IntPtr GetEflClassStatic()
148 return Efl.Ui.AlertPopup.efl_ui_alert_popup_class_get();
150 /// <summary>Wrapper for native methods and virtual method delegates.
151 /// For internal use by generated code only.</summary>
152 public new class NativeMethods : Efl.Ui.Popup.NativeMethods
154 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
155 /// <summary>Gets the list of Eo operations to override.</summary>
156 /// <returns>The list of Eo operations to be overload.</returns>
157 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
159 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
160 var methods = Efl.Eo.Globals.GetUserMethods(type);
162 if (efl_ui_alert_popup_button_set_static_delegate == null)
164 efl_ui_alert_popup_button_set_static_delegate = new efl_ui_alert_popup_button_set_delegate(button_set);
167 if (methods.FirstOrDefault(m => m.Name == "SetButton") != null)
169 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) });
172 descs.AddRange(base.GetEoOps(type));
175 /// <summary>Returns the Eo class for the native methods of this class.</summary>
176 /// <returns>The native class pointer.</returns>
177 public override IntPtr GetEflClass()
179 return Efl.Ui.AlertPopup.efl_ui_alert_popup_class_get();
182 #pragma warning disable CA1707, CS1591, SA1300, SA1600
185 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.Eo.NonOwnTag>))] Efl.Object icon);
188 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.Eo.NonOwnTag>))] Efl.Object icon);
190 public static Efl.Eo.FunctionWrapper<efl_ui_alert_popup_button_set_api_delegate> efl_ui_alert_popup_button_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_alert_popup_button_set_api_delegate>(Module, "efl_ui_alert_popup_button_set");
192 private static void button_set(System.IntPtr obj, System.IntPtr pd, Efl.Ui.AlertPopupButton type, System.String text, Efl.Object icon)
194 Eina.Log.Debug("function efl_ui_alert_popup_button_set was called");
195 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
201 ((AlertPopup)ws.Target).SetButton(type, text, icon);
205 Eina.Log.Warning($"Callback error: {e.ToString()}");
206 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
213 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);
217 private static efl_ui_alert_popup_button_set_delegate efl_ui_alert_popup_button_set_static_delegate;
219 #pragma warning restore CA1707, CS1591, SA1300, SA1600
231 /// <summary>Defines the type of the alert button.</summary>
232 [Efl.Eo.BindingEntity]
233 public enum AlertPopupButton
235 /// <summary>Button having positive meaning. e.g. "Yes"</summary>
237 /// <summary>Button having negative meaning. e.g. "No"</summary>
239 /// <summary>Button having user-defined meaning. e.g. "Cancel"</summary>
251 /// <summary>Information of clicked event</summary>
252 [StructLayout(LayoutKind.Sequential)]
253 [Efl.Eo.BindingEntity]
254 public struct AlertPopupButtonClickedEvent
256 /// <summary>Clicked button type</summary>
257 public Efl.Ui.AlertPopupButton Button_type;
258 ///<summary>Constructor for AlertPopupButtonClickedEvent.</summary>
259 public AlertPopupButtonClickedEvent(
260 Efl.Ui.AlertPopupButton Button_type = default(Efl.Ui.AlertPopupButton) )
262 this.Button_type = Button_type;
265 ///<summary>Implicit conversion to the managed representation from a native pointer.</summary>
266 ///<param name="ptr">Native pointer to be converted.</param>
267 public static implicit operator AlertPopupButtonClickedEvent(IntPtr ptr)
269 var tmp = (AlertPopupButtonClickedEvent.NativeStruct)Marshal.PtrToStructure(ptr, typeof(AlertPopupButtonClickedEvent.NativeStruct));
273 #pragma warning disable CS1591
275 ///<summary>Internal wrapper for struct AlertPopupButtonClickedEvent.</summary>
276 [StructLayout(LayoutKind.Sequential)]
277 public struct NativeStruct
280 public Efl.Ui.AlertPopupButton Button_type;
281 ///<summary>Implicit conversion to the internal/marshalling representation.</summary>
282 public static implicit operator AlertPopupButtonClickedEvent.NativeStruct(AlertPopupButtonClickedEvent _external_struct)
284 var _internal_struct = new AlertPopupButtonClickedEvent.NativeStruct();
285 _internal_struct.Button_type = _external_struct.Button_type;
286 return _internal_struct;
289 ///<summary>Implicit conversion to the managed representation.</summary>
290 public static implicit operator AlertPopupButtonClickedEvent(AlertPopupButtonClickedEvent.NativeStruct _internal_struct)
292 var _external_struct = new AlertPopupButtonClickedEvent();
293 _external_struct.Button_type = _internal_struct.Button_type;
294 return _external_struct;
299 #pragma warning restore CS1591