2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
13 /// <summary>Timepicker widget
14 /// This is a widget which allows the user to pick a time using internal spinner. User can use the internal spinner to select hour, minute, AM/PM or user can input value using internal entry.</summary>
15 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
16 [Efl.Ui.Timepicker.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public class Timepicker : Efl.Ui.LayoutBase
20 /// <summary>Pointer to the native class description.</summary>
21 public override System.IntPtr NativeClass
25 if (((object)this).GetType() == typeof(Timepicker))
27 return GetEflClassStatic();
31 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
36 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
37 efl_ui_timepicker_class_get();
38 /// <summary>Initializes a new instance of the <see cref="Timepicker"/> class.</summary>
39 /// <param name="parent">Parent instance.</param>
40 /// <param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle" /></param>
41 public Timepicker(Efl.Object parent
42 , System.String style = null) : base(efl_ui_timepicker_class_get(), parent)
44 if (Efl.Eo.Globals.ParamHelperCheck(style))
46 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
49 FinishInstantiation();
52 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
53 /// Do not call this constructor directly.</summary>
54 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
55 protected Timepicker(ConstructingHandle ch) : base(ch)
59 /// <summary>Initializes a new instance of the <see cref="Timepicker"/> class.
60 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
61 /// <param name="wh">The native pointer to be wrapped.</param>
62 protected Timepicker(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
66 /// <summary>Initializes a new instance of the <see cref="Timepicker"/> class.
67 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
68 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
69 /// <param name="parent">The Efl.Object parent of this instance.</param>
70 protected Timepicker(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
74 /// <summary>Called when date is changed</summary>
75 public event EventHandler ChangedEvt
79 lock (eflBindingEventLock)
81 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
83 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
86 EventArgs args = EventArgs.Empty;
89 value?.Invoke(obj, args);
93 Eina.Log.Error(e.ToString());
94 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
99 string key = "_EFL_UI_TIMEPICKER_EVENT_CHANGED";
100 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
106 lock (eflBindingEventLock)
108 string key = "_EFL_UI_TIMEPICKER_EVENT_CHANGED";
109 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
113 /// <summary>Method to raise event ChangedEvt.</summary>
114 public void OnChangedEvt(EventArgs e)
116 var key = "_EFL_UI_TIMEPICKER_EVENT_CHANGED";
117 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
118 if (desc == IntPtr.Zero)
120 Eina.Log.Error($"Failed to get native event {key}");
124 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
126 /// <summary>The current value of time
127 /// <c>hour</c>: Hour. The hour value is in terms of 24 hour format from 0 to 23.
129 /// <c>min</c>: Minute. The minute range is from 0 to 59.</summary>
130 /// <param name="hour">The hour value from 0 to 23.</param>
131 /// <param name="min">The minute value from 0 to 59.</param>
132 virtual public void GetTime(out int hour, out int min) {
133 Efl.Ui.Timepicker.NativeMethods.efl_ui_timepicker_time_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),out hour, out min);
134 Eina.Error.RaiseIfUnhandledException();
136 /// <summary>The current value of time
137 /// <c>hour</c>: Hour. The hour value is in terms of 24 hour format from 0 to 23.
139 /// <c>min</c>: Minute. The minute range is from 0 to 59.</summary>
140 /// <param name="hour">The hour value from 0 to 23.</param>
141 /// <param name="min">The minute value from 0 to 59.</param>
142 virtual public void SetTime(int hour, int min) {
143 Efl.Ui.Timepicker.NativeMethods.efl_ui_timepicker_time_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),hour, min);
144 Eina.Error.RaiseIfUnhandledException();
146 /// <summary>Control if the Timepicker displays 24 hour time or 12 hour time including AM/PM button.</summary>
147 /// <returns><c>true</c> to display the 24 hour time, <c>false</c> to display 12 hour time including AM/PM button.</returns>
148 virtual public bool GetAmpm() {
149 var _ret_var = Efl.Ui.Timepicker.NativeMethods.efl_ui_timepicker_ampm_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
150 Eina.Error.RaiseIfUnhandledException();
153 /// <summary>Control if the Timepicker displays 24 hour time or 12 hour time including AM/PM button.</summary>
154 /// <param name="is_24hour"><c>true</c> to display the 24 hour time, <c>false</c> to display 12 hour time including AM/PM button.</param>
155 virtual public void SetAmpm(bool is_24hour) {
156 Efl.Ui.Timepicker.NativeMethods.efl_ui_timepicker_ampm_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),is_24hour);
157 Eina.Error.RaiseIfUnhandledException();
159 /// <summary>The current value of time
160 /// <c>hour</c>: Hour. The hour value is in terms of 24 hour format from 0 to 23.
162 /// <c>min</c>: Minute. The minute range is from 0 to 59.</summary>
163 /// <value>The hour value from 0 to 23.</value>
164 public (int, int) Time {
166 int _out_hour = default(int);
167 int _out_min = default(int);
168 GetTime(out _out_hour,out _out_min);
169 return (_out_hour,_out_min);
171 set { SetTime( value.Item1, value.Item2); }
173 /// <summary>Control if the Timepicker displays 24 hour time or 12 hour time including AM/PM button.</summary>
174 /// <value><c>true</c> to display the 24 hour time, <c>false</c> to display 12 hour time including AM/PM button.</value>
176 get { return GetAmpm(); }
177 set { SetAmpm(value); }
179 private static IntPtr GetEflClassStatic()
181 return Efl.Ui.Timepicker.efl_ui_timepicker_class_get();
183 /// <summary>Wrapper for native methods and virtual method delegates.
184 /// For internal use by generated code only.</summary>
185 public new class NativeMethods : Efl.Ui.LayoutBase.NativeMethods
187 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
188 /// <summary>Gets the list of Eo operations to override.</summary>
189 /// <returns>The list of Eo operations to be overload.</returns>
190 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
192 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
193 var methods = Efl.Eo.Globals.GetUserMethods(type);
195 if (efl_ui_timepicker_time_get_static_delegate == null)
197 efl_ui_timepicker_time_get_static_delegate = new efl_ui_timepicker_time_get_delegate(time_get);
200 if (methods.FirstOrDefault(m => m.Name == "GetTime") != null)
202 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_timepicker_time_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_timepicker_time_get_static_delegate) });
205 if (efl_ui_timepicker_time_set_static_delegate == null)
207 efl_ui_timepicker_time_set_static_delegate = new efl_ui_timepicker_time_set_delegate(time_set);
210 if (methods.FirstOrDefault(m => m.Name == "SetTime") != null)
212 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_timepicker_time_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_timepicker_time_set_static_delegate) });
215 if (efl_ui_timepicker_ampm_get_static_delegate == null)
217 efl_ui_timepicker_ampm_get_static_delegate = new efl_ui_timepicker_ampm_get_delegate(ampm_get);
220 if (methods.FirstOrDefault(m => m.Name == "GetAmpm") != null)
222 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_timepicker_ampm_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_timepicker_ampm_get_static_delegate) });
225 if (efl_ui_timepicker_ampm_set_static_delegate == null)
227 efl_ui_timepicker_ampm_set_static_delegate = new efl_ui_timepicker_ampm_set_delegate(ampm_set);
230 if (methods.FirstOrDefault(m => m.Name == "SetAmpm") != null)
232 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_timepicker_ampm_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_timepicker_ampm_set_static_delegate) });
235 descs.AddRange(base.GetEoOps(type));
238 /// <summary>Returns the Eo class for the native methods of this class.</summary>
239 /// <returns>The native class pointer.</returns>
240 public override IntPtr GetEflClass()
242 return Efl.Ui.Timepicker.efl_ui_timepicker_class_get();
245 #pragma warning disable CA1707, CS1591, SA1300, SA1600
248 private delegate void efl_ui_timepicker_time_get_delegate(System.IntPtr obj, System.IntPtr pd, out int hour, out int min);
251 public delegate void efl_ui_timepicker_time_get_api_delegate(System.IntPtr obj, out int hour, out int min);
253 public static Efl.Eo.FunctionWrapper<efl_ui_timepicker_time_get_api_delegate> efl_ui_timepicker_time_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_timepicker_time_get_api_delegate>(Module, "efl_ui_timepicker_time_get");
255 private static void time_get(System.IntPtr obj, System.IntPtr pd, out int hour, out int min)
257 Eina.Log.Debug("function efl_ui_timepicker_time_get was called");
258 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
261 hour = default(int); min = default(int);
264 ((Timepicker)ws.Target).GetTime(out hour, out min);
268 Eina.Log.Warning($"Callback error: {e.ToString()}");
269 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
276 efl_ui_timepicker_time_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out hour, out min);
280 private static efl_ui_timepicker_time_get_delegate efl_ui_timepicker_time_get_static_delegate;
283 private delegate void efl_ui_timepicker_time_set_delegate(System.IntPtr obj, System.IntPtr pd, int hour, int min);
286 public delegate void efl_ui_timepicker_time_set_api_delegate(System.IntPtr obj, int hour, int min);
288 public static Efl.Eo.FunctionWrapper<efl_ui_timepicker_time_set_api_delegate> efl_ui_timepicker_time_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_timepicker_time_set_api_delegate>(Module, "efl_ui_timepicker_time_set");
290 private static void time_set(System.IntPtr obj, System.IntPtr pd, int hour, int min)
292 Eina.Log.Debug("function efl_ui_timepicker_time_set was called");
293 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
299 ((Timepicker)ws.Target).SetTime(hour, min);
303 Eina.Log.Warning($"Callback error: {e.ToString()}");
304 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
311 efl_ui_timepicker_time_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), hour, min);
315 private static efl_ui_timepicker_time_set_delegate efl_ui_timepicker_time_set_static_delegate;
317 [return: MarshalAs(UnmanagedType.U1)]
318 private delegate bool efl_ui_timepicker_ampm_get_delegate(System.IntPtr obj, System.IntPtr pd);
320 [return: MarshalAs(UnmanagedType.U1)]
321 public delegate bool efl_ui_timepicker_ampm_get_api_delegate(System.IntPtr obj);
323 public static Efl.Eo.FunctionWrapper<efl_ui_timepicker_ampm_get_api_delegate> efl_ui_timepicker_ampm_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_timepicker_ampm_get_api_delegate>(Module, "efl_ui_timepicker_ampm_get");
325 private static bool ampm_get(System.IntPtr obj, System.IntPtr pd)
327 Eina.Log.Debug("function efl_ui_timepicker_ampm_get was called");
328 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
331 bool _ret_var = default(bool);
334 _ret_var = ((Timepicker)ws.Target).GetAmpm();
338 Eina.Log.Warning($"Callback error: {e.ToString()}");
339 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
347 return efl_ui_timepicker_ampm_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
351 private static efl_ui_timepicker_ampm_get_delegate efl_ui_timepicker_ampm_get_static_delegate;
354 private delegate void efl_ui_timepicker_ampm_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.U1)] bool is_24hour);
357 public delegate void efl_ui_timepicker_ampm_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool is_24hour);
359 public static Efl.Eo.FunctionWrapper<efl_ui_timepicker_ampm_set_api_delegate> efl_ui_timepicker_ampm_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_timepicker_ampm_set_api_delegate>(Module, "efl_ui_timepicker_ampm_set");
361 private static void ampm_set(System.IntPtr obj, System.IntPtr pd, bool is_24hour)
363 Eina.Log.Debug("function efl_ui_timepicker_ampm_set was called");
364 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
370 ((Timepicker)ws.Target).SetAmpm(is_24hour);
374 Eina.Log.Warning($"Callback error: {e.ToString()}");
375 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
382 efl_ui_timepicker_ampm_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), is_24hour);
386 private static efl_ui_timepicker_ampm_set_delegate efl_ui_timepicker_ampm_set_static_delegate;
388 #pragma warning restore CA1707, CS1591, SA1300, SA1600
397 #pragma warning disable CS1591
398 public static class Efl_UiTimepicker_ExtensionMethods {
400 public static Efl.BindableProperty<bool> Ampm<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Ui.Timepicker, T>magic = null) where T : Efl.Ui.Timepicker {
401 return new Efl.BindableProperty<bool>("ampm", fac);
405 #pragma warning restore CS1591