#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 Access { /// Elementary accessible window interface /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. [Efl.Access.IWindowConcrete.NativeMethods] [Efl.Eo.BindingEntity] public interface IWindow : Efl.Eo.IWrapper, IDisposable { /// Called when new window has been created. event EventHandler WindowCreatedEvt; /// Called when window has been destroyed. event EventHandler WindowDestroyedEvt; /// Called when window has been activated. (focused) event EventHandler WindowActivatedEvt; /// Called when window has been deactivated (unfocused). event EventHandler WindowDeactivatedEvt; /// Called when window has been maximized event EventHandler WindowMaximizedEvt; /// Called when window has been minimized event EventHandler WindowMinimizedEvt; /// Called when window has been restored event EventHandler WindowRestoredEvt; } /// Elementary accessible window interface /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. sealed public class IWindowConcrete : Efl.Eo.EoWrapper , IWindow { /// Pointer to the native class description. public override System.IntPtr NativeClass { get { if (((object)this).GetType() == typeof(IWindowConcrete)) { 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 IWindowConcrete(ConstructingHandle ch) : base(ch) { } [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr efl_access_window_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 IWindowConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh) { } /// Called when new window has been created. public event EventHandler WindowCreatedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_CREATED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_CREATED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowCreatedEvt. public void OnWindowCreatedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_CREATED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been destroyed. public event EventHandler WindowDestroyedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DESTROYED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DESTROYED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowDestroyedEvt. public void OnWindowDestroyedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DESTROYED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been activated. (focused) public event EventHandler WindowActivatedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_ACTIVATED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_ACTIVATED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowActivatedEvt. public void OnWindowActivatedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_ACTIVATED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been deactivated (unfocused). public event EventHandler WindowDeactivatedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DEACTIVATED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DEACTIVATED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowDeactivatedEvt. public void OnWindowDeactivatedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_DEACTIVATED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been maximized public event EventHandler WindowMaximizedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MAXIMIZED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MAXIMIZED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowMaximizedEvt. public void OnWindowMaximizedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MAXIMIZED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been minimized public event EventHandler WindowMinimizedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MINIMIZED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MINIMIZED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowMinimizedEvt. public void OnWindowMinimizedEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_MINIMIZED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Called when window has been restored public event EventHandler WindowRestoredEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_RESTORED"; AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_RESTORED"; RemoveNativeEventHandler(efl.Libs.Elementary, key, value); } } } /// Method to raise event WindowRestoredEvt. public void OnWindowRestoredEvt(EventArgs e) { var key = "_EFL_ACCESS_WINDOW_EVENT_WINDOW_RESTORED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } private static IntPtr GetEflClassStatic() { return Efl.Access.IWindowConcrete.efl_access_window_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 { /// 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(); return descs; } /// Returns the Eo class for the native methods of this class. /// The native class pointer. public override IntPtr GetEflClass() { return Efl.Access.IWindowConcrete.efl_access_window_interface_get(); } #pragma warning disable CA1707, CS1591, SA1300, SA1600 #pragma warning restore CA1707, CS1591, SA1300, SA1600 } } } } #if EFL_BETA #pragma warning disable CS1591 public static class Efl_AccessIWindowConcrete_ExtensionMethods { } #pragma warning restore CS1591 #endif