#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 {
/// Selectable interface for ui objects
/// A object implementing this can be selected. When the selected property of this object changes, the selected,changed event is emitted.
/// This is a BETA class. It can be modified or removed in the future. Do not use it for product development.
[Efl.Ui.ISelectableConcrete.NativeMethods]
[Efl.Eo.BindingEntity]
public interface ISelectable :
Efl.Eo.IWrapper, IDisposable
{
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
bool GetSelected();
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
void SetSelected(bool selected);
/// Called when the selected state has changed
///
event EventHandler SelectedChangedEvt;
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
bool Selected {
get;
set;
}
}
/// Event argument wrapper for event .
[Efl.Eo.BindingEntity]
public class ISelectableSelectedChangedEvt_Args : EventArgs {
/// Actual event payload.
/// Called when the selected state has changed
public bool arg { get; set; }
}
/// Selectable interface for ui objects
/// A object implementing this can be selected. When the selected property of this object changes, the selected,changed event is emitted.
/// This is a BETA class. It can be modified or removed in the future. Do not use it for product development.
sealed public class ISelectableConcrete :
Efl.Eo.EoWrapper
, ISelectable
{
/// Pointer to the native class description.
public override System.IntPtr NativeClass
{
get
{
if (((object)this).GetType() == typeof(ISelectableConcrete))
{
return GetEflClassStatic();
}
else
{
return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
}
}
}
/// 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.
private ISelectableConcrete(ConstructingHandle ch) : base(ch)
{
}
[System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
efl_ui_selectable_interface_get();
/// Initializes a new instance of the class.
/// Internal usage: This is used when interacting with C code and should not be used directly.
/// The native pointer to be wrapped.
private ISelectableConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
{
}
/// Called when the selected state has changed
///
public event EventHandler SelectedChangedEvt
{
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.ISelectableSelectedChangedEvt_Args args = new Efl.Ui.ISelectableSelectedChangedEvt_Args();
args.arg = Marshal.ReadByte(evt.Info) != 0;
try
{
value?.Invoke(obj, args);
}
catch (Exception e)
{
Eina.Log.Error(e.ToString());
Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
}
}
};
string key = "_EFL_UI_EVENT_SELECTED_CHANGED";
AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
}
}
remove
{
lock (eflBindingEventLock)
{
string key = "_EFL_UI_EVENT_SELECTED_CHANGED";
RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
}
}
}
/// Method to raise event SelectedChangedEvt.
public void OnSelectedChangedEvt(Efl.Ui.ISelectableSelectedChangedEvt_Args e)
{
var key = "_EFL_UI_EVENT_SELECTED_CHANGED";
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 = Eina.PrimitiveConversion.ManagedToPointerAlloc(e.arg ? (byte) 1 : (byte) 0);
try
{
Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
}
finally
{
Marshal.FreeHGlobal(info);
}
}
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
public bool GetSelected() {
var _ret_var = Efl.Ui.ISelectableConcrete.NativeMethods.efl_ui_selectable_selected_get_ptr.Value.Delegate(this.NativeHandle);
Eina.Error.RaiseIfUnhandledException();
return _ret_var;
}
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
public void SetSelected(bool selected) {
Efl.Ui.ISelectableConcrete.NativeMethods.efl_ui_selectable_selected_set_ptr.Value.Delegate(this.NativeHandle,selected);
Eina.Error.RaiseIfUnhandledException();
}
/// The selected state of this object
/// A change to this property emits the changed event.
/// The selected state of this object
public bool Selected {
get { return GetSelected(); }
set { SetSelected(value); }
}
private static IntPtr GetEflClassStatic()
{
return Efl.Ui.ISelectableConcrete.efl_ui_selectable_interface_get();
}
/// Wrapper for native methods and virtual method delegates.
/// For internal use by generated code only.
public new class NativeMethods : Efl.Eo.EoWrapper.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_selectable_selected_get_static_delegate == null)
{
efl_ui_selectable_selected_get_static_delegate = new efl_ui_selectable_selected_get_delegate(selected_get);
}
if (methods.FirstOrDefault(m => m.Name == "GetSelected") != null)
{
descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selectable_selected_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selectable_selected_get_static_delegate) });
}
if (efl_ui_selectable_selected_set_static_delegate == null)
{
efl_ui_selectable_selected_set_static_delegate = new efl_ui_selectable_selected_set_delegate(selected_set);
}
if (methods.FirstOrDefault(m => m.Name == "SetSelected") != null)
{
descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_selectable_selected_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_selectable_selected_set_static_delegate) });
}
return descs;
}
/// Returns the Eo class for the native methods of this class.
/// The native class pointer.
public override IntPtr GetEflClass()
{
return Efl.Ui.ISelectableConcrete.efl_ui_selectable_interface_get();
}
#pragma warning disable CA1707, CS1591, SA1300, SA1600
[return: MarshalAs(UnmanagedType.U1)]
private delegate bool efl_ui_selectable_selected_get_delegate(System.IntPtr obj, System.IntPtr pd);
[return: MarshalAs(UnmanagedType.U1)]
public delegate bool efl_ui_selectable_selected_get_api_delegate(System.IntPtr obj);
public static Efl.Eo.FunctionWrapper efl_ui_selectable_selected_get_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_selectable_selected_get");
private static bool selected_get(System.IntPtr obj, System.IntPtr pd)
{
Eina.Log.Debug("function efl_ui_selectable_selected_get was called");
var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
if (ws != null)
{
bool _ret_var = default(bool);
try
{
_ret_var = ((ISelectable)ws.Target).GetSelected();
}
catch (Exception e)
{
Eina.Log.Warning($"Callback error: {e.ToString()}");
Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
}
return _ret_var;
}
else
{
return efl_ui_selectable_selected_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
}
}
private static efl_ui_selectable_selected_get_delegate efl_ui_selectable_selected_get_static_delegate;
private delegate void efl_ui_selectable_selected_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.U1)] bool selected);
public delegate void efl_ui_selectable_selected_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool selected);
public static Efl.Eo.FunctionWrapper efl_ui_selectable_selected_set_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_selectable_selected_set");
private static void selected_set(System.IntPtr obj, System.IntPtr pd, bool selected)
{
Eina.Log.Debug("function efl_ui_selectable_selected_set was called");
var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
if (ws != null)
{
try
{
((ISelectable)ws.Target).SetSelected(selected);
}
catch (Exception e)
{
Eina.Log.Warning($"Callback error: {e.ToString()}");
Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
}
}
else
{
efl_ui_selectable_selected_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), selected);
}
}
private static efl_ui_selectable_selected_set_delegate efl_ui_selectable_selected_set_static_delegate;
#pragma warning restore CA1707, CS1591, SA1300, SA1600
}
}
}
}
#if EFL_BETA
#pragma warning disable CS1591
public static class Efl_UiISelectableConcrete_ExtensionMethods {
public static Efl.BindableProperty Selected(this Efl.Ui.ItemFactory fac, Efl.Csharp.ExtensionTagmagic = null) where T : Efl.Ui.ISelectable {
return new Efl.BindableProperty("selected", fac);
}
}
#pragma warning restore CS1591
#endif