Files
KioskApp/GtkSharp/Source/Libs/WebkitGtkSharp/Generated/WebKit/NavigationAction.cs

312 lines
12 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 WebKit {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
public enum WebKitNavigationType
{
LinkClicked,
FormSubmitted,
BackForward,
Reload,
FormResubmitted,
Other
}
public static class WebKitNavigationActionMethods
{
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr webkit_navigation_action_copy(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern void webkit_navigation_action_free(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern WebKitNavigationType webkit_navigation_action_get_navigation_type(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern uint webkit_navigation_action_get_mouse_button(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern uint webkit_navigation_action_get_modifiers(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr webkit_navigation_action_get_request(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool webkit_navigation_action_is_user_gesture(IntPtr navigation);
[DllImport("libwebkit2gtk-4.0.so.37", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool webkit_navigation_action_is_redirect(IntPtr navigation);
}
[StructLayout(LayoutKind.Sequential)]
public struct WKNavigationAction
{
public WebKitNavigationType NavigationType;
public uint MouseButton;
public uint Modifiers;
public IntPtr Request; // Pointer to WebKitURIRequest
[MarshalAs(UnmanagedType.I1)]
public bool IsUserGesture;
[MarshalAs(UnmanagedType.I1)]
public bool IsRedirect;
// Convert IntPtr to WebKitNavigationAction
public static WKNavigationAction PtrToStruct(IntPtr ptr)
{
return Marshal.PtrToStructure<WKNavigationAction>(ptr);
}
// Convert WebKitNavigationAction to IntPtr
public IntPtr StructToPtr()
{
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<WKNavigationAction>());
Marshal.StructureToPtr(this, ptr, false);
return ptr;
}
// Free the allocated memory
public static void FreePtr(IntPtr ptr)
{
Marshal.FreeHGlobal(ptr);
}
// Create a managed copy of the native structure
public static WKNavigationAction CreateManagedCopy(IntPtr ptr)
{
WKNavigationAction managedCopy = PtrToStruct(ptr);
// If Request is not null, create a copy of WebKitURIRequest
if (managedCopy.Request != IntPtr.Zero)
{
managedCopy.Request = WKURIRequest.CreateManagedCopy(managedCopy.Request);
}
return managedCopy;
}
// Dispose method to clean up resources
public void Dispose()
{
if (Request != IntPtr.Zero)
{
WKURIRequest.FreePtr(Request);
Request = IntPtr.Zero;
}
}
}
[StructLayout(LayoutKind.Sequential)]
public struct WKURIRequest
{
// Add fields as needed
public IntPtr Uri; // Assuming the URI is stored as a string pointer
// Convert IntPtr to WebKitURIRequest
public static WKURIRequest PtrToStruct(IntPtr ptr)
{
return Marshal.PtrToStructure<WKURIRequest>(ptr);
}
// Convert WebKitURIRequest to IntPtr
public IntPtr StructToPtr()
{
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<WKURIRequest>());
Marshal.StructureToPtr(this, ptr, false);
return ptr;
}
// Free the allocated memory
public static void FreePtr(IntPtr ptr)
{
Marshal.FreeHGlobal(ptr);
}
// Create a managed copy of the native structure
public static IntPtr CreateManagedCopy(IntPtr ptr)
{
WKURIRequest managedCopy = PtrToStruct(ptr);
// If Uri is not null, create a copy of the string
if (managedCopy.Uri != IntPtr.Zero)
{
string uriString = Marshal.PtrToStringAnsi(managedCopy.Uri);
managedCopy.Uri = Marshal.StringToHGlobalAnsi(uriString);
}
return managedCopy.StructToPtr();
}
}
#region Autogenerated code
[StructLayout(LayoutKind.Sequential)]
public partial struct NavigationAction : IEquatable<NavigationAction> {
public static WebKit.NavigationAction Zero = new WebKit.NavigationAction ();
public static WebKit.NavigationAction New(IntPtr raw) {
if (raw == IntPtr.Zero)
return WebKit.NavigationAction.Zero;
return (WebKit.NavigationAction) Marshal.PtrToStructure (raw, typeof (WebKit.NavigationAction));
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr d_webkit_navigation_action_get_type();
static d_webkit_navigation_action_get_type webkit_navigation_action_get_type = FuncLoader.LoadFunction<d_webkit_navigation_action_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_get_type"));
public static GLib.GType GType {
get {
IntPtr raw_ret = webkit_navigation_action_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate uint d_webkit_navigation_action_get_modifiers(IntPtr raw);
static d_webkit_navigation_action_get_modifiers webkit_navigation_action_get_modifiers = FuncLoader.LoadFunction<d_webkit_navigation_action_get_modifiers>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_get_modifiers"));
public uint Modifiers {
get {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.NavigationAction>());
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
uint raw_ret = webkit_navigation_action_get_modifiers(this_as_native);
uint ret = raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate uint d_webkit_navigation_action_get_mouse_button(IntPtr raw);
static d_webkit_navigation_action_get_mouse_button webkit_navigation_action_get_mouse_button = FuncLoader.LoadFunction<d_webkit_navigation_action_get_mouse_button>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_get_mouse_button"));
public uint MouseButton {
get {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.NavigationAction>());
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
uint raw_ret = webkit_navigation_action_get_mouse_button(this_as_native);
uint ret = raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate int d_webkit_navigation_action_get_navigation_type(IntPtr raw);
static d_webkit_navigation_action_get_navigation_type webkit_navigation_action_get_navigation_type = FuncLoader.LoadFunction<d_webkit_navigation_action_get_navigation_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_get_navigation_type"));
public WebKit.NavigationType NavigationType {
get {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.NavigationAction>());
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
int raw_ret = webkit_navigation_action_get_navigation_type(this_as_native);
WebKit.NavigationType ret = (WebKit.NavigationType) raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr d_webkit_navigation_action_get_request(IntPtr raw);
static d_webkit_navigation_action_get_request webkit_navigation_action_get_request = FuncLoader.LoadFunction<d_webkit_navigation_action_get_request>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_get_request"));
public WebKit.URIRequest Request {
get
{
var nav = new WKNavigationAction();
var nativePtr = nav.StructToPtr();
var raw_ptr = WebKitNavigationActionMethods.webkit_navigation_action_get_request(nativePtr);
// IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WKNavigationAction>());
// System.Runtime.InteropServices.Marshal.StructureToPtr(this, this_as_native, false);
// IntPtr raw_ret = webkit_navigation_action_get_request(nativePtr);
// WebKit.URIRequest ret = GLib.Object.GetObject(raw_ret) as WebKit.URIRequest;
// ReadNative (nativePtr, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (nativePtr);
return new WebKit.URIRequest(raw_ptr);
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate bool d_webkit_navigation_action_is_redirect(IntPtr raw);
static d_webkit_navigation_action_is_redirect webkit_navigation_action_is_redirect = FuncLoader.LoadFunction<d_webkit_navigation_action_is_redirect>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_is_redirect"));
public bool IsRedirect {
get {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.NavigationAction>());
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
bool raw_ret = webkit_navigation_action_is_redirect(this_as_native);
bool ret = raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate bool d_webkit_navigation_action_is_user_gesture(IntPtr raw);
static d_webkit_navigation_action_is_user_gesture webkit_navigation_action_is_user_gesture = FuncLoader.LoadFunction<d_webkit_navigation_action_is_user_gesture>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_navigation_action_is_user_gesture"));
public bool IsUserGesture {
get {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.NavigationAction>());
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
bool raw_ret = webkit_navigation_action_is_user_gesture(this_as_native);
bool ret = raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
}
static void ReadNative (IntPtr native, ref WebKit.NavigationAction target)
{
target = New (native);
}
public bool Equals (NavigationAction other)
{
return true;
}
public override bool Equals (object other)
{
return other is NavigationAction && Equals ((NavigationAction) other);
}
public override int GetHashCode ()
{
return this.GetType ().FullName.GetHashCode ();
}
public static explicit operator GLib.Value (WebKit.NavigationAction boxed)
{
GLib.Value val = GLib.Value.Empty;
val.Init (WebKit.NavigationAction.GType);
val.Val = boxed;
return val;
}
public static explicit operator WebKit.NavigationAction (GLib.Value val)
{
return (WebKit.NavigationAction) val.Val;
}
#endregion
}
}