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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
 * -*- coding: utf-8 -*-
 *
 * Copyright (C) 2011 ~ 2018 Deepin, Inc.
 *               2011 ~ 2018 Wang Yong
 *
 * Author:     Wang Yong <wangyong@deepin.com>
 * Maintainer: Wang Yong <wangyong@deepin.com>
 *
 * 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
 * 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, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.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_DIALOG_BUTTON (widgets_dialog_button_get_type ())
#define WIDGETS_DIALOG_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_DIALOG_BUTTON, WidgetsDialogButton))
#define WIDGETS_DIALOG_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_DIALOG_BUTTON, WidgetsDialogButtonClass))
#define WIDGETS_IS_DIALOG_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_DIALOG_BUTTON))
#define WIDGETS_IS_DIALOG_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_DIALOG_BUTTON))
#define WIDGETS_DIALOG_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_DIALOG_BUTTON, WidgetsDialogButtonClass))

typedef struct _WidgetsDialogButton WidgetsDialogButton;
typedef struct _WidgetsDialogButtonClass WidgetsDialogButtonClass;
typedef struct _WidgetsDialogButtonPrivate WidgetsDialogButtonPrivate;
enum  {
	WIDGETS_DIALOG_BUTTON_0_PROPERTY,
	WIDGETS_DIALOG_BUTTON_NUM_PROPERTIES
};
static GParamSpec* widgets_dialog_button_properties[WIDGETS_DIALOG_BUTTON_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _WidgetsDialogButton {
	GtkButton parent_instance;
	WidgetsDialogButtonPrivate * priv;
};

struct _WidgetsDialogButtonClass {
	GtkButtonClass parent_class;
};

static gpointer widgets_dialog_button_parent_class = NULL;
VALA_EXTERN gint constant_DIALOG_BUTTON_HEIGHT;

VALA_EXTERN GType widgets_dialog_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsDialogButton, g_object_unref)
VALA_EXTERN WidgetsDialogButton* widgets_dialog_button_new (const gchar* text,
                                                const gchar* direction,
                                                const gchar* type,
                                                gboolean has_radius);
VALA_EXTERN WidgetsDialogButton* widgets_dialog_button_construct (GType object_type,
                                                      const gchar* text,
                                                      const gchar* direction,
                                                      const gchar* type,
                                                      gboolean has_radius);
static gboolean __lambda76_ (WidgetsDialogButton* self,
                      GdkEventCrossing* w);
static gboolean ___lambda76__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                     GdkEventCrossing* event,
                                                     gpointer self);
static GType widgets_dialog_button_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gboolean
__lambda76_ (WidgetsDialogButton* self,
             GdkEventCrossing* w)
{
	gboolean result;
	g_return_val_if_fail (w != NULL, FALSE);
	gtk_widget_grab_focus ((GtkWidget*) self);
	result = FALSE;
	return result;
}

static gboolean
___lambda76__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                            GdkEventCrossing* event,
                                            gpointer self)
{
	gboolean result;
	result = __lambda76_ ((WidgetsDialogButton*) self, event);
	return result;
}

WidgetsDialogButton*
widgets_dialog_button_construct (GType object_type,
                                 const gchar* text,
                                 const gchar* direction,
                                 const gchar* type,
                                 gboolean has_radius)
{
	WidgetsDialogButton * self = NULL;
	g_return_val_if_fail (direction != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	self = (WidgetsDialogButton*) g_object_new (object_type, NULL);
	gtk_button_set_label ((GtkButton*) self, text);
	gtk_widget_set_size_request ((GtkWidget*) self, -1, constant_DIALOG_BUTTON_HEIGHT);
	if (g_strcmp0 (direction, "middle") == 0) {
		if (has_radius) {
			GtkStyleContext* _tmp0_;
			gchar* _tmp1_;
			gchar* _tmp2_;
			_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
			_tmp1_ = g_strdup_printf ("dialog_button_%s", type);
			_tmp2_ = _tmp1_;
			gtk_style_context_add_class (_tmp0_, _tmp2_);
			_g_free0 (_tmp2_);
		} else {
			GtkStyleContext* _tmp3_;
			gchar* _tmp4_;
			gchar* _tmp5_;
			_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) self);
			_tmp4_ = g_strdup_printf ("dialog_noradius_button_%s", type);
			_tmp5_ = _tmp4_;
			gtk_style_context_add_class (_tmp3_, _tmp5_);
			_g_free0 (_tmp5_);
		}
	} else {
		if (has_radius) {
			GtkStyleContext* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) self);
			_tmp7_ = g_strdup_printf ("dialog_button_%s_%s", direction, type);
			_tmp8_ = _tmp7_;
			gtk_style_context_add_class (_tmp6_, _tmp8_);
			_g_free0 (_tmp8_);
		} else {
			GtkStyleContext* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) self);
			_tmp10_ = g_strdup_printf ("dialog_noradius_button_%s_%s", direction, type);
			_tmp11_ = _tmp10_;
			gtk_style_context_add_class (_tmp9_, _tmp11_);
			_g_free0 (_tmp11_);
		}
	}
	g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) ___lambda76__gtk_widget_enter_notify_event, self, 0);
	return self;
}

WidgetsDialogButton*
widgets_dialog_button_new (const gchar* text,
                           const gchar* direction,
                           const gchar* type,
                           gboolean has_radius)
{
	return widgets_dialog_button_construct (WIDGETS_TYPE_DIALOG_BUTTON, text, direction, type, has_radius);
}

static void
widgets_dialog_button_class_init (WidgetsDialogButtonClass * klass,
                                  gpointer klass_data)
{
	widgets_dialog_button_parent_class = g_type_class_peek_parent (klass);
}

static void
widgets_dialog_button_instance_init (WidgetsDialogButton * self,
                                     gpointer klass)
{
}

static GType
widgets_dialog_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsDialogButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_dialog_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsDialogButton), 0, (GInstanceInitFunc) widgets_dialog_button_instance_init, NULL };
	GType widgets_dialog_button_type_id;
	widgets_dialog_button_type_id = g_type_register_static (gtk_button_get_type (), "WidgetsDialogButton", &g_define_type_info, 0);
	return widgets_dialog_button_type_id;
}

GType
widgets_dialog_button_get_type (void)
{
	static volatile gsize widgets_dialog_button_type_id__once = 0;
	if (g_once_init_enter (&widgets_dialog_button_type_id__once)) {
		GType widgets_dialog_button_type_id;
		widgets_dialog_button_type_id = widgets_dialog_button_get_type_once ();
		g_once_init_leave (&widgets_dialog_button_type_id__once, widgets_dialog_button_type_id);
	}
	return widgets_dialog_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;
}

