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

/*
* Copyright (c) 2018-2026 (https://github.com/phase1geo/Minder)
*
* 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 2 of the License, or (at your option) 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Trevor Williams <phase1geo@gmail.com>
*/

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.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_NODE_BORDER (node_border_get_type ())
#define NODE_BORDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_BORDER, NodeBorder))
#define IS_NODE_BORDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_BORDER))
#define NODE_BORDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_NODE_BORDER, NodeBorderIface))

typedef struct _NodeBorder NodeBorder;
typedef struct _NodeBorderIface NodeBorderIface;
typedef enum  {
	NODE_SIDE_LEFT = 1,
	NODE_SIDE_TOP = 2,
	NODE_SIDE_RIGHT = 4,
	NODE_SIDE_BOTTOM = 8
} NodeSide;

#define TYPE_NODE_SIDE (node_side_get_type ())

#define TYPE_NODE_BORDER_PILL (node_border_pill_get_type ())
#define NODE_BORDER_PILL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_BORDER_PILL, NodeBorderPill))
#define NODE_BORDER_PILL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_BORDER_PILL, NodeBorderPillClass))
#define IS_NODE_BORDER_PILL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_BORDER_PILL))
#define IS_NODE_BORDER_PILL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_BORDER_PILL))
#define NODE_BORDER_PILL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_BORDER_PILL, NodeBorderPillClass))

typedef struct _NodeBorderPill NodeBorderPill;
typedef struct _NodeBorderPillClass NodeBorderPillClass;
typedef struct _NodeBorderPillPrivate NodeBorderPillPrivate;
enum  {
	NODE_BORDER_PILL_0_PROPERTY,
	NODE_BORDER_PILL_NUM_PROPERTIES
};
static GParamSpec* node_border_pill_properties[NODE_BORDER_PILL_NUM_PROPERTIES];

struct _NodeBorderIface {
	GTypeInterface parent_iface;
	gchar* (*name) (NodeBorder* self);
	gchar* (*display_name) (NodeBorder* self);
	gchar* (*light_icon_name) (NodeBorder* self);
	gchar* (*dark_icon_name) (NodeBorder* self);
	gboolean (*is_fillable) (NodeBorder* self);
	void (*draw_border) (NodeBorder* self, cairo_t* ctx, gdouble x, gdouble y, gdouble w, gdouble h, NodeSide s, gint padding);
	void (*draw_fill) (NodeBorder* self, cairo_t* ctx, gdouble x, gdouble y, gdouble w, gdouble h, NodeSide s, gint padding);
};

struct _NodeBorderPill {
	GObject parent_instance;
	NodeBorderPillPrivate * priv;
};

struct _NodeBorderPillClass {
	GObjectClass parent_class;
};

static gpointer node_border_pill_parent_class = NULL;
static NodeBorderIface * node_border_pill_node_border_parent_iface = NULL;

VALA_EXTERN GType node_side_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType node_border_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeBorder, g_object_unref)
VALA_EXTERN GType node_border_pill_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeBorderPill, g_object_unref)
VALA_EXTERN NodeBorderPill* node_border_pill_new (void);
VALA_EXTERN NodeBorderPill* node_border_pill_construct (GType object_type);
static gchar* node_border_pill_real_name (NodeBorder* base);
static gchar* node_border_pill_real_display_name (NodeBorder* base);
static gchar* node_border_pill_real_light_icon_name (NodeBorder* base);
static gchar* node_border_pill_real_dark_icon_name (NodeBorder* base);
static gboolean node_border_pill_real_is_fillable (NodeBorder* base);
static void node_border_pill_draw_common (NodeBorderPill* self,
                                   cairo_t* ctx,
                                   gdouble x,
                                   gdouble y,
                                   gdouble w,
                                   gdouble h,
                                   gint padding);
static void node_border_pill_real_draw_border (NodeBorder* base,
                                        cairo_t* ctx,
                                        gdouble x,
                                        gdouble y,
                                        gdouble w,
                                        gdouble h,
                                        NodeSide s,
                                        gint padding);
static void node_border_pill_real_draw_fill (NodeBorder* base,
                                      cairo_t* ctx,
                                      gdouble x,
                                      gdouble y,
                                      gdouble w,
                                      gdouble h,
                                      NodeSide s,
                                      gint padding);
VALA_EXTERN gchar* node_border_name (NodeBorder* self);
VALA_EXTERN gchar* node_border_display_name (NodeBorder* self);
VALA_EXTERN gchar* node_border_light_icon_name (NodeBorder* self);
VALA_EXTERN gchar* node_border_dark_icon_name (NodeBorder* self);
VALA_EXTERN gboolean node_border_is_fillable (NodeBorder* self);
VALA_EXTERN void node_border_draw_border (NodeBorder* self,
                              cairo_t* ctx,
                              gdouble x,
                              gdouble y,
                              gdouble w,
                              gdouble h,
                              NodeSide s,
                              gint padding);
VALA_EXTERN void node_border_draw_fill (NodeBorder* self,
                            cairo_t* ctx,
                            gdouble x,
                            gdouble y,
                            gdouble w,
                            gdouble h,
                            NodeSide s,
                            gint padding);
static GType node_border_pill_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

NodeBorderPill*
node_border_pill_construct (GType object_type)
{
	NodeBorderPill * self = NULL;
	self = (NodeBorderPill*) g_object_new (object_type, NULL);
	return self;
}

NodeBorderPill*
node_border_pill_new (void)
{
	return node_border_pill_construct (TYPE_NODE_BORDER_PILL);
}

static gchar*
node_border_pill_real_name (NodeBorder* base)
{
	NodeBorderPill * self;
	gchar* _tmp0_;
	gchar* result;
	self = (NodeBorderPill*) base;
	_tmp0_ = g_strdup ("pilled");
	result = _tmp0_;
	return result;
}

static gchar*
node_border_pill_real_display_name (NodeBorder* base)
{
	NodeBorderPill * self;
	gchar* _tmp0_;
	gchar* result;
	self = (NodeBorderPill*) base;
	_tmp0_ = g_strdup (_ ("Pill-shaped"));
	result = _tmp0_;
	return result;
}

static gchar*
node_border_pill_real_light_icon_name (NodeBorder* base)
{
	NodeBorderPill * self;
	gchar* _tmp0_;
	gchar* result;
	self = (NodeBorderPill*) base;
	_tmp0_ = g_strdup ("minder-node-border-pill-light-symbolic");
	result = _tmp0_;
	return result;
}

static gchar*
node_border_pill_real_dark_icon_name (NodeBorder* base)
{
	NodeBorderPill * self;
	gchar* _tmp0_;
	gchar* result;
	self = (NodeBorderPill*) base;
	_tmp0_ = g_strdup ("minder-node-border-pill-dark-symbolic");
	result = _tmp0_;
	return result;
}

static gboolean
node_border_pill_real_is_fillable (NodeBorder* base)
{
	NodeBorderPill * self;
	gboolean result;
	self = (NodeBorderPill*) base;
	result = TRUE;
	return result;
}

static void
node_border_pill_draw_common (NodeBorderPill* self,
                              cairo_t* ctx,
                              gdouble x,
                              gdouble y,
                              gdouble w,
                              gdouble h,
                              gint padding)
{
	gint d = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	d = padding;
	cairo_move_to (ctx, x + d, y);
	cairo_line_to (ctx, (x + w) - d, y);
	cairo_curve_to (ctx, (x + w) - d, y, (x + w) + d, y + (h / 2), (x + w) - d, y + h);
	cairo_line_to (ctx, x + d, y + h);
	cairo_curve_to (ctx, x + d, y + h, x - d, y + (h / 2), x + d, y);
}

static void
node_border_pill_real_draw_border (NodeBorder* base,
                                   cairo_t* ctx,
                                   gdouble x,
                                   gdouble y,
                                   gdouble w,
                                   gdouble h,
                                   NodeSide s,
                                   gint padding)
{
	NodeBorderPill * self;
	self = (NodeBorderPill*) base;
	g_return_if_fail (ctx != NULL);
	node_border_pill_draw_common (self, ctx, x, y, w, h, padding);
	cairo_stroke (ctx);
}

static void
node_border_pill_real_draw_fill (NodeBorder* base,
                                 cairo_t* ctx,
                                 gdouble x,
                                 gdouble y,
                                 gdouble w,
                                 gdouble h,
                                 NodeSide s,
                                 gint padding)
{
	NodeBorderPill * self;
	self = (NodeBorderPill*) base;
	g_return_if_fail (ctx != NULL);
	node_border_pill_draw_common (self, ctx, x, y, w, h, padding);
	cairo_fill (ctx);
}

static void
node_border_pill_class_init (NodeBorderPillClass * klass,
                             gpointer klass_data)
{
	node_border_pill_parent_class = g_type_class_peek_parent (klass);
}

static void
node_border_pill_node_border_interface_init (NodeBorderIface * iface,
                                             gpointer iface_data)
{
	node_border_pill_node_border_parent_iface = g_type_interface_peek_parent (iface);
	iface->name = (gchar* (*) (NodeBorder*)) node_border_pill_real_name;
	iface->display_name = (gchar* (*) (NodeBorder*)) node_border_pill_real_display_name;
	iface->light_icon_name = (gchar* (*) (NodeBorder*)) node_border_pill_real_light_icon_name;
	iface->dark_icon_name = (gchar* (*) (NodeBorder*)) node_border_pill_real_dark_icon_name;
	iface->is_fillable = (gboolean (*) (NodeBorder*)) node_border_pill_real_is_fillable;
	iface->draw_border = (void (*) (NodeBorder*, cairo_t*, gdouble, gdouble, gdouble, gdouble, NodeSide, gint)) node_border_pill_real_draw_border;
	iface->draw_fill = (void (*) (NodeBorder*, cairo_t*, gdouble, gdouble, gdouble, gdouble, NodeSide, gint)) node_border_pill_real_draw_fill;
}

static void
node_border_pill_instance_init (NodeBorderPill * self,
                                gpointer klass)
{
}

static GType
node_border_pill_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NodeBorderPillClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) node_border_pill_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NodeBorderPill), 0, (GInstanceInitFunc) node_border_pill_instance_init, NULL };
	static const GInterfaceInfo node_border_info = { (GInterfaceInitFunc) node_border_pill_node_border_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType node_border_pill_type_id;
	node_border_pill_type_id = g_type_register_static (G_TYPE_OBJECT, "NodeBorderPill", &g_define_type_info, 0);
	g_type_add_interface_static (node_border_pill_type_id, TYPE_NODE_BORDER, &node_border_info);
	return node_border_pill_type_id;
}

GType
node_border_pill_get_type (void)
{
	static volatile gsize node_border_pill_type_id__once = 0;
	if (g_once_init_enter (&node_border_pill_type_id__once)) {
		GType node_border_pill_type_id;
		node_border_pill_type_id = node_border_pill_get_type_once ();
		g_once_init_leave (&node_border_pill_type_id__once, node_border_pill_type_id);
	}
	return node_border_pill_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;
}

