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

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

There is a newer version: 0.11.1
Show newest version
// Java-GI - Java language bindings for GObject-Introspection-based libraries
// Copyright (C) 2022-2024 Jan-Willem Harmannij
//
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see .
//
// This file has been generated with Java-GI.
// Do not edit this file directly!
// Visit  for more information.
//
package org.gnome.gobject;

import io.github.jwharm.javagi.base.ManagedInstance;
import io.github.jwharm.javagi.interop.Interop;
import java.lang.foreign.Arena;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
import javax.annotation.processing.Generated;
import org.gnome.glib.Quark;

/**
 * The {@code GSignalInvocationHint} structure is used to pass on additional information
 * to callbacks during a signal emission.
 */
@Generated("io.github.jwharm.JavaGI")
public class SignalInvocationHint extends ManagedInstance {
    static {
        GObjects.javagi$ensureInitialized();
    }

    /**
     * Create a SignalInvocationHint proxy instance for the provided memory address.
     * @param address the memory address of the native object
     */
    public SignalInvocationHint(MemorySegment address) {
        super(Interop.reinterpret(address, getMemoryLayout().byteSize()));
    }

    /**
     * The memory layout of the native struct.
     * @return the memory layout
     */
    public static MemoryLayout getMemoryLayout() {
        return MemoryLayout.structLayout(
            ValueLayout.JAVA_INT.withName("signal_id"),
            ValueLayout.JAVA_INT.withName("detail"),
            ValueLayout.JAVA_INT.withName("run_type")
        ).withName("GSignalInvocationHint");
    }

    /**
     * Allocate a new SignalInvocationHint.
     *
     * @param  arena to control the memory allocation scope
     * @return a new, uninitialized {@link SignalInvocationHint}
     */
    public static SignalInvocationHint allocate(Arena arena) {
        MemorySegment segment = arena.allocate(getMemoryLayout());
        return new SignalInvocationHint(segment);
    }

    /**
     * Allocate a new SignalInvocationHint with the fields set to the provided values.
     *
     * @param  arena to control the memory allocation scope
     * @param signalId value for the field {@code signalId}
     * @param detail value for the field {@code detail}
     * @param runType value for the field {@code runType}
     * @return a new {@link SignalInvocationHint} with the fields set to the provided values
     */
    public static SignalInvocationHint allocate(Arena arena, int signalId, Quark detail,
            SignalFlags runType) {
        SignalInvocationHint _instance = allocate(arena);
        _instance.writeSignalId(signalId);
        _instance.writeDetail(detail);
        _instance.writeRunType(runType);
        return _instance;
    }

    /**
     * Read the value of the field {@code signal_id}.
     *
     * @return The value of the field {@code signal_id}
     */
    public int readSignalId() {
        var _result = (int) getMemoryLayout()
                .varHandle(MemoryLayout.PathElement.groupElement("signal_id")).get(handle());
        return _result;
    }

    /**
     * Write a value in the field {@code signal_id}.
     *
     * @param signalId The new value for the field {@code signal_id}
     */
    public void writeSignalId(int signalId) {
        getMemoryLayout().varHandle(MemoryLayout.PathElement.groupElement("signal_id"))
                .set(handle(), signalId);
    }

    /**
     * Read the value of the field {@code detail}.
     *
     * @return The value of the field {@code detail}
     */
    public Quark readDetail() {
        var _result = (int) getMemoryLayout()
                .varHandle(MemoryLayout.PathElement.groupElement("detail")).get(handle());
        return new Quark(_result);
    }

    /**
     * Write a value in the field {@code detail}.
     *
     * @param detail The new value for the field {@code detail}
     */
    public void writeDetail(Quark detail) {
        getMemoryLayout().varHandle(MemoryLayout.PathElement.groupElement("detail"))
                .set(handle(), detail.getValue().intValue());
    }

    /**
     * Read the value of the field {@code run_type}.
     *
     * @return The value of the field {@code run_type}
     */
    public SignalFlags readRunType() {
        var _result = (int) getMemoryLayout()
                .varHandle(MemoryLayout.PathElement.groupElement("run_type")).get(handle());
        return new SignalFlags(_result);
    }

    /**
     * Write a value in the field {@code run_type}.
     *
     * @param runType The new value for the field {@code run_type}
     */
    public void writeRunType(SignalFlags runType) {
        getMemoryLayout().varHandle(MemoryLayout.PathElement.groupElement("run_type"))
                .set(handle(), runType.getValue());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy