/* ScrolledWindow.c generated by valac 0.56.19, the Vala compiler
 * generated from ScrolledWindow.vala, do not modify */

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.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 WIDGETS_TYPE_SCROLLED_WINDOW (widgets_scrolled_window_get_type ())
#define WIDGETS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow))
#define WIDGETS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindowClass))
#define WIDGETS_IS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SCROLLED_WINDOW))
#define WIDGETS_IS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SCROLLED_WINDOW))
#define WIDGETS_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindowClass))

typedef struct _WidgetsScrolledWindow WidgetsScrolledWindow;
typedef struct _WidgetsScrolledWindowClass WidgetsScrolledWindowClass;
typedef struct _WidgetsScrolledWindowPrivate WidgetsScrolledWindowPrivate;
enum  {
	WIDGETS_SCROLLED_WINDOW_0_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_VADJUSTMENT_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_HADJUSTMENT_PROPERTY,
	WIDGETS_SCROLLED_WINDOW_NUM_PROPERTIES
};
static GParamSpec* widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _WidgetsScrolledWindow {
	AdwBin parent_instance;
	WidgetsScrolledWindowPrivate * priv;
};

struct _WidgetsScrolledWindowClass {
	AdwBinClass parent_class;
};

struct _WidgetsScrolledWindowPrivate {
	GtkWidget* _widget;
	GtkOrientation _orientation;
	gint _margin;
	GtkScrolledWindow* scrolled_window;
	GtkDropControllerMotion* drop_motion_ctrl;
	guint scroll_timeout_id;
	gdouble scroll_speed;
};

static gint WidgetsScrolledWindow_private_offset;
static gpointer widgets_scrolled_window_parent_class = NULL;

VALA_EXTERN GType widgets_scrolled_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsScrolledWindow, g_object_unref)
VALA_EXTERN WidgetsScrolledWindow* widgets_scrolled_window_new (GtkWidget* widget,
                                                    GtkOrientation orientation);
VALA_EXTERN WidgetsScrolledWindow* widgets_scrolled_window_construct (GType object_type,
                                                          GtkWidget* widget,
                                                          GtkOrientation orientation);
static void widgets_scrolled_window_start_auto_scroll (WidgetsScrolledWindow* self);
static gboolean __lambda399_ (WidgetsScrolledWindow* self);
static void widgets_scrolled_window_stop_auto_scroll (WidgetsScrolledWindow* self);
VALA_EXTERN GtkOrientation widgets_scrolled_window_get_orientation (WidgetsScrolledWindow* self);
static gboolean ___lambda399__gsource_func (gpointer self);
VALA_EXTERN GtkWidget* widgets_scrolled_window_get_widget (WidgetsScrolledWindow* self);
static void widgets_scrolled_window_set_widget (WidgetsScrolledWindow* self,
                                         GtkWidget* value);
static void widgets_scrolled_window_set_orientation (WidgetsScrolledWindow* self,
                                              GtkOrientation value);
VALA_EXTERN gint widgets_scrolled_window_get_margin (WidgetsScrolledWindow* self);
VALA_EXTERN void widgets_scrolled_window_set_margin (WidgetsScrolledWindow* self,
                                         gint value);
VALA_EXTERN GtkAdjustment* widgets_scrolled_window_get_vadjustment (WidgetsScrolledWindow* self);
VALA_EXTERN GtkAdjustment* widgets_scrolled_window_get_hadjustment (WidgetsScrolledWindow* self);
static GObject * widgets_scrolled_window_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void _widgets_scrolled_window___lambda400_ (WidgetsScrolledWindow* self,
                                            gdouble x,
                                            gdouble y);
static void __widgets_scrolled_window___lambda400__gtk_drop_controller_motion_motion (GtkDropControllerMotion* _sender,
                                                                               gdouble x,
                                                                               gdouble y,
                                                                               gpointer self);
static void _widgets_scrolled_window___lambda401_ (WidgetsScrolledWindow* self);
static void __widgets_scrolled_window___lambda401__gtk_drop_controller_motion_leave (GtkDropControllerMotion* _sender,
                                                                              gpointer self);
static void widgets_scrolled_window_finalize (GObject * obj);
static GType widgets_scrolled_window_get_type_once (void);
static void _vala_widgets_scrolled_window_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_widgets_scrolled_window_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);

static inline gpointer
widgets_scrolled_window_get_instance_private (WidgetsScrolledWindow* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsScrolledWindow_private_offset);
}

WidgetsScrolledWindow*
widgets_scrolled_window_construct (GType object_type,
                                   GtkWidget* widget,
                                   GtkOrientation orientation)
{
	WidgetsScrolledWindow * self = NULL;
	g_return_val_if_fail (widget != NULL, NULL);
	self = (WidgetsScrolledWindow*) g_object_new (object_type, "widget", widget, "orientation", orientation, NULL);
	return self;
}

WidgetsScrolledWindow*
widgets_scrolled_window_new (GtkWidget* widget,
                             GtkOrientation orientation)
{
	return widgets_scrolled_window_construct (WIDGETS_TYPE_SCROLLED_WINDOW, widget, orientation);
}

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

static gboolean
__lambda399_ (WidgetsScrolledWindow* self)
{
	GtkDropControllerMotion* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkAdjustment* _tmp3_ = NULL;
	GtkOrientation _tmp4_;
	GtkAdjustment* adj = NULL;
	GtkAdjustment* _tmp9_;
	gdouble new_value = 0.0;
	GtkAdjustment* _tmp10_;
	GtkAdjustment* _tmp11_;
	GtkAdjustment* _tmp12_;
	GtkAdjustment* _tmp13_;
	GtkAdjustment* _tmp14_;
	gboolean result;
	_tmp0_ = self->priv->drop_motion_ctrl;
	g_object_get (_tmp0_, "contains-pointer", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		widgets_scrolled_window_stop_auto_scroll (self);
		result = FALSE;
		return result;
	}
	_tmp4_ = self->priv->_orientation;
	if (_tmp4_ == GTK_ORIENTATION_VERTICAL) {
		GtkScrolledWindow* _tmp5_;
		GtkAdjustment* _tmp6_;
		_tmp5_ = self->priv->scrolled_window;
		_tmp6_ = gtk_scrolled_window_get_vadjustment (_tmp5_);
		_tmp3_ = _tmp6_;
	} else {
		GtkScrolledWindow* _tmp7_;
		GtkAdjustment* _tmp8_;
		_tmp7_ = self->priv->scrolled_window;
		_tmp8_ = gtk_scrolled_window_get_hadjustment (_tmp7_);
		_tmp3_ = _tmp8_;
	}
	_tmp9_ = _g_object_ref0 (_tmp3_);
	adj = _tmp9_;
	_tmp10_ = adj;
	new_value = gtk_adjustment_get_value (_tmp10_) + (self->priv->scroll_speed * 10);
	_tmp11_ = adj;
	_tmp12_ = adj;
	_tmp13_ = adj;
	new_value = MAX (gtk_adjustment_get_lower (_tmp11_), MIN (new_value, gtk_adjustment_get_upper (_tmp12_) - gtk_adjustment_get_page_size (_tmp13_)));
	_tmp14_ = adj;
	gtk_adjustment_set_value (_tmp14_, new_value);
	result = TRUE;
	_g_object_unref0 (adj);
	return result;
}

static gboolean
___lambda399__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda399_ ((WidgetsScrolledWindow*) self);
	return result;
}

static void
widgets_scrolled_window_start_auto_scroll (WidgetsScrolledWindow* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->scroll_timeout_id > ((guint) 0)) {
		return;
	}
	self->priv->scroll_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 16, ___lambda399__gsource_func, g_object_ref (self), g_object_unref);
}

static void
widgets_scrolled_window_stop_auto_scroll (WidgetsScrolledWindow* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->scroll_timeout_id > ((guint) 0)) {
		g_source_remove (self->priv->scroll_timeout_id);
		self->priv->scroll_timeout_id = (guint) 0;
	}
	self->priv->scroll_speed = (gdouble) 0;
}

GtkWidget*
widgets_scrolled_window_get_widget (WidgetsScrolledWindow* self)
{
	GtkWidget* result;
	GtkWidget* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_widget;
	result = _tmp0_;
	return result;
}

static void
widgets_scrolled_window_set_widget (WidgetsScrolledWindow* self,
                                    GtkWidget* value)
{
	GtkWidget* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_scrolled_window_get_widget (self);
	if (old_value != value) {
		GtkWidget* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_widget);
		self->priv->_widget = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY]);
	}
}

GtkOrientation
widgets_scrolled_window_get_orientation (WidgetsScrolledWindow* self)
{
	GtkOrientation result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_orientation;
	return result;
}

static void
widgets_scrolled_window_set_orientation (WidgetsScrolledWindow* self,
                                         GtkOrientation value)
{
	GtkOrientation old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_scrolled_window_get_orientation (self);
	if (old_value != value) {
		self->priv->_orientation = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY]);
	}
}

gint
widgets_scrolled_window_get_margin (WidgetsScrolledWindow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_margin;
	return result;
}

void
widgets_scrolled_window_set_margin (WidgetsScrolledWindow* self,
                                    gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_scrolled_window_get_margin (self);
	if (old_value != value) {
		self->priv->_margin = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY]);
	}
}

GtkAdjustment*
widgets_scrolled_window_get_vadjustment (WidgetsScrolledWindow* self)
{
	GtkAdjustment* result;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->scrolled_window;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

GtkAdjustment*
widgets_scrolled_window_get_hadjustment (WidgetsScrolledWindow* self)
{
	GtkAdjustment* result;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->scrolled_window;
	_tmp1_ = gtk_scrolled_window_get_hadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
_widgets_scrolled_window___lambda400_ (WidgetsScrolledWindow* self,
                                       gdouble x,
                                       gdouble y)
{
	gdouble distance_from_edge = 0.0;
	gboolean should_scroll = FALSE;
	gboolean scroll_up = FALSE;
	GtkOrientation _tmp0_;
	distance_from_edge = (gdouble) 0;
	should_scroll = FALSE;
	scroll_up = FALSE;
	_tmp0_ = self->priv->_orientation;
	if (_tmp0_ == GTK_ORIENTATION_VERTICAL) {
		gint height = 0;
		GtkScrolledWindow* _tmp1_;
		gint _tmp2_;
		_tmp1_ = self->priv->scrolled_window;
		height = gtk_widget_get_height ((GtkWidget*) _tmp1_);
		_tmp2_ = self->priv->_margin;
		if (y < ((gdouble) _tmp2_)) {
			gint _tmp3_;
			_tmp3_ = self->priv->_margin;
			distance_from_edge = _tmp3_ - y;
			should_scroll = TRUE;
			scroll_up = TRUE;
		} else {
			gint _tmp4_;
			_tmp4_ = self->priv->_margin;
			if (y > ((gdouble) (height - _tmp4_))) {
				gint _tmp5_;
				_tmp5_ = self->priv->_margin;
				distance_from_edge = y - (height - _tmp5_);
				should_scroll = TRUE;
				scroll_up = FALSE;
			}
		}
	} else {
		gint width = 0;
		GtkScrolledWindow* _tmp6_;
		gint _tmp7_;
		_tmp6_ = self->priv->scrolled_window;
		width = gtk_widget_get_width ((GtkWidget*) _tmp6_);
		_tmp7_ = self->priv->_margin;
		if (x < ((gdouble) _tmp7_)) {
			gint _tmp8_;
			_tmp8_ = self->priv->_margin;
			distance_from_edge = _tmp8_ - x;
			should_scroll = TRUE;
			scroll_up = TRUE;
		} else {
			gint _tmp9_;
			_tmp9_ = self->priv->_margin;
			if (x > ((gdouble) (width - _tmp9_))) {
				gint _tmp10_;
				_tmp10_ = self->priv->_margin;
				distance_from_edge = x - (width - _tmp10_);
				should_scroll = TRUE;
				scroll_up = FALSE;
			}
		}
	}
	if (should_scroll) {
		gint _tmp11_ = 0;
		gint _tmp12_;
		if (scroll_up) {
			_tmp11_ = -1;
		} else {
			_tmp11_ = 1;
		}
		_tmp12_ = self->priv->_margin;
		self->priv->scroll_speed = (distance_from_edge / _tmp12_) * _tmp11_;
		widgets_scrolled_window_start_auto_scroll (self);
	} else {
		widgets_scrolled_window_stop_auto_scroll (self);
	}
}

static void
__widgets_scrolled_window___lambda400__gtk_drop_controller_motion_motion (GtkDropControllerMotion* _sender,
                                                                          gdouble x,
                                                                          gdouble y,
                                                                          gpointer self)
{
	_widgets_scrolled_window___lambda400_ ((WidgetsScrolledWindow*) self, x, y);
}

static void
_widgets_scrolled_window___lambda401_ (WidgetsScrolledWindow* self)
{
	widgets_scrolled_window_stop_auto_scroll (self);
}

static void
__widgets_scrolled_window___lambda401__gtk_drop_controller_motion_leave (GtkDropControllerMotion* _sender,
                                                                         gpointer self)
{
	_widgets_scrolled_window___lambda401_ ((WidgetsScrolledWindow*) self);
}

static GObject *
widgets_scrolled_window_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsScrolledWindow * self;
	GtkPolicyType _tmp0_ = 0;
	GtkOrientation _tmp1_;
	GtkPolicyType _tmp2_ = 0;
	GtkOrientation _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	GtkScrolledWindow* _tmp6_ = NULL;
	GtkDropControllerMotion* _tmp7_;
	GtkScrolledWindow* _tmp8_;
	GtkDropControllerMotion* _tmp9_;
	GtkEventController* _tmp10_;
	GtkDropControllerMotion* _tmp11_;
	GtkDropControllerMotion* _tmp12_;
	GtkScrolledWindow* _tmp13_;
	parent_class = G_OBJECT_CLASS (widgets_scrolled_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow);
	_tmp1_ = self->priv->_orientation;
	if (_tmp1_ == GTK_ORIENTATION_VERTICAL) {
		_tmp0_ = GTK_POLICY_NEVER;
	} else {
		_tmp0_ = GTK_POLICY_AUTOMATIC;
	}
	_tmp3_ = self->priv->_orientation;
	if (_tmp3_ == GTK_ORIENTATION_VERTICAL) {
		_tmp2_ = GTK_POLICY_AUTOMATIC;
	} else {
		_tmp2_ = GTK_POLICY_NEVER;
	}
	_tmp4_ = self->priv->_widget;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_tmp6_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp6_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp6_, TRUE);
	g_object_set (_tmp6_, "hscrollbar-policy", _tmp0_, NULL);
	g_object_set (_tmp6_, "vscrollbar-policy", _tmp2_, NULL);
	gtk_scrolled_window_set_child (_tmp6_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	gtk_scrolled_window_set_propagate_natural_height (_tmp6_, TRUE);
	gtk_scrolled_window_set_propagate_natural_width (_tmp6_, TRUE);
	gtk_widget_set_focusable ((GtkWidget*) _tmp6_, FALSE);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->scrolled_window);
	self->priv->scrolled_window = _tmp6_;
	_tmp7_ = (GtkDropControllerMotion*) gtk_drop_controller_motion_new ();
	_g_object_unref0 (self->priv->drop_motion_ctrl);
	self->priv->drop_motion_ctrl = _tmp7_;
	_tmp8_ = self->priv->scrolled_window;
	_tmp9_ = self->priv->drop_motion_ctrl;
	_tmp10_ = _g_object_ref0 ((GtkEventController*) _tmp9_);
	gtk_widget_add_controller ((GtkWidget*) _tmp8_, _tmp10_);
	_tmp11_ = self->priv->drop_motion_ctrl;
	g_signal_connect_object (_tmp11_, "motion", (GCallback) __widgets_scrolled_window___lambda400__gtk_drop_controller_motion_motion, self, 0);
	_tmp12_ = self->priv->drop_motion_ctrl;
	g_signal_connect_object (_tmp12_, "leave", (GCallback) __widgets_scrolled_window___lambda401__gtk_drop_controller_motion_leave, self, 0);
	_tmp13_ = self->priv->scrolled_window;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp13_);
	return obj;
}

static void
widgets_scrolled_window_class_init (WidgetsScrolledWindowClass * klass,
                                    gpointer klass_data)
{
	widgets_scrolled_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsScrolledWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_scrolled_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_scrolled_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_scrolled_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_scrolled_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY] = g_param_spec_object ("widget", "widget", "widget", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY] = g_param_spec_enum ("orientation", "orientation", "orientation", gtk_orientation_get_type (), 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY] = g_param_spec_int ("margin", "margin", "margin", G_MININT, G_MAXINT, 64, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCROLLED_WINDOW_VADJUSTMENT_PROPERTY, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_VADJUSTMENT_PROPERTY] = g_param_spec_object ("vadjustment", "vadjustment", "vadjustment", gtk_adjustment_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCROLLED_WINDOW_HADJUSTMENT_PROPERTY, widgets_scrolled_window_properties[WIDGETS_SCROLLED_WINDOW_HADJUSTMENT_PROPERTY] = g_param_spec_object ("hadjustment", "hadjustment", "hadjustment", gtk_adjustment_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
widgets_scrolled_window_instance_init (WidgetsScrolledWindow * self,
                                       gpointer klass)
{
	self->priv = widgets_scrolled_window_get_instance_private (self);
	self->priv->_margin = 64;
	self->priv->scroll_timeout_id = (guint) 0;
	self->priv->scroll_speed = (gdouble) 0;
}

static void
widgets_scrolled_window_finalize (GObject * obj)
{
	WidgetsScrolledWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow);
	g_debug ("ScrolledWindow.vala:53: Destroying - Widgets.ScrolledWindow\n");
	_g_object_unref0 (self->priv->_widget);
	_g_object_unref0 (self->priv->scrolled_window);
	_g_object_unref0 (self->priv->drop_motion_ctrl);
	G_OBJECT_CLASS (widgets_scrolled_window_parent_class)->finalize (obj);
}

static GType
widgets_scrolled_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsScrolledWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_scrolled_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsScrolledWindow), 0, (GInstanceInitFunc) widgets_scrolled_window_instance_init, NULL };
	GType widgets_scrolled_window_type_id;
	widgets_scrolled_window_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsScrolledWindow", &g_define_type_info, 0);
	WidgetsScrolledWindow_private_offset = g_type_add_instance_private (widgets_scrolled_window_type_id, sizeof (WidgetsScrolledWindowPrivate));
	return widgets_scrolled_window_type_id;
}

GType
widgets_scrolled_window_get_type (void)
{
	static volatile gsize widgets_scrolled_window_type_id__once = 0;
	if (g_once_init_enter (&widgets_scrolled_window_type_id__once)) {
		GType widgets_scrolled_window_type_id;
		widgets_scrolled_window_type_id = widgets_scrolled_window_get_type_once ();
		g_once_init_leave (&widgets_scrolled_window_type_id__once, widgets_scrolled_window_type_id);
	}
	return widgets_scrolled_window_type_id__once;
}

static void
_vala_widgets_scrolled_window_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	WidgetsScrolledWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow);
	switch (property_id) {
		case WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY:
		g_value_set_object (value, widgets_scrolled_window_get_widget (self));
		break;
		case WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY:
		g_value_set_enum (value, widgets_scrolled_window_get_orientation (self));
		break;
		case WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY:
		g_value_set_int (value, widgets_scrolled_window_get_margin (self));
		break;
		case WIDGETS_SCROLLED_WINDOW_VADJUSTMENT_PROPERTY:
		g_value_set_object (value, widgets_scrolled_window_get_vadjustment (self));
		break;
		case WIDGETS_SCROLLED_WINDOW_HADJUSTMENT_PROPERTY:
		g_value_set_object (value, widgets_scrolled_window_get_hadjustment (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_scrolled_window_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	WidgetsScrolledWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SCROLLED_WINDOW, WidgetsScrolledWindow);
	switch (property_id) {
		case WIDGETS_SCROLLED_WINDOW_WIDGET_PROPERTY:
		widgets_scrolled_window_set_widget (self, g_value_get_object (value));
		break;
		case WIDGETS_SCROLLED_WINDOW_ORIENTATION_PROPERTY:
		widgets_scrolled_window_set_orientation (self, g_value_get_enum (value));
		break;
		case WIDGETS_SCROLLED_WINDOW_MARGIN_PROPERTY:
		widgets_scrolled_window_set_margin (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

