Files
KioskApp/GtkSharp/Source/Libs/GdkSharp/Generated/Gdk/GdkSharp.WindowChildFuncNative.cs

95 lines
2.2 KiB
C#
Raw Normal View History

2024-09-15 22:40:48 +02:00
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GdkSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
internal delegate bool WindowChildFuncNative(IntPtr window, IntPtr user_data);
internal class WindowChildFuncInvoker {
WindowChildFuncNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~WindowChildFuncInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal WindowChildFuncInvoker (WindowChildFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal WindowChildFuncInvoker (WindowChildFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal WindowChildFuncInvoker (WindowChildFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gdk.WindowChildFunc Handler {
get {
return new Gdk.WindowChildFunc(InvokeNative);
}
}
bool InvokeNative (Gdk.Window window)
{
bool __result = native_cb (window == null ? IntPtr.Zero : window.Handle, __data);
return __result;
}
}
internal class WindowChildFuncWrapper {
public bool NativeCallback (IntPtr window, IntPtr user_data)
{
try {
bool __ret = managed (GLib.Object.GetObject(window) as Gdk.Window);
if (release_on_call)
gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
return false;
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal WindowChildFuncNative NativeDelegate;
Gdk.WindowChildFunc managed;
public WindowChildFuncWrapper (Gdk.WindowChildFunc managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new WindowChildFuncNative (NativeCallback);
}
public static Gdk.WindowChildFunc GetManagedDelegate (WindowChildFuncNative native)
{
if (native == null)
return null;
WindowChildFuncWrapper wrapper = (WindowChildFuncWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}