All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gnome.gobject.ToggleNotify Maven / Gradle / Ivy

The newest version!
// This file was automatically generated by Java-GI. Do not edit this file
// directly! Visit  for more information.
//
// The API documentation in this file was derived from GObject-Introspection
// metadata and may include text or comments from the original C sources.
//
// Copyright (c), upstream authors as identified in the GObject-Introspection
// metadata.
//
// This generated file is distributed under the same license as the original
// GObject-Introspection data, unless otherwise specified. Users of this file
// are responsible for complying with any licenses or terms required by the
// original authors.
//
// THIS FILE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
//
package org.gnome.gobject;

import io.github.jwharm.javagi.base.FunctionPointer;
import io.github.jwharm.javagi.gobject.InstanceCache;
import io.github.jwharm.javagi.interop.Interop;
import java.lang.FunctionalInterface;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import javax.annotation.processing.Generated;
import org.jetbrains.annotations.Nullable;

/**
 * Functional interface declaration of the {@code ToggleNotify} callback.
 * 

* @see ToggleNotify#run */ @FunctionalInterface @Generated("io.github.jwharm.JavaGI") public interface ToggleNotify extends FunctionPointer { /** * A callback function used for notification when the state * of a toggle reference changes. *

* See also: g_object_add_toggle_ref() */ void run(@Nullable MemorySegment data, GObject object, boolean isLastRef); /** * The {@code upcall} method is called from native code. The parameters * are marshaled and {@link #run} is executed. */ default void upcall(MemorySegment data, MemorySegment object, int isLastRef) { Arena _arena = Arena.ofAuto(); run(data, (GObject) InstanceCache.getForType(object, GObject::new, false), isLastRef != 0); } /** * Creates a native function pointer to the {@link #upcall} method. * * @return the native function pointer */ default MemorySegment toCallback(Arena arena) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MethodHandle _handle = Interop.upcallHandle(MethodHandles.lookup(), ToggleNotify.class, _fdesc); return Linker.nativeLinker().upcallStub(_handle.bindTo(this), _fdesc, arena); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy