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

/*
 * Copyright (c) 2022-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_ui.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <glib-object.h>
#include <string.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

typedef struct _FtGizmo FtGizmo;
typedef struct _FtGizmoClass FtGizmoClass;
typedef struct _FtGizmoPrivate FtGizmoPrivate;
enum  {
	FT_GIZMO_0_PROPERTY,
	FT_GIZMO_NUM_PROPERTIES
};
static GParamSpec* ft_gizmo_properties[FT_GIZMO_NUM_PROPERTIES];

struct _FtGizmo {
	GtkWidget parent_instance;
	FtGizmoPrivate * priv;
};

struct _FtGizmoClass {
	GtkWidgetClass parent_class;
};

struct _FtGizmoPrivate {
	FtGizmoMeasureFunc measure_func;
	gpointer measure_func_target;
	GDestroyNotify measure_func_target_destroy_notify;
	FtGizmoAllocateFunc allocate_func;
	gpointer allocate_func_target;
	GDestroyNotify allocate_func_target_destroy_notify;
	FtGizmoSnapshotFunc snapshot_func;
	gpointer snapshot_func_target;
	GDestroyNotify snapshot_func_target_destroy_notify;
	FtGizmoContainsFunc contains_func;
	gpointer contains_func_target;
	GDestroyNotify contains_func_target_destroy_notify;
	FtGizmoFocusFunc focus_func;
	gpointer focus_func_target;
	GDestroyNotify focus_func_target_destroy_notify;
	FtGizmoGrabFocusFunc grab_focus_func;
	gpointer grab_focus_func_target;
	GDestroyNotify grab_focus_func_target_destroy_notify;
};

static gint FtGizmo_private_offset;
static gpointer ft_gizmo_parent_class = NULL;

static GtkSizeRequestMode ft_gizmo_real_get_request_mode (GtkWidget* base);
static void ft_gizmo_real_measure (GtkWidget* base,
                            GtkOrientation orientation,
                            gint for_size,
                            gint* minimum,
                            gint* natural,
                            gint* minimum_baseline,
                            gint* natural_baseline);
static void ft_gizmo_real_size_allocate (GtkWidget* base,
                                  gint width,
                                  gint height,
                                  gint baseline);
static void ft_gizmo_real_snapshot (GtkWidget* base,
                             GtkSnapshot* snapshot);
static gboolean ft_gizmo_real_contains (GtkWidget* base,
                                 gdouble x,
                                 gdouble y);
static gboolean ft_gizmo_real_focus (GtkWidget* base,
                              GtkDirectionType direction);
static gboolean ft_gizmo_real_grab_focus (GtkWidget* base);
static void ft_gizmo_real_dispose (GObject* base);
static void ft_gizmo_finalize (GObject * obj);
static GType ft_gizmo_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
ft_gizmo_get_instance_private (FtGizmo* self)
{
	return G_STRUCT_MEMBER_P (self, FtGizmo_private_offset);
}

FtGizmo*
ft_gizmo_construct (GType object_type,
                    FtGizmoMeasureFunc measure_func,
                    gpointer measure_func_target,
                    GDestroyNotify measure_func_target_destroy_notify,
                    FtGizmoAllocateFunc allocate_func,
                    gpointer allocate_func_target,
                    GDestroyNotify allocate_func_target_destroy_notify,
                    FtGizmoSnapshotFunc snapshot_func,
                    gpointer snapshot_func_target,
                    GDestroyNotify snapshot_func_target_destroy_notify,
                    FtGizmoContainsFunc contains_func,
                    gpointer contains_func_target,
                    GDestroyNotify contains_func_target_destroy_notify,
                    FtGizmoFocusFunc focus_func,
                    gpointer focus_func_target,
                    GDestroyNotify focus_func_target_destroy_notify,
                    FtGizmoGrabFocusFunc grab_focus_func,
                    gpointer grab_focus_func_target,
                    GDestroyNotify grab_focus_func_target_destroy_notify)
{
	FtGizmo * self = NULL;
	FtGizmoMeasureFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	FtGizmoAllocateFunc _tmp1_;
	gpointer _tmp1__target;
	GDestroyNotify _tmp1__target_destroy_notify;
	FtGizmoSnapshotFunc _tmp2_;
	gpointer _tmp2__target;
	GDestroyNotify _tmp2__target_destroy_notify;
	FtGizmoContainsFunc _tmp3_;
	gpointer _tmp3__target;
	GDestroyNotify _tmp3__target_destroy_notify;
	FtGizmoFocusFunc _tmp4_;
	gpointer _tmp4__target;
	GDestroyNotify _tmp4__target_destroy_notify;
	FtGizmoGrabFocusFunc _tmp5_;
	gpointer _tmp5__target;
	GDestroyNotify _tmp5__target_destroy_notify;
	self = (FtGizmo*) g_object_new (object_type, NULL);
	_tmp0_ = measure_func;
	_tmp0__target = measure_func_target;
	_tmp0__target_destroy_notify = measure_func_target_destroy_notify;
	measure_func = NULL;
	measure_func_target = NULL;
	measure_func_target_destroy_notify = NULL;
	(self->priv->measure_func_target_destroy_notify == NULL) ? NULL : (self->priv->measure_func_target_destroy_notify (self->priv->measure_func_target), NULL);
	self->priv->measure_func = NULL;
	self->priv->measure_func_target = NULL;
	self->priv->measure_func_target_destroy_notify = NULL;
	self->priv->measure_func = _tmp0_;
	self->priv->measure_func_target = _tmp0__target;
	self->priv->measure_func_target_destroy_notify = _tmp0__target_destroy_notify;
	_tmp1_ = allocate_func;
	_tmp1__target = allocate_func_target;
	_tmp1__target_destroy_notify = allocate_func_target_destroy_notify;
	allocate_func = NULL;
	allocate_func_target = NULL;
	allocate_func_target_destroy_notify = NULL;
	(self->priv->allocate_func_target_destroy_notify == NULL) ? NULL : (self->priv->allocate_func_target_destroy_notify (self->priv->allocate_func_target), NULL);
	self->priv->allocate_func = NULL;
	self->priv->allocate_func_target = NULL;
	self->priv->allocate_func_target_destroy_notify = NULL;
	self->priv->allocate_func = _tmp1_;
	self->priv->allocate_func_target = _tmp1__target;
	self->priv->allocate_func_target_destroy_notify = _tmp1__target_destroy_notify;
	_tmp2_ = snapshot_func;
	_tmp2__target = snapshot_func_target;
	_tmp2__target_destroy_notify = snapshot_func_target_destroy_notify;
	snapshot_func = NULL;
	snapshot_func_target = NULL;
	snapshot_func_target_destroy_notify = NULL;
	(self->priv->snapshot_func_target_destroy_notify == NULL) ? NULL : (self->priv->snapshot_func_target_destroy_notify (self->priv->snapshot_func_target), NULL);
	self->priv->snapshot_func = NULL;
	self->priv->snapshot_func_target = NULL;
	self->priv->snapshot_func_target_destroy_notify = NULL;
	self->priv->snapshot_func = _tmp2_;
	self->priv->snapshot_func_target = _tmp2__target;
	self->priv->snapshot_func_target_destroy_notify = _tmp2__target_destroy_notify;
	_tmp3_ = contains_func;
	_tmp3__target = contains_func_target;
	_tmp3__target_destroy_notify = contains_func_target_destroy_notify;
	contains_func = NULL;
	contains_func_target = NULL;
	contains_func_target_destroy_notify = NULL;
	(self->priv->contains_func_target_destroy_notify == NULL) ? NULL : (self->priv->contains_func_target_destroy_notify (self->priv->contains_func_target), NULL);
	self->priv->contains_func = NULL;
	self->priv->contains_func_target = NULL;
	self->priv->contains_func_target_destroy_notify = NULL;
	self->priv->contains_func = _tmp3_;
	self->priv->contains_func_target = _tmp3__target;
	self->priv->contains_func_target_destroy_notify = _tmp3__target_destroy_notify;
	_tmp4_ = focus_func;
	_tmp4__target = focus_func_target;
	_tmp4__target_destroy_notify = focus_func_target_destroy_notify;
	focus_func = NULL;
	focus_func_target = NULL;
	focus_func_target_destroy_notify = NULL;
	(self->priv->focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->focus_func_target_destroy_notify (self->priv->focus_func_target), NULL);
	self->priv->focus_func = NULL;
	self->priv->focus_func_target = NULL;
	self->priv->focus_func_target_destroy_notify = NULL;
	self->priv->focus_func = _tmp4_;
	self->priv->focus_func_target = _tmp4__target;
	self->priv->focus_func_target_destroy_notify = _tmp4__target_destroy_notify;
	_tmp5_ = grab_focus_func;
	_tmp5__target = grab_focus_func_target;
	_tmp5__target_destroy_notify = grab_focus_func_target_destroy_notify;
	grab_focus_func = NULL;
	grab_focus_func_target = NULL;
	grab_focus_func_target_destroy_notify = NULL;
	(self->priv->grab_focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->grab_focus_func_target_destroy_notify (self->priv->grab_focus_func_target), NULL);
	self->priv->grab_focus_func = NULL;
	self->priv->grab_focus_func_target = NULL;
	self->priv->grab_focus_func_target_destroy_notify = NULL;
	self->priv->grab_focus_func = _tmp5_;
	self->priv->grab_focus_func_target = _tmp5__target;
	self->priv->grab_focus_func_target_destroy_notify = _tmp5__target_destroy_notify;
	(measure_func_target_destroy_notify == NULL) ? NULL : (measure_func_target_destroy_notify (measure_func_target), NULL);
	measure_func = NULL;
	measure_func_target = NULL;
	measure_func_target_destroy_notify = NULL;
	(allocate_func_target_destroy_notify == NULL) ? NULL : (allocate_func_target_destroy_notify (allocate_func_target), NULL);
	allocate_func = NULL;
	allocate_func_target = NULL;
	allocate_func_target_destroy_notify = NULL;
	(snapshot_func_target_destroy_notify == NULL) ? NULL : (snapshot_func_target_destroy_notify (snapshot_func_target), NULL);
	snapshot_func = NULL;
	snapshot_func_target = NULL;
	snapshot_func_target_destroy_notify = NULL;
	(contains_func_target_destroy_notify == NULL) ? NULL : (contains_func_target_destroy_notify (contains_func_target), NULL);
	contains_func = NULL;
	contains_func_target = NULL;
	contains_func_target_destroy_notify = NULL;
	(focus_func_target_destroy_notify == NULL) ? NULL : (focus_func_target_destroy_notify (focus_func_target), NULL);
	focus_func = NULL;
	focus_func_target = NULL;
	focus_func_target_destroy_notify = NULL;
	(grab_focus_func_target_destroy_notify == NULL) ? NULL : (grab_focus_func_target_destroy_notify (grab_focus_func_target), NULL);
	grab_focus_func = NULL;
	grab_focus_func_target = NULL;
	grab_focus_func_target_destroy_notify = NULL;
	return self;
}

FtGizmo*
ft_gizmo_new (FtGizmoMeasureFunc measure_func,
              gpointer measure_func_target,
              GDestroyNotify measure_func_target_destroy_notify,
              FtGizmoAllocateFunc allocate_func,
              gpointer allocate_func_target,
              GDestroyNotify allocate_func_target_destroy_notify,
              FtGizmoSnapshotFunc snapshot_func,
              gpointer snapshot_func_target,
              GDestroyNotify snapshot_func_target_destroy_notify,
              FtGizmoContainsFunc contains_func,
              gpointer contains_func_target,
              GDestroyNotify contains_func_target_destroy_notify,
              FtGizmoFocusFunc focus_func,
              gpointer focus_func_target,
              GDestroyNotify focus_func_target_destroy_notify,
              FtGizmoGrabFocusFunc grab_focus_func,
              gpointer grab_focus_func_target,
              GDestroyNotify grab_focus_func_target_destroy_notify)
{
	return ft_gizmo_construct (FT_TYPE_GIZMO, measure_func, measure_func_target, measure_func_target_destroy_notify, allocate_func, allocate_func_target, allocate_func_target_destroy_notify, snapshot_func, snapshot_func_target, snapshot_func_target_destroy_notify, contains_func, contains_func_target, contains_func_target_destroy_notify, focus_func, focus_func_target, focus_func_target_destroy_notify, grab_focus_func, grab_focus_func_target, grab_focus_func_target_destroy_notify);
}

FtGizmo*
ft_gizmo_construct_with_role (GType object_type,
                              GtkAccessibleRole role,
                              FtGizmoMeasureFunc measure_func,
                              gpointer measure_func_target,
                              GDestroyNotify measure_func_target_destroy_notify,
                              FtGizmoAllocateFunc allocate_func,
                              gpointer allocate_func_target,
                              GDestroyNotify allocate_func_target_destroy_notify,
                              FtGizmoSnapshotFunc snapshot_func,
                              gpointer snapshot_func_target,
                              GDestroyNotify snapshot_func_target_destroy_notify,
                              FtGizmoContainsFunc contains_func,
                              gpointer contains_func_target,
                              GDestroyNotify contains_func_target_destroy_notify,
                              FtGizmoFocusFunc focus_func,
                              gpointer focus_func_target,
                              GDestroyNotify focus_func_target_destroy_notify,
                              FtGizmoGrabFocusFunc grab_focus_func,
                              gpointer grab_focus_func_target,
                              GDestroyNotify grab_focus_func_target_destroy_notify)
{
	FtGizmo * self = NULL;
	FtGizmoMeasureFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	FtGizmoAllocateFunc _tmp1_;
	gpointer _tmp1__target;
	GDestroyNotify _tmp1__target_destroy_notify;
	FtGizmoSnapshotFunc _tmp2_;
	gpointer _tmp2__target;
	GDestroyNotify _tmp2__target_destroy_notify;
	FtGizmoContainsFunc _tmp3_;
	gpointer _tmp3__target;
	GDestroyNotify _tmp3__target_destroy_notify;
	FtGizmoFocusFunc _tmp4_;
	gpointer _tmp4__target;
	GDestroyNotify _tmp4__target_destroy_notify;
	FtGizmoGrabFocusFunc _tmp5_;
	gpointer _tmp5__target;
	GDestroyNotify _tmp5__target_destroy_notify;
	self = (FtGizmo*) g_object_new (object_type, "accessible-role", role, NULL);
	_tmp0_ = measure_func;
	_tmp0__target = measure_func_target;
	_tmp0__target_destroy_notify = measure_func_target_destroy_notify;
	measure_func = NULL;
	measure_func_target = NULL;
	measure_func_target_destroy_notify = NULL;
	(self->priv->measure_func_target_destroy_notify == NULL) ? NULL : (self->priv->measure_func_target_destroy_notify (self->priv->measure_func_target), NULL);
	self->priv->measure_func = NULL;
	self->priv->measure_func_target = NULL;
	self->priv->measure_func_target_destroy_notify = NULL;
	self->priv->measure_func = _tmp0_;
	self->priv->measure_func_target = _tmp0__target;
	self->priv->measure_func_target_destroy_notify = _tmp0__target_destroy_notify;
	_tmp1_ = allocate_func;
	_tmp1__target = allocate_func_target;
	_tmp1__target_destroy_notify = allocate_func_target_destroy_notify;
	allocate_func = NULL;
	allocate_func_target = NULL;
	allocate_func_target_destroy_notify = NULL;
	(self->priv->allocate_func_target_destroy_notify == NULL) ? NULL : (self->priv->allocate_func_target_destroy_notify (self->priv->allocate_func_target), NULL);
	self->priv->allocate_func = NULL;
	self->priv->allocate_func_target = NULL;
	self->priv->allocate_func_target_destroy_notify = NULL;
	self->priv->allocate_func = _tmp1_;
	self->priv->allocate_func_target = _tmp1__target;
	self->priv->allocate_func_target_destroy_notify = _tmp1__target_destroy_notify;
	_tmp2_ = snapshot_func;
	_tmp2__target = snapshot_func_target;
	_tmp2__target_destroy_notify = snapshot_func_target_destroy_notify;
	snapshot_func = NULL;
	snapshot_func_target = NULL;
	snapshot_func_target_destroy_notify = NULL;
	(self->priv->snapshot_func_target_destroy_notify == NULL) ? NULL : (self->priv->snapshot_func_target_destroy_notify (self->priv->snapshot_func_target), NULL);
	self->priv->snapshot_func = NULL;
	self->priv->snapshot_func_target = NULL;
	self->priv->snapshot_func_target_destroy_notify = NULL;
	self->priv->snapshot_func = _tmp2_;
	self->priv->snapshot_func_target = _tmp2__target;
	self->priv->snapshot_func_target_destroy_notify = _tmp2__target_destroy_notify;
	_tmp3_ = contains_func;
	_tmp3__target = contains_func_target;
	_tmp3__target_destroy_notify = contains_func_target_destroy_notify;
	contains_func = NULL;
	contains_func_target = NULL;
	contains_func_target_destroy_notify = NULL;
	(self->priv->contains_func_target_destroy_notify == NULL) ? NULL : (self->priv->contains_func_target_destroy_notify (self->priv->contains_func_target), NULL);
	self->priv->contains_func = NULL;
	self->priv->contains_func_target = NULL;
	self->priv->contains_func_target_destroy_notify = NULL;
	self->priv->contains_func = _tmp3_;
	self->priv->contains_func_target = _tmp3__target;
	self->priv->contains_func_target_destroy_notify = _tmp3__target_destroy_notify;
	_tmp4_ = focus_func;
	_tmp4__target = focus_func_target;
	_tmp4__target_destroy_notify = focus_func_target_destroy_notify;
	focus_func = NULL;
	focus_func_target = NULL;
	focus_func_target_destroy_notify = NULL;
	(self->priv->focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->focus_func_target_destroy_notify (self->priv->focus_func_target), NULL);
	self->priv->focus_func = NULL;
	self->priv->focus_func_target = NULL;
	self->priv->focus_func_target_destroy_notify = NULL;
	self->priv->focus_func = _tmp4_;
	self->priv->focus_func_target = _tmp4__target;
	self->priv->focus_func_target_destroy_notify = _tmp4__target_destroy_notify;
	_tmp5_ = grab_focus_func;
	_tmp5__target = grab_focus_func_target;
	_tmp5__target_destroy_notify = grab_focus_func_target_destroy_notify;
	grab_focus_func = NULL;
	grab_focus_func_target = NULL;
	grab_focus_func_target_destroy_notify = NULL;
	(self->priv->grab_focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->grab_focus_func_target_destroy_notify (self->priv->grab_focus_func_target), NULL);
	self->priv->grab_focus_func = NULL;
	self->priv->grab_focus_func_target = NULL;
	self->priv->grab_focus_func_target_destroy_notify = NULL;
	self->priv->grab_focus_func = _tmp5_;
	self->priv->grab_focus_func_target = _tmp5__target;
	self->priv->grab_focus_func_target_destroy_notify = _tmp5__target_destroy_notify;
	(measure_func_target_destroy_notify == NULL) ? NULL : (measure_func_target_destroy_notify (measure_func_target), NULL);
	measure_func = NULL;
	measure_func_target = NULL;
	measure_func_target_destroy_notify = NULL;
	(allocate_func_target_destroy_notify == NULL) ? NULL : (allocate_func_target_destroy_notify (allocate_func_target), NULL);
	allocate_func = NULL;
	allocate_func_target = NULL;
	allocate_func_target_destroy_notify = NULL;
	(snapshot_func_target_destroy_notify == NULL) ? NULL : (snapshot_func_target_destroy_notify (snapshot_func_target), NULL);
	snapshot_func = NULL;
	snapshot_func_target = NULL;
	snapshot_func_target_destroy_notify = NULL;
	(contains_func_target_destroy_notify == NULL) ? NULL : (contains_func_target_destroy_notify (contains_func_target), NULL);
	contains_func = NULL;
	contains_func_target = NULL;
	contains_func_target_destroy_notify = NULL;
	(focus_func_target_destroy_notify == NULL) ? NULL : (focus_func_target_destroy_notify (focus_func_target), NULL);
	focus_func = NULL;
	focus_func_target = NULL;
	focus_func_target_destroy_notify = NULL;
	(grab_focus_func_target_destroy_notify == NULL) ? NULL : (grab_focus_func_target_destroy_notify (grab_focus_func_target), NULL);
	grab_focus_func = NULL;
	grab_focus_func_target = NULL;
	grab_focus_func_target_destroy_notify = NULL;
	return self;
}

FtGizmo*
ft_gizmo_new_with_role (GtkAccessibleRole role,
                        FtGizmoMeasureFunc measure_func,
                        gpointer measure_func_target,
                        GDestroyNotify measure_func_target_destroy_notify,
                        FtGizmoAllocateFunc allocate_func,
                        gpointer allocate_func_target,
                        GDestroyNotify allocate_func_target_destroy_notify,
                        FtGizmoSnapshotFunc snapshot_func,
                        gpointer snapshot_func_target,
                        GDestroyNotify snapshot_func_target_destroy_notify,
                        FtGizmoContainsFunc contains_func,
                        gpointer contains_func_target,
                        GDestroyNotify contains_func_target_destroy_notify,
                        FtGizmoFocusFunc focus_func,
                        gpointer focus_func_target,
                        GDestroyNotify focus_func_target_destroy_notify,
                        FtGizmoGrabFocusFunc grab_focus_func,
                        gpointer grab_focus_func_target,
                        GDestroyNotify grab_focus_func_target_destroy_notify)
{
	return ft_gizmo_construct_with_role (FT_TYPE_GIZMO, role, measure_func, measure_func_target, measure_func_target_destroy_notify, allocate_func, allocate_func_target, allocate_func_target_destroy_notify, snapshot_func, snapshot_func_target, snapshot_func_target_destroy_notify, contains_func, contains_func_target, contains_func_target_destroy_notify, focus_func, focus_func_target, focus_func_target_destroy_notify, grab_focus_func, grab_focus_func_target, grab_focus_func_target_destroy_notify);
}

static GtkSizeRequestMode
ft_gizmo_real_get_request_mode (GtkWidget* base)
{
	FtGizmo * self;
	GtkSizeRequestMode result;
	self = (FtGizmo*) base;
	result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
	return result;
}

static void
ft_gizmo_real_measure (GtkWidget* base,
                       GtkOrientation orientation,
                       gint for_size,
                       gint* minimum,
                       gint* natural,
                       gint* minimum_baseline,
                       gint* natural_baseline)
{
	FtGizmo * self;
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	FtGizmoMeasureFunc _tmp0_;
	gpointer _tmp0__target;
	self = (FtGizmo*) base;
	_tmp0_ = self->priv->measure_func;
	_tmp0__target = self->priv->measure_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoMeasureFunc _tmp1_;
		gpointer _tmp1__target;
		gint _tmp2_ = 0;
		gint _tmp3_ = 0;
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		_tmp1_ = self->priv->measure_func;
		_tmp1__target = self->priv->measure_func_target;
		_tmp1_ (self, orientation, for_size, &_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, _tmp1__target);
		_vala_minimum = _tmp2_;
		_vala_natural = _tmp3_;
		_vala_minimum_baseline = _tmp4_;
		_vala_natural_baseline = _tmp5_;
	} else {
		_vala_minimum = 0;
		_vala_natural = for_size;
		_vala_minimum_baseline = -1;
		_vala_natural_baseline = -1;
	}
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

static void
ft_gizmo_real_size_allocate (GtkWidget* base,
                             gint width,
                             gint height,
                             gint baseline)
{
	FtGizmo * self;
	FtGizmoAllocateFunc _tmp0_;
	gpointer _tmp0__target;
	self = (FtGizmo*) base;
	_tmp0_ = self->priv->allocate_func;
	_tmp0__target = self->priv->allocate_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoAllocateFunc _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->allocate_func;
		_tmp1__target = self->priv->allocate_func_target;
		_tmp1_ (self, width, height, baseline, _tmp1__target);
	}
}

static void
ft_gizmo_real_snapshot (GtkWidget* base,
                        GtkSnapshot* snapshot)
{
	FtGizmo * self;
	FtGizmoSnapshotFunc _tmp0_;
	gpointer _tmp0__target;
	self = (FtGizmo*) base;
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = self->priv->snapshot_func;
	_tmp0__target = self->priv->snapshot_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoSnapshotFunc _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->snapshot_func;
		_tmp1__target = self->priv->snapshot_func_target;
		_tmp1_ (self, snapshot, _tmp1__target);
	} else {
		GTK_WIDGET_CLASS (ft_gizmo_parent_class)->snapshot (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), snapshot);
	}
}

static gboolean
ft_gizmo_real_contains (GtkWidget* base,
                        gdouble x,
                        gdouble y)
{
	FtGizmo * self;
	FtGizmoContainsFunc _tmp0_;
	gpointer _tmp0__target;
	gboolean result;
	self = (FtGizmo*) base;
	_tmp0_ = self->priv->contains_func;
	_tmp0__target = self->priv->contains_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoContainsFunc _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->contains_func;
		_tmp1__target = self->priv->contains_func_target;
		result = _tmp1_ (self, x, y, _tmp1__target);
		return result;
	}
	result = GTK_WIDGET_CLASS (ft_gizmo_parent_class)->contains (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), x, y);
	return result;
}

static gboolean
ft_gizmo_real_focus (GtkWidget* base,
                     GtkDirectionType direction)
{
	FtGizmo * self;
	FtGizmoFocusFunc _tmp0_;
	gpointer _tmp0__target;
	gboolean result;
	self = (FtGizmo*) base;
	_tmp0_ = self->priv->focus_func;
	_tmp0__target = self->priv->focus_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoFocusFunc _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->focus_func;
		_tmp1__target = self->priv->focus_func_target;
		result = _tmp1_ (self, direction, _tmp1__target);
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
ft_gizmo_real_grab_focus (GtkWidget* base)
{
	FtGizmo * self;
	FtGizmoGrabFocusFunc _tmp0_;
	gpointer _tmp0__target;
	gboolean result;
	self = (FtGizmo*) base;
	_tmp0_ = self->priv->grab_focus_func;
	_tmp0__target = self->priv->grab_focus_func_target;
	if (_tmp0_ != NULL) {
		FtGizmoGrabFocusFunc _tmp1_;
		gpointer _tmp1__target;
		_tmp1_ = self->priv->grab_focus_func;
		_tmp1__target = self->priv->grab_focus_func_target;
		result = _tmp1_ (self, _tmp1__target);
		return result;
	}
	result = FALSE;
	return result;
}

static void
ft_gizmo_real_dispose (GObject* base)
{
	FtGizmo * self;
	self = (FtGizmo*) base;
	(self->priv->measure_func_target_destroy_notify == NULL) ? NULL : (self->priv->measure_func_target_destroy_notify (self->priv->measure_func_target), NULL);
	self->priv->measure_func = NULL;
	self->priv->measure_func_target = NULL;
	self->priv->measure_func_target_destroy_notify = NULL;
	self->priv->measure_func = NULL;
	self->priv->measure_func_target = NULL;
	self->priv->measure_func_target_destroy_notify = NULL;
	(self->priv->allocate_func_target_destroy_notify == NULL) ? NULL : (self->priv->allocate_func_target_destroy_notify (self->priv->allocate_func_target), NULL);
	self->priv->allocate_func = NULL;
	self->priv->allocate_func_target = NULL;
	self->priv->allocate_func_target_destroy_notify = NULL;
	self->priv->allocate_func = NULL;
	self->priv->allocate_func_target = NULL;
	self->priv->allocate_func_target_destroy_notify = NULL;
	(self->priv->snapshot_func_target_destroy_notify == NULL) ? NULL : (self->priv->snapshot_func_target_destroy_notify (self->priv->snapshot_func_target), NULL);
	self->priv->snapshot_func = NULL;
	self->priv->snapshot_func_target = NULL;
	self->priv->snapshot_func_target_destroy_notify = NULL;
	self->priv->snapshot_func = NULL;
	self->priv->snapshot_func_target = NULL;
	self->priv->snapshot_func_target_destroy_notify = NULL;
	(self->priv->contains_func_target_destroy_notify == NULL) ? NULL : (self->priv->contains_func_target_destroy_notify (self->priv->contains_func_target), NULL);
	self->priv->contains_func = NULL;
	self->priv->contains_func_target = NULL;
	self->priv->contains_func_target_destroy_notify = NULL;
	self->priv->contains_func = NULL;
	self->priv->contains_func_target = NULL;
	self->priv->contains_func_target_destroy_notify = NULL;
	(self->priv->focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->focus_func_target_destroy_notify (self->priv->focus_func_target), NULL);
	self->priv->focus_func = NULL;
	self->priv->focus_func_target = NULL;
	self->priv->focus_func_target_destroy_notify = NULL;
	self->priv->focus_func = NULL;
	self->priv->focus_func_target = NULL;
	self->priv->focus_func_target_destroy_notify = NULL;
	(self->priv->grab_focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->grab_focus_func_target_destroy_notify (self->priv->grab_focus_func_target), NULL);
	self->priv->grab_focus_func = NULL;
	self->priv->grab_focus_func_target = NULL;
	self->priv->grab_focus_func_target_destroy_notify = NULL;
	self->priv->grab_focus_func = NULL;
	self->priv->grab_focus_func_target = NULL;
	self->priv->grab_focus_func_target_destroy_notify = NULL;
	G_OBJECT_CLASS (ft_gizmo_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

static void
ft_gizmo_class_init (FtGizmoClass * klass,
                     gpointer klass_data)
{
	ft_gizmo_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtGizmo_private_offset);
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) ft_gizmo_real_get_request_mode;
	((GtkWidgetClass *) klass)->measure = (void (*) (GtkWidget*, GtkOrientation, gint, gint*, gint*, gint*, gint*)) ft_gizmo_real_measure;
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, gint, gint, gint)) ft_gizmo_real_size_allocate;
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) ft_gizmo_real_snapshot;
	((GtkWidgetClass *) klass)->contains = (gboolean (*) (GtkWidget*, gdouble, gdouble)) ft_gizmo_real_contains;
	((GtkWidgetClass *) klass)->focus = (gboolean (*) (GtkWidget*, GtkDirectionType)) ft_gizmo_real_focus;
	((GtkWidgetClass *) klass)->grab_focus = (gboolean (*) (GtkWidget*)) ft_gizmo_real_grab_focus;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_gizmo_real_dispose;
	G_OBJECT_CLASS (klass)->finalize = ft_gizmo_finalize;
}

static void
ft_gizmo_instance_init (FtGizmo * self,
                        gpointer klass)
{
	self->priv = ft_gizmo_get_instance_private (self);
}

static void
ft_gizmo_finalize (GObject * obj)
{
	FtGizmo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_GIZMO, FtGizmo);
	(self->priv->measure_func_target_destroy_notify == NULL) ? NULL : (self->priv->measure_func_target_destroy_notify (self->priv->measure_func_target), NULL);
	self->priv->measure_func = NULL;
	self->priv->measure_func_target = NULL;
	self->priv->measure_func_target_destroy_notify = NULL;
	(self->priv->allocate_func_target_destroy_notify == NULL) ? NULL : (self->priv->allocate_func_target_destroy_notify (self->priv->allocate_func_target), NULL);
	self->priv->allocate_func = NULL;
	self->priv->allocate_func_target = NULL;
	self->priv->allocate_func_target_destroy_notify = NULL;
	(self->priv->snapshot_func_target_destroy_notify == NULL) ? NULL : (self->priv->snapshot_func_target_destroy_notify (self->priv->snapshot_func_target), NULL);
	self->priv->snapshot_func = NULL;
	self->priv->snapshot_func_target = NULL;
	self->priv->snapshot_func_target_destroy_notify = NULL;
	(self->priv->contains_func_target_destroy_notify == NULL) ? NULL : (self->priv->contains_func_target_destroy_notify (self->priv->contains_func_target), NULL);
	self->priv->contains_func = NULL;
	self->priv->contains_func_target = NULL;
	self->priv->contains_func_target_destroy_notify = NULL;
	(self->priv->focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->focus_func_target_destroy_notify (self->priv->focus_func_target), NULL);
	self->priv->focus_func = NULL;
	self->priv->focus_func_target = NULL;
	self->priv->focus_func_target_destroy_notify = NULL;
	(self->priv->grab_focus_func_target_destroy_notify == NULL) ? NULL : (self->priv->grab_focus_func_target_destroy_notify (self->priv->grab_focus_func_target), NULL);
	self->priv->grab_focus_func = NULL;
	self->priv->grab_focus_func_target = NULL;
	self->priv->grab_focus_func_target_destroy_notify = NULL;
	G_OBJECT_CLASS (ft_gizmo_parent_class)->finalize (obj);
}

/**
     * A widget that is controlled by its parent.
     *
     * It's a carbon copy from Gtk+ code. File gtk/gtk/gtkgizmo.c
     */
static GType
ft_gizmo_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtGizmoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_gizmo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtGizmo), 0, (GInstanceInitFunc) ft_gizmo_instance_init, NULL };
	GType ft_gizmo_type_id;
	ft_gizmo_type_id = g_type_register_static (gtk_widget_get_type (), "FtGizmo", &g_define_type_info, 0);
	FtGizmo_private_offset = g_type_add_instance_private (ft_gizmo_type_id, sizeof (FtGizmoPrivate));
	return ft_gizmo_type_id;
}

GType
ft_gizmo_get_type (void)
{
	static volatile gsize ft_gizmo_type_id__once = 0;
	if (g_once_init_enter (&ft_gizmo_type_id__once)) {
		GType ft_gizmo_type_id;
		ft_gizmo_type_id = ft_gizmo_get_type_once ();
		g_once_init_leave (&ft_gizmo_type_id__once, ft_gizmo_type_id);
	}
	return ft_gizmo_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

