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


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <cairo.h>


#define TYPE_MAX_SIZE_CONTAINER (max_size_container_get_type ())
#define MAX_SIZE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer))
#define MAX_SIZE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAX_SIZE_CONTAINER, MaxSizeContainerClass))
#define IS_MAX_SIZE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAX_SIZE_CONTAINER))
#define IS_MAX_SIZE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAX_SIZE_CONTAINER))
#define MAX_SIZE_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAX_SIZE_CONTAINER, MaxSizeContainerClass))

typedef struct _MaxSizeContainer MaxSizeContainer;
typedef struct _MaxSizeContainerClass MaxSizeContainerClass;
typedef struct _MaxSizeContainerPrivate MaxSizeContainerPrivate;

struct _MaxSizeContainer {
	GtkBin parent_instance;
	MaxSizeContainerPrivate * priv;
};

struct _MaxSizeContainerClass {
	GtkBinClass parent_class;
};

struct _MaxSizeContainerPrivate {
	gint _max_size;
};


static gpointer max_size_container_parent_class = NULL;

GType max_size_container_get_type (void) G_GNUC_CONST;
#define MAX_SIZE_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MAX_SIZE_CONTAINER, MaxSizeContainerPrivate))
enum  {
	MAX_SIZE_CONTAINER_DUMMY_PROPERTY,
	MAX_SIZE_CONTAINER_MAX_SIZE
};
static GtkSizeRequestMode max_size_container_real_get_request_mode (GtkWidget* base);
static void max_size_container_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* min_height, gint* nat_height);
gint max_size_container_get_max_size (MaxSizeContainer* self);
static void max_size_container_real_size_allocate (GtkWidget* base, GtkAllocation* alloc);
MaxSizeContainer* max_size_container_new (void);
MaxSizeContainer* max_size_container_construct (GType object_type);
void max_size_container_set_max_size (MaxSizeContainer* self, gint value);
static void max_size_container_finalize (GObject* obj);
static void _vala_max_size_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_max_size_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static GtkSizeRequestMode max_size_container_real_get_request_mode (GtkWidget* base) {
	MaxSizeContainer * self;
	GtkSizeRequestMode result = 0;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	result = GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
	return result;
}


static void max_size_container_real_get_preferred_height_for_width (GtkWidget* base, gint width, gint* min_height, gint* nat_height) {
	MaxSizeContainer * self;
	gint _vala_min_height = 0;
	gint _vala_nat_height = 0;
	gint child_height = 0;
	GtkWidget* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	_tmp0_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
	_tmp1_ = width;
	gtk_widget_get_preferred_height_for_width (_tmp0_, _tmp1_, &_tmp2_, NULL);
	child_height = _tmp2_;
	_tmp3_ = self->priv->_max_size;
	_tmp4_ = child_height;
	if (_tmp3_ >= _tmp4_) {
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
		_tmp5_ = width;
		GTK_WIDGET_CLASS (max_size_container_parent_class)->get_preferred_height_for_width (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin), gtk_widget_get_type (), GtkWidget), _tmp5_, &_tmp6_, &_tmp7_);
		_vala_min_height = _tmp6_;
		_vala_nat_height = _tmp7_;
	} else {
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		_tmp8_ = self->priv->_max_size;
		_vala_nat_height = _tmp8_;
		_tmp9_ = self->priv->_max_size;
		_vala_min_height = _tmp9_;
	}
	if (min_height) {
		*min_height = _vala_min_height;
	}
	if (nat_height) {
		*nat_height = _vala_nat_height;
	}
}


static void max_size_container_real_size_allocate (GtkWidget* base, GtkAllocation* alloc) {
	MaxSizeContainer * self;
	gboolean _tmp0_ = FALSE;
	GtkWidget* _tmp1_ = NULL;
	GtkAllocation child_alloc = {0};
	GtkAllocation _tmp5_ = {0};
	GtkAllocation _tmp6_ = {0};
	gint _tmp7_ = 0;
	GtkAllocation _tmp8_ = {0};
	gint _tmp9_ = 0;
	gint _tmp10_ = 0;
	GtkAllocation _tmp11_ = {0};
	gint _tmp12_ = 0;
	GtkAllocation _tmp20_ = {0};
	gboolean _tmp21_ = FALSE;
	GtkWidget* _tmp22_ = NULL;
	gboolean _tmp30_ = FALSE;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	g_return_if_fail (alloc != NULL);
	_tmp1_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		GtkWidget* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_ = FALSE;
		_tmp2_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
		_tmp3_ = gtk_widget_get_visible (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = !_tmp4_;
	}
	if (_tmp0_) {
		return;
	}
	child_alloc = _tmp5_;
	_tmp6_ = *alloc;
	_tmp7_ = _tmp6_.x;
	child_alloc.x = _tmp7_;
	_tmp8_ = *alloc;
	_tmp9_ = _tmp8_.width;
	child_alloc.width = _tmp9_;
	_tmp10_ = self->priv->_max_size;
	_tmp11_ = *alloc;
	_tmp12_ = _tmp11_.height;
	if (_tmp10_ >= _tmp12_) {
		GtkAllocation _tmp13_ = {0};
		gint _tmp14_ = 0;
		GtkAllocation _tmp15_ = {0};
		gint _tmp16_ = 0;
		_tmp13_ = *alloc;
		_tmp14_ = _tmp13_.y;
		child_alloc.y = _tmp14_;
		_tmp15_ = *alloc;
		_tmp16_ = _tmp15_.height;
		child_alloc.height = _tmp16_;
	} else {
		GtkAllocation _tmp17_ = {0};
		gint _tmp18_ = 0;
		gint _tmp19_ = 0;
		_tmp17_ = *alloc;
		_tmp18_ = _tmp17_.y;
		child_alloc.y = _tmp18_;
		_tmp19_ = self->priv->_max_size;
		child_alloc.height = _tmp19_;
	}
	_tmp20_ = child_alloc;
	GTK_WIDGET_CLASS (max_size_container_parent_class)->size_allocate (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin), gtk_widget_get_type (), GtkWidget), &_tmp20_);
	_tmp22_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
	if (_tmp22_ != NULL) {
		GtkWidget* _tmp23_ = NULL;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_ = FALSE;
		_tmp23_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
		_tmp24_ = gtk_widget_get_visible (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp21_ = _tmp25_;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		GtkWidget* _tmp26_ = NULL;
		GtkAllocation _tmp27_ = {0};
		gboolean _tmp28_ = FALSE;
		_tmp26_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
		_tmp27_ = child_alloc;
		gtk_widget_size_allocate (_tmp26_, &_tmp27_);
		_tmp28_ = gtk_widget_get_realized (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
		if (_tmp28_) {
			GtkWidget* _tmp29_ = NULL;
			_tmp29_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
			gtk_widget_show (_tmp29_);
		}
	}
	_tmp30_ = gtk_widget_get_realized (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	if (_tmp30_) {
		GtkWidget* _tmp31_ = NULL;
		_tmp31_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
		if (_tmp31_ != NULL) {
			GtkWidget* _tmp32_ = NULL;
			_tmp32_ = gtk_bin_get_child (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
			gtk_widget_set_child_visible (_tmp32_, TRUE);
		}
	}
}


MaxSizeContainer* max_size_container_construct (GType object_type) {
	MaxSizeContainer * self = NULL;
	self = (MaxSizeContainer*) g_object_new (object_type, NULL);
	return self;
}


MaxSizeContainer* max_size_container_new (void) {
	return max_size_container_construct (TYPE_MAX_SIZE_CONTAINER);
}


gint max_size_container_get_max_size (MaxSizeContainer* self) {
	gint result;
	gint _tmp0_ = 0;
	g_return_val_if_fail (IS_MAX_SIZE_CONTAINER (self), 0);
	_tmp0_ = self->priv->_max_size;
	result = _tmp0_;
	return result;
}


void max_size_container_set_max_size (MaxSizeContainer* self, gint value) {
	gint _tmp0_ = 0;
	g_return_if_fail (IS_MAX_SIZE_CONTAINER (self));
	_tmp0_ = value;
	self->priv->_max_size = _tmp0_;
	g_object_notify ((GObject *) self, "max-size");
}


static void max_size_container_class_init (MaxSizeContainerClass * klass) {
	max_size_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (MaxSizeContainerPrivate));
	((GtkWidgetClass *) klass)->get_request_mode = max_size_container_real_get_request_mode;
	((GtkWidgetClass *) klass)->get_preferred_height_for_width = max_size_container_real_get_preferred_height_for_width;
	((GtkWidgetClass *) klass)->size_allocate = max_size_container_real_size_allocate;
	G_OBJECT_CLASS (klass)->get_property = _vala_max_size_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_max_size_container_set_property;
	G_OBJECT_CLASS (klass)->finalize = max_size_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAX_SIZE_CONTAINER_MAX_SIZE, g_param_spec_int ("max-size", "max-size", "max-size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void max_size_container_instance_init (MaxSizeContainer * self) {
	self->priv = MAX_SIZE_CONTAINER_GET_PRIVATE (self);
	self->priv->_max_size = 0;
}


static void max_size_container_finalize (GObject* obj) {
	MaxSizeContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	G_OBJECT_CLASS (max_size_container_parent_class)->finalize (obj);
}


GType max_size_container_get_type (void) {
	static volatile gsize max_size_container_type_id__volatile = 0;
	if (g_once_init_enter (&max_size_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (MaxSizeContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) max_size_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MaxSizeContainer), 0, (GInstanceInitFunc) max_size_container_instance_init, NULL };
		GType max_size_container_type_id;
		max_size_container_type_id = g_type_register_static (gtk_bin_get_type (), "MaxSizeContainer", &g_define_type_info, 0);
		g_once_init_leave (&max_size_container_type_id__volatile, max_size_container_type_id);
	}
	return max_size_container_type_id__volatile;
}


static void _vala_max_size_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	MaxSizeContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	switch (property_id) {
		case MAX_SIZE_CONTAINER_MAX_SIZE:
		g_value_set_int (value, max_size_container_get_max_size (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_max_size_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	MaxSizeContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAX_SIZE_CONTAINER, MaxSizeContainer);
	switch (property_id) {
		case MAX_SIZE_CONTAINER_MAX_SIZE:
		max_size_container_set_max_size (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



