/* DropOverlay.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from DropOverlay.vala, do not modify */

/* DropOverlay.vala
 *
 * Copyright 2024 Diego Iván M.E <diegoivan.mae@gmail.com>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gdk/gdk.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PAPER_CLIP_TYPE_DROP_OVERLAY (paper_clip_drop_overlay_get_type ())
#define PAPER_CLIP_DROP_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlay))
#define PAPER_CLIP_DROP_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlayClass))
#define PAPER_CLIP_IS_DROP_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_DROP_OVERLAY))
#define PAPER_CLIP_IS_DROP_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_DROP_OVERLAY))
#define PAPER_CLIP_DROP_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlayClass))

typedef struct _PaperClipDropOverlay PaperClipDropOverlay;
typedef struct _PaperClipDropOverlayClass PaperClipDropOverlayClass;
typedef struct _PaperClipDropOverlayPrivate PaperClipDropOverlayPrivate;
enum  {
	PAPER_CLIP_DROP_OVERLAY_0_PROPERTY,
	PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY,
	PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY,
	PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY,
	PAPER_CLIP_DROP_OVERLAY_NUM_PROPERTIES
};
static GParamSpec* paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _PaperClipDropOverlay {
	AdwBin parent_instance;
	PaperClipDropOverlayPrivate * priv;
};

struct _PaperClipDropOverlayClass {
	AdwBinClass parent_class;
};

struct _PaperClipDropOverlayPrivate {
	GtkOverlay* internal_overlay;
	GtkRevealer* internal_revealer;
	GtkDropTarget* _drop_target;
};

static gint PaperClipDropOverlay_private_offset;
static gpointer paper_clip_drop_overlay_parent_class = NULL;

VALA_EXTERN GType paper_clip_drop_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipDropOverlay, g_object_unref)
static void paper_clip_drop_overlay_on_current_drop_notify (PaperClipDropOverlay* self);
VALA_EXTERN GtkDropTarget* paper_clip_drop_overlay_get_drop_target (PaperClipDropOverlay* self);
VALA_EXTERN GtkWidget* paper_clip_drop_overlay_get_overlayed (PaperClipDropOverlay* self);
VALA_EXTERN PaperClipDropOverlay* paper_clip_drop_overlay_new (void);
VALA_EXTERN PaperClipDropOverlay* paper_clip_drop_overlay_construct (GType object_type);
VALA_EXTERN void paper_clip_drop_overlay_set_drop_target (PaperClipDropOverlay* self,
                                              GtkDropTarget* value);
static void _paper_clip_drop_overlay_on_current_drop_notify_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self);
VALA_EXTERN void paper_clip_drop_overlay_set_overlayed (PaperClipDropOverlay* self,
                                            GtkWidget* value);
VALA_EXTERN GtkWidget* paper_clip_drop_overlay_get_child (PaperClipDropOverlay* self);
VALA_EXTERN void paper_clip_drop_overlay_set_child (PaperClipDropOverlay* self,
                                        GtkWidget* value);
static GObject * paper_clip_drop_overlay_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void paper_clip_drop_overlay_finalize (GObject * obj);
static GType paper_clip_drop_overlay_get_type_once (void);
static void _vala_paper_clip_drop_overlay_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_paper_clip_drop_overlay_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);

static inline gpointer
paper_clip_drop_overlay_get_instance_private (PaperClipDropOverlay* self)
{
	return G_STRUCT_MEMBER_P (self, PaperClipDropOverlay_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
paper_clip_drop_overlay_on_current_drop_notify (PaperClipDropOverlay* self)
{
	GdkDrop* drop = NULL;
	GtkDropTarget* _tmp0_;
	GtkDropTarget* _tmp1_;
	GdkDrop* _tmp2_;
	GdkDrop* _tmp3_;
	GdkDrop* _tmp4_;
	GdkDrop* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = paper_clip_drop_overlay_get_drop_target (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_drop_target_get_current_drop (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	drop = _tmp4_;
	_tmp5_ = drop;
	if (_tmp5_ != NULL) {
		GtkRevealer* _tmp6_;
		GtkRevealer* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp6_ = self->priv->internal_revealer;
		gtk_revealer_set_reveal_child (_tmp6_, TRUE);
		_tmp7_ = self->priv->internal_revealer;
		gtk_widget_set_visible ((GtkWidget*) _tmp7_, TRUE);
		_tmp8_ = paper_clip_drop_overlay_get_overlayed (self);
		_tmp9_ = _tmp8_;
		gtk_widget_add_css_class (_tmp9_, "overlay-drag-area");
	} else {
		GtkRevealer* _tmp10_;
		GtkRevealer* _tmp11_;
		GtkWidget* _tmp12_;
		GtkWidget* _tmp13_;
		_tmp10_ = self->priv->internal_revealer;
		gtk_revealer_set_reveal_child (_tmp10_, FALSE);
		_tmp11_ = self->priv->internal_revealer;
		gtk_widget_set_visible ((GtkWidget*) _tmp11_, FALSE);
		_tmp12_ = paper_clip_drop_overlay_get_overlayed (self);
		_tmp13_ = _tmp12_;
		gtk_widget_remove_css_class (_tmp13_, "overlay-drag-area");
	}
	_g_object_unref0 (drop);
}

PaperClipDropOverlay*
paper_clip_drop_overlay_construct (GType object_type)
{
	PaperClipDropOverlay * self = NULL;
	self = (PaperClipDropOverlay*) g_object_new (object_type, NULL);
	return self;
}

PaperClipDropOverlay*
paper_clip_drop_overlay_new (void)
{
	return paper_clip_drop_overlay_construct (PAPER_CLIP_TYPE_DROP_OVERLAY);
}

GtkDropTarget*
paper_clip_drop_overlay_get_drop_target (PaperClipDropOverlay* self)
{
	GtkDropTarget* result;
	GtkDropTarget* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_drop_target;
	result = _tmp0_;
	return result;
}

static void
_paper_clip_drop_overlay_on_current_drop_notify_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self)
{
	paper_clip_drop_overlay_on_current_drop_notify ((PaperClipDropOverlay*) self);
}

void
paper_clip_drop_overlay_set_drop_target (PaperClipDropOverlay* self,
                                         GtkDropTarget* value)
{
	GtkDropTarget* _tmp0_;
	GtkDropTarget* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_drop_target);
	self->priv->_drop_target = _tmp0_;
	_tmp1_ = self->priv->_drop_target;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::current-drop", (GCallback) _paper_clip_drop_overlay_on_current_drop_notify_g_object_notify, self, 0);
	g_object_notify_by_pspec ((GObject *) self, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY]);
}

GtkWidget*
paper_clip_drop_overlay_get_overlayed (PaperClipDropOverlay* self)
{
	GtkWidget* result;
	GtkRevealer* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->internal_revealer;
	_tmp1_ = gtk_revealer_get_child (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
paper_clip_drop_overlay_set_overlayed (PaperClipDropOverlay* self,
                                       GtkWidget* value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->internal_revealer;
	gtk_revealer_set_child (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY]);
}

GtkWidget*
paper_clip_drop_overlay_get_child (PaperClipDropOverlay* self)
{
	GtkWidget* result;
	GtkOverlay* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->internal_overlay;
	_tmp1_ = gtk_overlay_get_child (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
paper_clip_drop_overlay_set_child (PaperClipDropOverlay* self,
                                   GtkWidget* value)
{
	GtkOverlay* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->internal_overlay;
	gtk_overlay_set_child (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY]);
}

static GObject *
paper_clip_drop_overlay_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PaperClipDropOverlay * self;
	GtkOverlay* _tmp0_;
	GtkOverlay* _tmp1_;
	GtkRevealer* _tmp2_;
	GtkRevealer* _tmp3_;
	GtkRevealer* _tmp4_;
	GtkRevealer* _tmp5_;
	parent_class = G_OBJECT_CLASS (paper_clip_drop_overlay_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlay);
	_tmp0_ = self->priv->internal_overlay;
	adw_bin_set_child (G_TYPE_CHECK_INSTANCE_CAST (self, adw_bin_get_type (), AdwBin), (GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->internal_overlay;
	_tmp2_ = self->priv->internal_revealer;
	gtk_overlay_add_overlay (_tmp1_, (GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->internal_revealer;
	gtk_widget_set_can_target ((GtkWidget*) _tmp3_, FALSE);
	_tmp4_ = self->priv->internal_revealer;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, FALSE);
	_tmp5_ = self->priv->internal_revealer;
	gtk_revealer_set_transition_type (_tmp5_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	return obj;
}

static void
paper_clip_drop_overlay_class_init (PaperClipDropOverlayClass * klass,
                                    gpointer klass_data)
{
	paper_clip_drop_overlay_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PaperClipDropOverlay_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_paper_clip_drop_overlay_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_paper_clip_drop_overlay_set_property;
	G_OBJECT_CLASS (klass)->constructor = paper_clip_drop_overlay_constructor;
	G_OBJECT_CLASS (klass)->finalize = paper_clip_drop_overlay_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY] = g_param_spec_object ("drop-target", "drop-target", "drop-target", gtk_drop_target_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY] = g_param_spec_object ("overlayed", "overlayed", "overlayed", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY, paper_clip_drop_overlay_properties[PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY] = g_param_spec_object ("child", "child", "child", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
paper_clip_drop_overlay_instance_init (PaperClipDropOverlay * self,
                                       gpointer klass)
{
	GtkOverlay* _tmp0_;
	GtkRevealer* _tmp1_;
	self->priv = paper_clip_drop_overlay_get_instance_private (self);
	_tmp0_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp0_);
	self->priv->internal_overlay = _tmp0_;
	_tmp1_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp1_);
	self->priv->internal_revealer = _tmp1_;
}

static void
paper_clip_drop_overlay_finalize (GObject * obj)
{
	PaperClipDropOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlay);
	_g_object_unref0 (self->priv->internal_overlay);
	_g_object_unref0 (self->priv->internal_revealer);
	_g_object_unref0 (self->priv->_drop_target);
	G_OBJECT_CLASS (paper_clip_drop_overlay_parent_class)->finalize (obj);
}

static GType
paper_clip_drop_overlay_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PaperClipDropOverlayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) paper_clip_drop_overlay_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PaperClipDropOverlay), 0, (GInstanceInitFunc) paper_clip_drop_overlay_instance_init, NULL };
	GType paper_clip_drop_overlay_type_id;
	paper_clip_drop_overlay_type_id = g_type_register_static (adw_bin_get_type (), "PaperClipDropOverlay", &g_define_type_info, 0);
	PaperClipDropOverlay_private_offset = g_type_add_instance_private (paper_clip_drop_overlay_type_id, sizeof (PaperClipDropOverlayPrivate));
	return paper_clip_drop_overlay_type_id;
}

GType
paper_clip_drop_overlay_get_type (void)
{
	static volatile gsize paper_clip_drop_overlay_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_drop_overlay_type_id__once)) {
		GType paper_clip_drop_overlay_type_id;
		paper_clip_drop_overlay_type_id = paper_clip_drop_overlay_get_type_once ();
		g_once_init_leave (&paper_clip_drop_overlay_type_id__once, paper_clip_drop_overlay_type_id);
	}
	return paper_clip_drop_overlay_type_id__once;
}

static void
_vala_paper_clip_drop_overlay_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	PaperClipDropOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlay);
	switch (property_id) {
		case PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY:
		g_value_set_object (value, paper_clip_drop_overlay_get_drop_target (self));
		break;
		case PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY:
		g_value_set_object (value, paper_clip_drop_overlay_get_overlayed (self));
		break;
		case PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY:
		g_value_set_object (value, paper_clip_drop_overlay_get_child (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_paper_clip_drop_overlay_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	PaperClipDropOverlay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_TYPE_DROP_OVERLAY, PaperClipDropOverlay);
	switch (property_id) {
		case PAPER_CLIP_DROP_OVERLAY_DROP_TARGET_PROPERTY:
		paper_clip_drop_overlay_set_drop_target (self, g_value_get_object (value));
		break;
		case PAPER_CLIP_DROP_OVERLAY_OVERLAYED_PROPERTY:
		paper_clip_drop_overlay_set_overlayed (self, g_value_get_object (value));
		break;
		case PAPER_CLIP_DROP_OVERLAY_CHILD_PROPERTY:
		paper_clip_drop_overlay_set_child (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

