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>Datepicker widget
13 /// This is a widget which allows the user to pick a date using internal spinner. User can use the internal spinner to select year, month, day or user can input value using internal entry.</summary>
14 [Efl.Ui.Datepicker.NativeMethods]
15 [Efl.Eo.BindingEntity]
16 public class Datepicker : Efl.Ui.LayoutBase
18 ///<summary>Pointer to the native class description.</summary>
19 public override System.IntPtr NativeClass
23 if (((object)this).GetType() == typeof(Datepicker))
25 return GetEflClassStatic();
29 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
34 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
35 efl_ui_datepicker_class_get();
36 /// <summary>Initializes a new instance of the <see cref="Datepicker"/> class.</summary>
37 /// <param name="parent">Parent instance.</param>
38 /// <param name="style">The widget style to use. See <see cref="Efl.Ui.Widget.SetStyle" /></param>
39 public Datepicker(Efl.Object parent
40 , System.String style = null) : base(efl_ui_datepicker_class_get(), parent)
42 if (Efl.Eo.Globals.ParamHelperCheck(style))
44 SetStyle(Efl.Eo.Globals.GetParamHelper(style));
47 FinishInstantiation();
50 /// <summary>Constructor to be used when objects are expected to be constructed from native code.</summary>
51 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
52 protected Datepicker(ConstructingHandle ch) : base(ch)
56 /// <summary>Initializes a new instance of the <see cref="Datepicker"/> class.
57 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
58 /// <param name="wh">The native pointer to be wrapped.</param>
59 protected Datepicker(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
63 /// <summary>Initializes a new instance of the <see cref="Datepicker"/> class.
64 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
65 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
66 /// <param name="parent">The Efl.Object parent of this instance.</param>
67 protected Datepicker(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
71 /// <summary>Called when date value is changed</summary>
72 public event EventHandler ChangedEvt
76 lock (eflBindingEventLock)
78 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
80 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
83 EventArgs args = EventArgs.Empty;
86 value?.Invoke(obj, args);
90 Eina.Log.Error(e.ToString());
91 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
96 string key = "_EFL_UI_DATEPICKER_EVENT_CHANGED";
97 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
103 lock (eflBindingEventLock)
105 string key = "_EFL_UI_DATEPICKER_EVENT_CHANGED";
106 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
110 ///<summary>Method to raise event ChangedEvt.</summary>
111 public void OnChangedEvt(EventArgs e)
113 var key = "_EFL_UI_DATEPICKER_EVENT_CHANGED";
114 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
115 if (desc == IntPtr.Zero)
117 Eina.Log.Error($"Failed to get native event {key}");
121 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
123 /// <summary>The lower boundary of date.
124 /// <c>year</c>: Year. The year range is from 1900 to 2137.
126 /// <c>month</c>: Month. The month range is from 1 to 12.
128 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
129 /// <param name="year">The year value.</param>
130 /// <param name="month">The month value from 1 to 12.</param>
131 /// <param name="day">The day value from 1 to 31.</param>
132 virtual public void GetMin(out int year, out int month, out int day) {
133 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_min_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),out year, out month, out day);
134 Eina.Error.RaiseIfUnhandledException();
136 /// <summary>The lower boundary of date.
137 /// <c>year</c>: Year. The year range is from 1900 to 2137.
139 /// <c>month</c>: Month. The month range is from 1 to 12.
141 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
142 /// <param name="year">The year value.</param>
143 /// <param name="month">The month value from 1 to 12.</param>
144 /// <param name="day">The day value from 1 to 31.</param>
145 virtual public void SetMin(int year, int month, int day) {
146 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_min_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),year, month, day);
147 Eina.Error.RaiseIfUnhandledException();
149 /// <summary>The upper boundary of date.
150 /// <c>year</c>: Year. The year range is from 1900 to 2137.
152 /// <c>month</c>: Month. The month range is from 1 to 12.
154 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
155 /// <param name="year">The year value.</param>
156 /// <param name="month">The month value from 1 to 12.</param>
157 /// <param name="day">The day value from 1 to 31.</param>
158 virtual public void GetMax(out int year, out int month, out int day) {
159 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_max_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),out year, out month, out day);
160 Eina.Error.RaiseIfUnhandledException();
162 /// <summary>The upper boundary of date.
163 /// <c>year</c>: Year. The year range is from 1900 to 2137.
165 /// <c>month</c>: Month. The month range is from 1 to 12.
167 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
168 /// <param name="year">The year value.</param>
169 /// <param name="month">The month value from 1 to 12.</param>
170 /// <param name="day">The day value from 1 to 31.</param>
171 virtual public void SetMax(int year, int month, int day) {
172 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_max_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),year, month, day);
173 Eina.Error.RaiseIfUnhandledException();
175 /// <summary>The current value of date.
176 /// <c>year</c>: Year. The year range is from 1900 to 2137.
178 /// <c>month</c>: Month. The month range is from 0 to 11.
180 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
181 /// <param name="year">The year value.</param>
182 /// <param name="month">The month value from 1 to 12.</param>
183 /// <param name="day">The day value from 1 to 31.</param>
184 virtual public void GetDate(out int year, out int month, out int day) {
185 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_date_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),out year, out month, out day);
186 Eina.Error.RaiseIfUnhandledException();
188 /// <summary>The current value of date.
189 /// <c>year</c>: Year. The year range is from 1900 to 2137.
191 /// <c>month</c>: Month. The month range is from 0 to 11.
193 /// <c>day</c>: Day. The day range is from 1 to 31 according to <c>month</c>.</summary>
194 /// <param name="year">The year value.</param>
195 /// <param name="month">The month value from 1 to 12.</param>
196 /// <param name="day">The day value from 1 to 31.</param>
197 virtual public void SetDate(int year, int month, int day) {
198 Efl.Ui.Datepicker.NativeMethods.efl_ui_datepicker_date_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),year, month, day);
199 Eina.Error.RaiseIfUnhandledException();
201 private static IntPtr GetEflClassStatic()
203 return Efl.Ui.Datepicker.efl_ui_datepicker_class_get();
205 /// <summary>Wrapper for native methods and virtual method delegates.
206 /// For internal use by generated code only.</summary>
207 public new class NativeMethods : Efl.Ui.LayoutBase.NativeMethods
209 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
210 /// <summary>Gets the list of Eo operations to override.</summary>
211 /// <returns>The list of Eo operations to be overload.</returns>
212 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
214 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
215 var methods = Efl.Eo.Globals.GetUserMethods(type);
217 if (efl_ui_datepicker_min_get_static_delegate == null)
219 efl_ui_datepicker_min_get_static_delegate = new efl_ui_datepicker_min_get_delegate(min_get);
222 if (methods.FirstOrDefault(m => m.Name == "GetMin") != null)
224 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_min_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_get_static_delegate) });
227 if (efl_ui_datepicker_min_set_static_delegate == null)
229 efl_ui_datepicker_min_set_static_delegate = new efl_ui_datepicker_min_set_delegate(min_set);
232 if (methods.FirstOrDefault(m => m.Name == "SetMin") != null)
234 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_min_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_set_static_delegate) });
237 if (efl_ui_datepicker_max_get_static_delegate == null)
239 efl_ui_datepicker_max_get_static_delegate = new efl_ui_datepicker_max_get_delegate(max_get);
242 if (methods.FirstOrDefault(m => m.Name == "GetMax") != null)
244 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_max_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_get_static_delegate) });
247 if (efl_ui_datepicker_max_set_static_delegate == null)
249 efl_ui_datepicker_max_set_static_delegate = new efl_ui_datepicker_max_set_delegate(max_set);
252 if (methods.FirstOrDefault(m => m.Name == "SetMax") != null)
254 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_max_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_set_static_delegate) });
257 if (efl_ui_datepicker_date_get_static_delegate == null)
259 efl_ui_datepicker_date_get_static_delegate = new efl_ui_datepicker_date_get_delegate(date_get);
262 if (methods.FirstOrDefault(m => m.Name == "GetDate") != null)
264 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_date_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_get_static_delegate) });
267 if (efl_ui_datepicker_date_set_static_delegate == null)
269 efl_ui_datepicker_date_set_static_delegate = new efl_ui_datepicker_date_set_delegate(date_set);
272 if (methods.FirstOrDefault(m => m.Name == "SetDate") != null)
274 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_date_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_set_static_delegate) });
277 descs.AddRange(base.GetEoOps(type));
280 /// <summary>Returns the Eo class for the native methods of this class.</summary>
281 /// <returns>The native class pointer.</returns>
282 public override IntPtr GetEflClass()
284 return Efl.Ui.Datepicker.efl_ui_datepicker_class_get();
287 #pragma warning disable CA1707, CS1591, SA1300, SA1600
290 private delegate void efl_ui_datepicker_min_get_delegate(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day);
293 public delegate void efl_ui_datepicker_min_get_api_delegate(System.IntPtr obj, out int year, out int month, out int day);
295 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_min_get_api_delegate> efl_ui_datepicker_min_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_min_get_api_delegate>(Module, "efl_ui_datepicker_min_get");
297 private static void min_get(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day)
299 Eina.Log.Debug("function efl_ui_datepicker_min_get was called");
300 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
303 year = default(int); month = default(int); day = default(int);
306 ((Datepicker)ws.Target).GetMin(out year, out month, out day);
310 Eina.Log.Warning($"Callback error: {e.ToString()}");
311 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
318 efl_ui_datepicker_min_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out year, out month, out day);
322 private static efl_ui_datepicker_min_get_delegate efl_ui_datepicker_min_get_static_delegate;
325 private delegate void efl_ui_datepicker_min_set_delegate(System.IntPtr obj, System.IntPtr pd, int year, int month, int day);
328 public delegate void efl_ui_datepicker_min_set_api_delegate(System.IntPtr obj, int year, int month, int day);
330 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_min_set_api_delegate> efl_ui_datepicker_min_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_min_set_api_delegate>(Module, "efl_ui_datepicker_min_set");
332 private static void min_set(System.IntPtr obj, System.IntPtr pd, int year, int month, int day)
334 Eina.Log.Debug("function efl_ui_datepicker_min_set was called");
335 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
341 ((Datepicker)ws.Target).SetMin(year, month, day);
345 Eina.Log.Warning($"Callback error: {e.ToString()}");
346 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
353 efl_ui_datepicker_min_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), year, month, day);
357 private static efl_ui_datepicker_min_set_delegate efl_ui_datepicker_min_set_static_delegate;
360 private delegate void efl_ui_datepicker_max_get_delegate(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day);
363 public delegate void efl_ui_datepicker_max_get_api_delegate(System.IntPtr obj, out int year, out int month, out int day);
365 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_max_get_api_delegate> efl_ui_datepicker_max_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_max_get_api_delegate>(Module, "efl_ui_datepicker_max_get");
367 private static void max_get(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day)
369 Eina.Log.Debug("function efl_ui_datepicker_max_get was called");
370 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
373 year = default(int); month = default(int); day = default(int);
376 ((Datepicker)ws.Target).GetMax(out year, out month, out day);
380 Eina.Log.Warning($"Callback error: {e.ToString()}");
381 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
388 efl_ui_datepicker_max_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out year, out month, out day);
392 private static efl_ui_datepicker_max_get_delegate efl_ui_datepicker_max_get_static_delegate;
395 private delegate void efl_ui_datepicker_max_set_delegate(System.IntPtr obj, System.IntPtr pd, int year, int month, int day);
398 public delegate void efl_ui_datepicker_max_set_api_delegate(System.IntPtr obj, int year, int month, int day);
400 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_max_set_api_delegate> efl_ui_datepicker_max_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_max_set_api_delegate>(Module, "efl_ui_datepicker_max_set");
402 private static void max_set(System.IntPtr obj, System.IntPtr pd, int year, int month, int day)
404 Eina.Log.Debug("function efl_ui_datepicker_max_set was called");
405 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
411 ((Datepicker)ws.Target).SetMax(year, month, day);
415 Eina.Log.Warning($"Callback error: {e.ToString()}");
416 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
423 efl_ui_datepicker_max_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), year, month, day);
427 private static efl_ui_datepicker_max_set_delegate efl_ui_datepicker_max_set_static_delegate;
430 private delegate void efl_ui_datepicker_date_get_delegate(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day);
433 public delegate void efl_ui_datepicker_date_get_api_delegate(System.IntPtr obj, out int year, out int month, out int day);
435 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_date_get_api_delegate> efl_ui_datepicker_date_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_date_get_api_delegate>(Module, "efl_ui_datepicker_date_get");
437 private static void date_get(System.IntPtr obj, System.IntPtr pd, out int year, out int month, out int day)
439 Eina.Log.Debug("function efl_ui_datepicker_date_get was called");
440 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
443 year = default(int); month = default(int); day = default(int);
446 ((Datepicker)ws.Target).GetDate(out year, out month, out day);
450 Eina.Log.Warning($"Callback error: {e.ToString()}");
451 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
458 efl_ui_datepicker_date_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out year, out month, out day);
462 private static efl_ui_datepicker_date_get_delegate efl_ui_datepicker_date_get_static_delegate;
465 private delegate void efl_ui_datepicker_date_set_delegate(System.IntPtr obj, System.IntPtr pd, int year, int month, int day);
468 public delegate void efl_ui_datepicker_date_set_api_delegate(System.IntPtr obj, int year, int month, int day);
470 public static Efl.Eo.FunctionWrapper<efl_ui_datepicker_date_set_api_delegate> efl_ui_datepicker_date_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_datepicker_date_set_api_delegate>(Module, "efl_ui_datepicker_date_set");
472 private static void date_set(System.IntPtr obj, System.IntPtr pd, int year, int month, int day)
474 Eina.Log.Debug("function efl_ui_datepicker_date_set was called");
475 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
481 ((Datepicker)ws.Target).SetDate(year, month, day);
485 Eina.Log.Warning($"Callback error: {e.ToString()}");
486 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
493 efl_ui_datepicker_date_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), year, month, day);
497 private static efl_ui_datepicker_date_set_delegate efl_ui_datepicker_date_set_static_delegate;
499 #pragma warning restore CA1707, CS1591, SA1300, SA1600