/* LayoutRight.c generated by valac 0.56.19, the Vala compiler
 * generated from LayoutRight.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 <glib.h>
#include <stdlib.h>
#include <string.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_LAYOUT (layout_get_type ())
#define LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LAYOUT, Layout))
#define LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LAYOUT, LayoutClass))
#define IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LAYOUT))
#define IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LAYOUT))
#define LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LAYOUT, LayoutClass))

typedef struct _Layout Layout;
typedef struct _LayoutClass LayoutClass;
typedef struct _LayoutPrivate LayoutPrivate;
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 (node_get_type ())
#define NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE, Node))
#define NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE, NodeClass))
#define IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE))
#define IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE))
#define NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE, NodeClass))

typedef struct _Node Node;
typedef struct _NodeClass NodeClass;

#define TYPE_NODE_BOUNDS (node_bounds_get_type ())
#define NODE_BOUNDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_BOUNDS, NodeBounds))
#define NODE_BOUNDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_BOUNDS, NodeBoundsClass))
#define IS_NODE_BOUNDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_BOUNDS))
#define IS_NODE_BOUNDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_BOUNDS))
#define NODE_BOUNDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_BOUNDS, NodeBoundsClass))

typedef struct _NodeBounds NodeBounds;
typedef struct _NodeBoundsClass NodeBoundsClass;

#define TYPE_LAYOUT_RIGHT (layout_right_get_type ())
#define LAYOUT_RIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LAYOUT_RIGHT, LayoutRight))
#define LAYOUT_RIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LAYOUT_RIGHT, LayoutRightClass))
#define IS_LAYOUT_RIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LAYOUT_RIGHT))
#define IS_LAYOUT_RIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LAYOUT_RIGHT))
#define LAYOUT_RIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LAYOUT_RIGHT, LayoutRightClass))

typedef struct _LayoutRight LayoutRight;
typedef struct _LayoutRightClass LayoutRightClass;
typedef struct _LayoutRightPrivate LayoutRightPrivate;
enum  {
	LAYOUT_RIGHT_0_PROPERTY,
	LAYOUT_RIGHT_NUM_PROPERTIES
};
static GParamSpec* layout_right_properties[LAYOUT_RIGHT_NUM_PROPERTIES];

struct _Layout {
	GObject parent_instance;
	LayoutPrivate * priv;
	gdouble _rt_gap;
};

struct _LayoutClass {
	GObjectClass parent_class;
	gboolean (*is_manual) (Layout* self);
	NodeSide (*side_mapping) (Layout* self, NodeSide side);
	void (*initialize) (Layout* self, Node* parent);
	NodeBounds* (*bbox) (Layout* self, Node* parent, gint side_mask, const gchar* msg);
	void (*adjust_tree) (Layout* self, Node* parent, gint child_index, gint side_mask, gdouble amount);
	void (*adjust_tree_all) (Layout* self, Node* n, NodeBounds* p, gdouble amount, const gchar* msg);
	void (*propagate_side) (Layout* self, Node* parent, NodeSide side);
	NodeSide (*get_side) (Layout* self, Node* n);
	void (*set_side) (Layout* self, Node* current);
	void (*handle_update_by_edit) (Layout* self, Node* n, gdouble diffw, gdouble diffh);
	void (*handle_update_by_fold) (Layout* self, Node* n);
	gdouble (*get_insert_adjust) (Layout* self, Node* child);
	void (*handle_update_by_insert) (Layout* self, Node* parent, Node* child, gint pos);
	void (*handle_update_by_delete) (Layout* self, Node* parent, gint index, NodeSide side, gdouble size);
	void (*position_root) (Layout* self, Node* last, Node* n);
};

struct _LayoutRight {
	Layout parent_instance;
	LayoutRightPrivate * priv;
};

struct _LayoutRightClass {
	LayoutClass parent_class;
};

static gpointer layout_right_parent_class = NULL;

VALA_EXTERN GType layout_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Layout, g_object_unref)
VALA_EXTERN GType node_side_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, g_object_unref)
VALA_EXTERN gpointer node_bounds_ref (gpointer instance);
VALA_EXTERN void node_bounds_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_bounds (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_node_bounds (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_node_bounds (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_node_bounds (const GValue* value);
VALA_EXTERN GType node_bounds_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeBounds, node_bounds_unref)
VALA_EXTERN GType layout_right_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutRight, g_object_unref)
VALA_EXTERN NodeSide layout_side_mapping (Layout* self,
                              NodeSide side);
VALA_EXTERN void layout_set_side (Layout* self,
                      Node* current);
VALA_EXTERN LayoutRight* layout_right_new (void);
VALA_EXTERN LayoutRight* layout_right_construct (GType object_type);
VALA_EXTERN Layout* layout_new (void);
VALA_EXTERN Layout* layout_construct (GType object_type);
VALA_EXTERN void layout_set_name (Layout* self,
                      const gchar* value);
VALA_EXTERN void layout_set_light_icon (Layout* self,
                            const gchar* value);
VALA_EXTERN void layout_set_dark_icon (Layout* self,
                           const gchar* value);
VALA_EXTERN void layout_set_balanceable (Layout* self,
                             gboolean value);
static NodeSide layout_right_real_side_mapping (Layout* base,
                                         NodeSide side);
static void layout_right_real_set_side (Layout* base,
                                 Node* current);
VALA_EXTERN void node_set_side (Node* self,
                    NodeSide value);
static GType layout_right_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

LayoutRight*
layout_right_construct (GType object_type)
{
	LayoutRight * self = NULL;
	self = (LayoutRight*) layout_construct (object_type);
	layout_set_name ((Layout*) self, _ ("To right"));
	layout_set_light_icon ((Layout*) self, "minder-layout-right-light-symbolic");
	layout_set_dark_icon ((Layout*) self, "minder-layout-right-dark-symbolic");
	layout_set_balanceable ((Layout*) self, FALSE);
	return self;
}

LayoutRight*
layout_right_new (void)
{
	return layout_right_construct (TYPE_LAYOUT_RIGHT);
}

static NodeSide
layout_right_real_side_mapping (Layout* base,
                                NodeSide side)
{
	LayoutRight * self;
	NodeSide result;
	self = (LayoutRight*) base;
	result = NODE_SIDE_RIGHT;
	return result;
}

static void
layout_right_real_set_side (Layout* base,
                            Node* current)
{
	LayoutRight * self;
	self = (LayoutRight*) base;
	g_return_if_fail (current != NULL);
	node_set_side (current, NODE_SIDE_RIGHT);
}

static void
layout_right_class_init (LayoutRightClass * klass,
                         gpointer klass_data)
{
	layout_right_parent_class = g_type_class_peek_parent (klass);
	((LayoutClass *) klass)->side_mapping = (NodeSide (*) (Layout*, NodeSide)) layout_right_real_side_mapping;
	((LayoutClass *) klass)->set_side = (void (*) (Layout*, Node*)) layout_right_real_set_side;
}

static void
layout_right_instance_init (LayoutRight * self,
                            gpointer klass)
{
}

static GType
layout_right_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LayoutRightClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) layout_right_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LayoutRight), 0, (GInstanceInitFunc) layout_right_instance_init, NULL };
	GType layout_right_type_id;
	layout_right_type_id = g_type_register_static (TYPE_LAYOUT, "LayoutRight", &g_define_type_info, 0);
	return layout_right_type_id;
}

GType
layout_right_get_type (void)
{
	static volatile gsize layout_right_type_id__once = 0;
	if (g_once_init_enter (&layout_right_type_id__once)) {
		GType layout_right_type_id;
		layout_right_type_id = layout_right_get_type_once ();
		g_once_init_leave (&layout_right_type_id__once, layout_right_type_id);
	}
	return layout_right_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;
}

