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>Check widget
13 /// The check widget allows for toggling a value between true and false. Check objects are a lot like radio objects in layout and functionality, except they do not work as a group, but independently, and only toggle the value of a boolean between false and true.</summary>
14 [Efl.Ui.Check.NativeMethods]
15 public class Check : Efl.Ui.Nstate, Efl.Eo.IWrapper
17 ///<summary>Pointer to the native class description.</summary>
18 public override System.IntPtr NativeClass
22 if (((object)this).GetType() == typeof(Check))
24 return GetEflClassStatic();
28 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
33 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
34 efl_ui_check_class_get();
35 /// <summary>Initializes a new instance of the <see cref="Check"/> class.</summary>
36 /// <param name="parent">Parent instance.</param>
37 /// <param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle"/></param>
38 public Check(Efl.Object parent
39 , System.String style = null) : base(efl_ui_check_class_get(), typeof(Check), parent)
41 if (Efl.Eo.Globals.ParamHelperCheck(style))
43 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
46 FinishInstantiation();
49 /// <summary>Initializes a new instance of the <see cref="Check"/> class.
50 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
51 /// <param name="raw">The native pointer to be wrapped.</param>
52 protected Check(System.IntPtr raw) : base(raw)
56 /// <summary>Initializes a new instance of the <see cref="Check"/> class.
57 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
58 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
59 /// <param name="managedType">The managed type of the public constructor that originated this call.</param>
60 /// <param name="parent">The Efl.Object parent of this instance.</param>
61 protected Check(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)
65 /// <summary>Verifies if the given object is equal to this one.</summary>
66 /// <param name="instance">The object to compare to.</param>
67 /// <returns>True if both objects point to the same native object.</returns>
68 public override bool Equals(object instance)
70 var other = instance as Efl.Object;
75 return this.NativeHandle == other.NativeHandle;
78 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
79 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
80 public override int GetHashCode()
82 return this.NativeHandle.ToInt32();
85 /// <summary>Turns the native pointer into a string representation.</summary>
86 /// <returns>A string with the type and the native pointer for this object.</returns>
87 public override String ToString()
89 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
92 /// <summary>The on/off state of the check object.</summary>
93 /// <returns><c>true</c> if the check object is selected, <c>false</c> otherwise</returns>
94 virtual public bool GetSelected() {
95 var _ret_var = Efl.Ui.Check.NativeMethods.efl_ui_check_selected_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
96 Eina.Error.RaiseIfUnhandledException();
99 /// <summary>The on/off state of the check object.</summary>
100 /// <param name="value"><c>true</c> if the check object is selected, <c>false</c> otherwise</param>
101 virtual public void SetSelected(bool value) {
102 Efl.Ui.Check.NativeMethods.efl_ui_check_selected_set_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),value);
103 Eina.Error.RaiseIfUnhandledException();
105 /// <summary>The on/off state of the check object.</summary>
106 /// <value><c>true</c> if the check object is selected, <c>false</c> otherwise</value>
107 public bool Selected {
108 get { return GetSelected(); }
109 set { SetSelected(value); }
111 private static IntPtr GetEflClassStatic()
113 return Efl.Ui.Check.efl_ui_check_class_get();
115 /// <summary>Wrapper for native methods and virtual method delegates.
116 /// For internal use by generated code only.</summary>
117 public new class NativeMethods : Efl.Ui.Nstate.NativeMethods
119 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
120 /// <summary>Gets the list of Eo operations to override.</summary>
121 /// <returns>The list of Eo operations to be overload.</returns>
122 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
124 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
125 var methods = Efl.Eo.Globals.GetUserMethods(type);
127 if (efl_ui_check_selected_get_static_delegate == null)
129 efl_ui_check_selected_get_static_delegate = new efl_ui_check_selected_get_delegate(selected_get);
132 if (methods.FirstOrDefault(m => m.Name == "GetSelected") != null)
134 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_check_selected_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_check_selected_get_static_delegate) });
137 if (efl_ui_check_selected_set_static_delegate == null)
139 efl_ui_check_selected_set_static_delegate = new efl_ui_check_selected_set_delegate(selected_set);
142 if (methods.FirstOrDefault(m => m.Name == "SetSelected") != null)
144 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_check_selected_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_check_selected_set_static_delegate) });
147 descs.AddRange(base.GetEoOps(type));
150 /// <summary>Returns the Eo class for the native methods of this class.</summary>
151 /// <returns>The native class pointer.</returns>
152 public override IntPtr GetEflClass()
154 return Efl.Ui.Check.efl_ui_check_class_get();
157 #pragma warning disable CA1707, SA1300, SA1600
159 [return: MarshalAs(UnmanagedType.U1)]
160 private delegate bool efl_ui_check_selected_get_delegate(System.IntPtr obj, System.IntPtr pd);
162 [return: MarshalAs(UnmanagedType.U1)]
163 public delegate bool efl_ui_check_selected_get_api_delegate(System.IntPtr obj);
165 public static Efl.Eo.FunctionWrapper<efl_ui_check_selected_get_api_delegate> efl_ui_check_selected_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_check_selected_get_api_delegate>(Module, "efl_ui_check_selected_get");
167 private static bool selected_get(System.IntPtr obj, System.IntPtr pd)
169 Eina.Log.Debug("function efl_ui_check_selected_get was called");
170 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
173 bool _ret_var = default(bool);
176 _ret_var = ((Check)wrapper).GetSelected();
180 Eina.Log.Warning($"Callback error: {e.ToString()}");
181 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
189 return efl_ui_check_selected_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
193 private static efl_ui_check_selected_get_delegate efl_ui_check_selected_get_static_delegate;
196 private delegate void efl_ui_check_selected_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.U1)] bool value);
199 public delegate void efl_ui_check_selected_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool value);
201 public static Efl.Eo.FunctionWrapper<efl_ui_check_selected_set_api_delegate> efl_ui_check_selected_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_check_selected_set_api_delegate>(Module, "efl_ui_check_selected_set");
203 private static void selected_set(System.IntPtr obj, System.IntPtr pd, bool value)
205 Eina.Log.Debug("function efl_ui_check_selected_set was called");
206 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
212 ((Check)wrapper).SetSelected(value);
216 Eina.Log.Warning($"Callback error: {e.ToString()}");
217 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
224 efl_ui_check_selected_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), value);
228 private static efl_ui_check_selected_set_delegate efl_ui_check_selected_set_static_delegate;
230 #pragma warning restore CA1707, SA1300, SA1600