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

/*
Copyright (C) 2014 Johan Mattsson

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 3 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.
*/

#include "birdfont.h"
#include <glib.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <stdlib.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

enum  {
	BIRD_FONT_ROW_0_PROPERTY,
	BIRD_FONT_ROW_COLUMNS_PROPERTY,
	BIRD_FONT_ROW_NUM_PROPERTIES
};
static GParamSpec* bird_font_row_properties[BIRD_FONT_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _BirdFontRowPrivate {
	gint index;
	gboolean delete_button;
	GObject* row_data;
};

static gint BirdFontRow_private_offset;
static gpointer bird_font_row_parent_class = NULL;

static void bird_font_row_finalize (GObject * obj);
static GType bird_font_row_get_type_once (void);
static void _vala_bird_font_row_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
bird_font_row_get_instance_private (BirdFontRow* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontRow_private_offset);
}

BirdFontRow*
bird_font_row_construct (GType object_type,
                         const gchar* label,
                         gint index,
                         gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	g_return_val_if_fail (label != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	self->priv->index = index;
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new (const gchar* label,
                   gint index,
                   gboolean delete_button)
{
	return bird_font_row_construct (BIRD_FONT_TYPE_ROW, label, index, delete_button);
}

BirdFontRow*
bird_font_row_construct_headline (GType object_type,
                                  const gchar* label)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	g_return_val_if_fail (label != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	self->priv->index = -1;
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label, (gdouble) 25, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	self->priv->delete_button = FALSE;
	self->is_headline = TRUE;
	return self;
}

BirdFontRow*
bird_font_row_new_headline (const gchar* label)
{
	return bird_font_row_construct_headline (BIRD_FONT_TYPE_ROW, label);
}

BirdFontRow*
bird_font_row_construct_columns_1 (GType object_type,
                                   const gchar* label,
                                   gint index,
                                   gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	g_return_val_if_fail (label != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	self->priv->index = index;
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new_columns_1 (const gchar* label,
                             gint index,
                             gboolean delete_button)
{
	return bird_font_row_construct_columns_1 (BIRD_FONT_TYPE_ROW, label, index, delete_button);
}

BirdFontRow*
bird_font_row_construct_columns_2 (GType object_type,
                                   const gchar* label0,
                                   const gchar* label1,
                                   gint index,
                                   gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	GeeArrayList* _tmp3_;
	BirdFontText* _tmp4_;
	BirdFontText* _tmp5_;
	g_return_val_if_fail (label0 != NULL, NULL);
	g_return_val_if_fail (label1 != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label0, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->column_text;
	_tmp4_ = bird_font_text_new (label1, (gdouble) 18, (gdouble) 0);
	_tmp5_ = _tmp4_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	self->priv->index = index;
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new_columns_2 (const gchar* label0,
                             const gchar* label1,
                             gint index,
                             gboolean delete_button)
{
	return bird_font_row_construct_columns_2 (BIRD_FONT_TYPE_ROW, label0, label1, index, delete_button);
}

BirdFontRow*
bird_font_row_construct_columns_3 (GType object_type,
                                   const gchar* label0,
                                   const gchar* label1,
                                   const gchar* label2,
                                   gint index,
                                   gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	GeeArrayList* _tmp3_;
	BirdFontText* _tmp4_;
	BirdFontText* _tmp5_;
	GeeArrayList* _tmp6_;
	BirdFontText* _tmp7_;
	BirdFontText* _tmp8_;
	g_return_val_if_fail (label0 != NULL, NULL);
	g_return_val_if_fail (label1 != NULL, NULL);
	g_return_val_if_fail (label2 != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label0, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->column_text;
	_tmp4_ = bird_font_text_new (label1, (gdouble) 18, (gdouble) 0);
	_tmp5_ = _tmp4_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->column_text;
	_tmp7_ = bird_font_text_new (label2, (gdouble) 18, (gdouble) 0);
	_tmp8_ = _tmp7_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	self->priv->index = index;
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new_columns_3 (const gchar* label0,
                             const gchar* label1,
                             const gchar* label2,
                             gint index,
                             gboolean delete_button)
{
	return bird_font_row_construct_columns_3 (BIRD_FONT_TYPE_ROW, label0, label1, label2, index, delete_button);
}

BirdFontRow*
bird_font_row_construct_columns_4 (GType object_type,
                                   const gchar* label0,
                                   const gchar* label1,
                                   const gchar* label2,
                                   const gchar* label3,
                                   gint index,
                                   gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	GeeArrayList* _tmp3_;
	BirdFontText* _tmp4_;
	BirdFontText* _tmp5_;
	GeeArrayList* _tmp6_;
	BirdFontText* _tmp7_;
	BirdFontText* _tmp8_;
	GeeArrayList* _tmp9_;
	BirdFontText* _tmp10_;
	BirdFontText* _tmp11_;
	g_return_val_if_fail (label0 != NULL, NULL);
	g_return_val_if_fail (label1 != NULL, NULL);
	g_return_val_if_fail (label2 != NULL, NULL);
	g_return_val_if_fail (label3 != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label0, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->column_text;
	_tmp4_ = bird_font_text_new (label1, (gdouble) 18, (gdouble) 0);
	_tmp5_ = _tmp4_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->column_text;
	_tmp7_ = bird_font_text_new (label2, (gdouble) 18, (gdouble) 0);
	_tmp8_ = _tmp7_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->column_text;
	_tmp10_ = bird_font_text_new (label3, (gdouble) 18, (gdouble) 0);
	_tmp11_ = _tmp10_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp11_);
	_g_object_unref0 (_tmp11_);
	self->priv->index = index;
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new_columns_4 (const gchar* label0,
                             const gchar* label1,
                             const gchar* label2,
                             const gchar* label3,
                             gint index,
                             gboolean delete_button)
{
	return bird_font_row_construct_columns_4 (BIRD_FONT_TYPE_ROW, label0, label1, label2, label3, index, delete_button);
}

BirdFontRow*
bird_font_row_construct_columns_5 (GType object_type,
                                   const gchar* label0,
                                   const gchar* label1,
                                   const gchar* label2,
                                   const gchar* label3,
                                   const gchar* label4,
                                   gint index,
                                   gboolean delete_button)
{
	BirdFontRow * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontText* _tmp1_;
	BirdFontText* _tmp2_;
	GeeArrayList* _tmp3_;
	BirdFontText* _tmp4_;
	BirdFontText* _tmp5_;
	GeeArrayList* _tmp6_;
	BirdFontText* _tmp7_;
	BirdFontText* _tmp8_;
	GeeArrayList* _tmp9_;
	BirdFontText* _tmp10_;
	BirdFontText* _tmp11_;
	GeeArrayList* _tmp12_;
	BirdFontText* _tmp13_;
	BirdFontText* _tmp14_;
	g_return_val_if_fail (label0 != NULL, NULL);
	g_return_val_if_fail (label1 != NULL, NULL);
	g_return_val_if_fail (label2 != NULL, NULL);
	g_return_val_if_fail (label3 != NULL, NULL);
	g_return_val_if_fail (label4 != NULL, NULL);
	self = (BirdFontRow*) g_object_new (object_type, NULL);
	_tmp0_ = self->column_text;
	_tmp1_ = bird_font_text_new (label0, (gdouble) 18, (gdouble) 0);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->column_text;
	_tmp4_ = bird_font_text_new (label1, (gdouble) 18, (gdouble) 0);
	_tmp5_ = _tmp4_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->column_text;
	_tmp7_ = bird_font_text_new (label2, (gdouble) 18, (gdouble) 0);
	_tmp8_ = _tmp7_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->column_text;
	_tmp10_ = bird_font_text_new (label3, (gdouble) 18, (gdouble) 0);
	_tmp11_ = _tmp10_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = self->column_text;
	_tmp13_ = bird_font_text_new (label4, (gdouble) 18, (gdouble) 0);
	_tmp14_ = _tmp13_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp14_);
	_g_object_unref0 (_tmp14_);
	self->priv->index = index;
	self->priv->delete_button = delete_button;
	return self;
}

BirdFontRow*
bird_font_row_new_columns_5 (const gchar* label0,
                             const gchar* label1,
                             const gchar* label2,
                             const gchar* label3,
                             const gchar* label4,
                             gint index,
                             gboolean delete_button)
{
	return bird_font_row_construct_columns_5 (BIRD_FONT_TYPE_ROW, label0, label1, label2, label3, label4, index, delete_button);
}

gboolean
bird_font_row_has_row_data (BirdFontRow* self)
{
	GObject* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->row_data;
	result = _tmp0_ != NULL;
	return result;
}

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

GObject*
bird_font_row_get_row_data (BirdFontRow* self)
{
	GObject* _tmp0_;
	GObject* _tmp1_;
	GObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->row_data;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
bird_font_row_set_row_data (BirdFontRow* self,
                            GObject* o)
{
	GObject* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	_tmp0_ = _g_object_ref0 (o);
	_g_object_unref0 (self->priv->row_data);
	self->priv->row_data = _tmp0_;
}

gboolean
bird_font_row_has_delete_button (BirdFontRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->delete_button;
	return result;
}

BirdFontText*
bird_font_row_get_column (BirdFontRow* self,
                          gint i)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	BirdFontText* _tmp3_;
	BirdFontText* _tmp4_;
	GeeArrayList* _tmp5_;
	gpointer _tmp6_;
	BirdFontText* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = bird_font_row_get_columns (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = i;
	_tmp3_ = bird_font_text_new ("", (gdouble) 17, (gdouble) 0);
	_tmp4_ = _tmp3_;
	g_return_val_if_fail ((0 <= _tmp2_) && (_tmp2_ < _tmp1_), _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = self->column_text;
	_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, i);
	result = (BirdFontText*) _tmp6_;
	return result;
}

gint
bird_font_row_get_index (BirdFontRow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->index;
	return result;
}

void
bird_font_row_set_index (BirdFontRow* self,
                         gint index)
{
	g_return_if_fail (self != NULL);
	self->priv->index = index;
}

gdouble
bird_font_row_get_height (BirdFontRow* self)
{
	gint _tmp0_ = 0;
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (self->is_headline) {
		_tmp0_ = 75;
	} else {
		_tmp0_ = 25;
	}
	result = (gdouble) _tmp0_;
	return result;
}

gint
bird_font_row_get_columns (BirdFontRow* self)
{
	gint result;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->column_text;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
bird_font_row_class_init (BirdFontRowClass * klass,
                          gpointer klass_data)
{
	bird_font_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_bird_font_row_get_property;
	G_OBJECT_CLASS (klass)->finalize = bird_font_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BIRD_FONT_ROW_COLUMNS_PROPERTY, bird_font_row_properties[BIRD_FONT_ROW_COLUMNS_PROPERTY] = g_param_spec_int ("columns", "columns", "columns", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
bird_font_row_instance_init (BirdFontRow * self,
                             gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = bird_font_row_get_instance_private (self);
	self->priv->index = 0;
	self->priv->delete_button = TRUE;
	self->y = (gdouble) 0;
	_tmp0_ = gee_array_list_new (BIRD_FONT_TYPE_TEXT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->column_text = _tmp0_;
	self->priv->row_data = NULL;
	self->is_headline = FALSE;
}

static void
bird_font_row_finalize (GObject * obj)
{
	BirdFontRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_ROW, BirdFontRow);
	_g_object_unref0 (self->column_text);
	_g_object_unref0 (self->priv->row_data);
	G_OBJECT_CLASS (bird_font_row_parent_class)->finalize (obj);
}

static GType
bird_font_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontRow), 0, (GInstanceInitFunc) bird_font_row_instance_init, NULL };
	GType bird_font_row_type_id;
	bird_font_row_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontRow", &g_define_type_info, 0);
	BirdFontRow_private_offset = g_type_add_instance_private (bird_font_row_type_id, sizeof (BirdFontRowPrivate));
	return bird_font_row_type_id;
}

GType
bird_font_row_get_type (void)
{
	static volatile gsize bird_font_row_type_id__once = 0;
	if (g_once_init_enter (&bird_font_row_type_id__once)) {
		GType bird_font_row_type_id;
		bird_font_row_type_id = bird_font_row_get_type_once ();
		g_once_init_leave (&bird_font_row_type_id__once, bird_font_row_type_id);
	}
	return bird_font_row_type_id__once;
}

static void
_vala_bird_font_row_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	BirdFontRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BIRD_FONT_TYPE_ROW, BirdFontRow);
	switch (property_id) {
		case BIRD_FONT_ROW_COLUMNS_PROPERTY:
		g_value_set_int (value, bird_font_row_get_columns (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

