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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
 *
 * Copyright (C) 2012 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Michael Terry <michael.terry@canonical.com>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.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
#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 TYPE_FLAT_BUTTON (flat_button_get_type ())
#define FLAT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FLAT_BUTTON, FlatButton))
#define FLAT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FLAT_BUTTON, FlatButtonClass))
#define IS_FLAT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FLAT_BUTTON))
#define IS_FLAT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FLAT_BUTTON))
#define FLAT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FLAT_BUTTON, FlatButtonClass))

typedef struct _FlatButton FlatButton;
typedef struct _FlatButtonClass FlatButtonClass;
typedef struct _FlatButtonPrivate FlatButtonPrivate;
enum  {
	FLAT_BUTTON_0_PROPERTY,
	FLAT_BUTTON_NUM_PROPERTIES
};
static GParamSpec* flat_button_properties[FLAT_BUTTON_NUM_PROPERTIES];

struct _FlatButton {
	GtkButton parent_instance;
	FlatButtonPrivate * priv;
};

struct _FlatButtonClass {
	GtkButtonClass parent_class;
};

struct _FlatButtonPrivate {
	gboolean did_press;
};

static gint FlatButton_private_offset;
static gpointer flat_button_parent_class = NULL;

VALA_EXTERN GType flat_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatButton, g_object_unref)
static gboolean flat_button_real_button_press_event (GtkWidget* base,
                                              GdkEventButton* event);
static gboolean flat_button_real_button_release_event (GtkWidget* base,
                                                GdkEventButton* event);
VALA_EXTERN FlatButton* flat_button_new (void);
VALA_EXTERN FlatButton* flat_button_construct (GType object_type);
static GObject * flat_button_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
VALA_EXTERN void slick_greeter_add_style_class (GtkWidget* widget);
static void flat_button_finalize (GObject * obj);
static GType flat_button_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
flat_button_get_instance_private (FlatButton* self)
{
	return G_STRUCT_MEMBER_P (self, FlatButton_private_offset);
}

static gboolean
flat_button_real_button_press_event (GtkWidget* base,
                                     GdkEventButton* event)
{
	FlatButton * self;
	gboolean result;
#line 29 "../src/flat-button.vala"
	self = (FlatButton*) base;
#line 29 "../src/flat-button.vala"
	g_return_val_if_fail (event != NULL, FALSE);
#line 34 "../src/flat-button.vala"
	self->priv->did_press = TRUE;
#line 35 "../src/flat-button.vala"
	result = TRUE;
#line 35 "../src/flat-button.vala"
	return result;
#line 119 "flat-button.c"
}

static gboolean
flat_button_real_button_release_event (GtkWidget* base,
                                       GdkEventButton* event)
{
	FlatButton * self;
	gboolean result;
#line 38 "../src/flat-button.vala"
	self = (FlatButton*) base;
#line 38 "../src/flat-button.vala"
	g_return_val_if_fail (event != NULL, FALSE);
#line 40 "../src/flat-button.vala"
	if (self->priv->did_press) {
#line 42 "../src/flat-button.vala"
		event->type = GDK_BUTTON_PRESS;
#line 43 "../src/flat-button.vala"
		GTK_WIDGET_CLASS (flat_button_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_button_get_type (), GtkButton), event);
#line 44 "../src/flat-button.vala"
		self->priv->did_press = FALSE;
#line 140 "flat-button.c"
	}
#line 47 "../src/flat-button.vala"
	event->type = GDK_BUTTON_RELEASE;
#line 48 "../src/flat-button.vala"
	result = GTK_WIDGET_CLASS (flat_button_parent_class)->button_release_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_button_get_type (), GtkButton), event);
#line 48 "../src/flat-button.vala"
	return result;
#line 148 "flat-button.c"
}

FlatButton*
flat_button_construct (GType object_type)
{
	FlatButton * self = NULL;
#line 20 "../src/flat-button.vala"
	self = (FlatButton*) g_object_new (object_type, NULL);
#line 20 "../src/flat-button.vala"
	return self;
#line 159 "flat-button.c"
}

FlatButton*
flat_button_new (void)
{
#line 20 "../src/flat-button.vala"
	return flat_button_construct (TYPE_FLAT_BUTTON);
#line 167 "flat-button.c"
}

static GObject *
flat_button_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FlatButton * self;
#line 24 "../src/flat-button.vala"
	parent_class = G_OBJECT_CLASS (flat_button_parent_class);
#line 24 "../src/flat-button.vala"
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
#line 24 "../src/flat-button.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FLAT_BUTTON, FlatButton);
#line 26 "../src/flat-button.vala"
	slick_greeter_add_style_class ((GtkWidget*) self);
#line 24 "../src/flat-button.vala"
	return obj;
#line 188 "flat-button.c"
}

static void
flat_button_class_init (FlatButtonClass * klass,
                        gpointer klass_data)
{
#line 20 "../src/flat-button.vala"
	flat_button_parent_class = g_type_class_peek_parent (klass);
#line 20 "../src/flat-button.vala"
	g_type_class_adjust_private_offset (klass, &FlatButton_private_offset);
#line 20 "../src/flat-button.vala"
	((GtkWidgetClass *) klass)->button_press_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) flat_button_real_button_press_event;
#line 20 "../src/flat-button.vala"
	((GtkWidgetClass *) klass)->button_release_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) flat_button_real_button_release_event;
#line 20 "../src/flat-button.vala"
	G_OBJECT_CLASS (klass)->constructor = flat_button_constructor;
#line 20 "../src/flat-button.vala"
	G_OBJECT_CLASS (klass)->finalize = flat_button_finalize;
#line 207 "flat-button.c"
}

static void
flat_button_instance_init (FlatButton * self,
                           gpointer klass)
{
#line 20 "../src/flat-button.vala"
	self->priv = flat_button_get_instance_private (self);
#line 216 "flat-button.c"
}

static void
flat_button_finalize (GObject * obj)
{
	FlatButton * self;
#line 20 "../src/flat-button.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FLAT_BUTTON, FlatButton);
#line 20 "../src/flat-button.vala"
	G_OBJECT_CLASS (flat_button_parent_class)->finalize (obj);
#line 227 "flat-button.c"
}

static GType
flat_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FlatButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) flat_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FlatButton), 0, (GInstanceInitFunc) flat_button_instance_init, NULL };
	GType flat_button_type_id;
	flat_button_type_id = g_type_register_static (gtk_button_get_type (), "FlatButton", &g_define_type_info, 0);
	FlatButton_private_offset = g_type_add_instance_private (flat_button_type_id, sizeof (FlatButtonPrivate));
	return flat_button_type_id;
}

GType
flat_button_get_type (void)
{
	static volatile gsize flat_button_type_id__once = 0;
	if (g_once_init_enter (&flat_button_type_id__once)) {
		GType flat_button_type_id;
		flat_button_type_id = flat_button_get_type_once ();
		g_once_init_leave (&flat_button_type_id__once, flat_button_type_id);
	}
	return flat_button_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;
}

