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


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


#define PDFPC_VIEW_TYPE_BASE (pdfpc_view_base_get_type ())
#define PDFPC_VIEW_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_BASE, pdfpcViewBase))
#define PDFPC_VIEW_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_BASE, pdfpcViewBaseClass))
#define PDFPC_VIEW_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_BASE))
#define PDFPC_VIEW_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_BASE))
#define PDFPC_VIEW_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_BASE, pdfpcViewBaseClass))

typedef struct _pdfpcViewBase pdfpcViewBase;
typedef struct _pdfpcViewBaseClass pdfpcViewBaseClass;
typedef struct _pdfpcViewBasePrivate pdfpcViewBasePrivate;

#define PDFPC_RENDERER_TYPE_BASE (pdfpc_renderer_base_get_type ())
#define PDFPC_RENDERER_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBase))
#define PDFPC_RENDERER_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBaseClass))
#define PDFPC_RENDERER_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_TYPE_BASE))
#define PDFPC_RENDERER_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_TYPE_BASE))
#define PDFPC_RENDERER_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBaseClass))

typedef struct _pdfpcRendererBase pdfpcRendererBase;
typedef struct _pdfpcRendererBaseClass pdfpcRendererBaseClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

typedef enum  {
	PDFPC_RENDERER_RENDER_ERROR_SLIDE_DOES_NOT_EXIST
} pdfpcRendererRenderError;
#define PDFPC_RENDERER_RENDER_ERROR pdfpc_renderer_render_error_quark ()
struct _pdfpcViewBase {
	GtkDrawingArea parent_instance;
	pdfpcViewBasePrivate * priv;
	pdfpcRendererBase* renderer;
};

struct _pdfpcViewBaseClass {
	GtkDrawingAreaClass parent_class;
	void (*display) (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error);
	void (*fade_to_black) (pdfpcViewBase* self);
	void (*redraw) (pdfpcViewBase* self, GError** error);
	gint (*get_current_slide_number) (pdfpcViewBase* self);
};


static gpointer pdfpc_view_base_parent_class = NULL;

GType pdfpc_view_base_get_type (void) G_GNUC_CONST;
GQuark pdfpc_renderer_render_error_quark (void);
GType pdfpc_renderer_base_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_VIEW_BASE_DUMMY_PROPERTY
};
pdfpcViewBase* pdfpc_view_base_construct (GType object_type, pdfpcRendererBase* renderer);
gint pdfpc_renderer_base_get_width (pdfpcRendererBase* self);
gint pdfpc_renderer_base_get_height (pdfpcRendererBase* self);
pdfpcRendererBase* pdfpc_view_base_get_renderer (pdfpcViewBase* self);
void pdfpc_view_base_display (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error);
static void pdfpc_view_base_real_display (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error);
void pdfpc_view_base_fade_to_black (pdfpcViewBase* self);
static void pdfpc_view_base_real_fade_to_black (pdfpcViewBase* self);
void pdfpc_view_base_redraw (pdfpcViewBase* self, GError** error);
static void pdfpc_view_base_real_redraw (pdfpcViewBase* self, GError** error);
gint pdfpc_view_base_get_current_slide_number (pdfpcViewBase* self);
static gint pdfpc_view_base_real_get_current_slide_number (pdfpcViewBase* self);
static void g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void pdfpc_view_base_finalize (GObject* obj);


/**
         * Base constructor taking the renderer to use as an argument
         */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


pdfpcViewBase* pdfpc_view_base_construct (GType object_type, pdfpcRendererBase* renderer) {
	pdfpcViewBase * self = NULL;
	pdfpcRendererBase* _tmp0_;
	pdfpcRendererBase* _tmp1_;
	pdfpcRendererBase* _tmp2_;
	gint _tmp3_ = 0;
	pdfpcRendererBase* _tmp4_;
	gint _tmp5_ = 0;
	g_return_val_if_fail (renderer != NULL, NULL);
	self = (pdfpcViewBase*) g_object_new (object_type, NULL);
	_tmp0_ = renderer;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->renderer);
	self->renderer = _tmp1_;
	_tmp2_ = renderer;
	_tmp3_ = pdfpc_renderer_base_get_width (_tmp2_);
	_tmp4_ = renderer;
	_tmp5_ = pdfpc_renderer_base_get_height (_tmp4_);
	gtk_widget_set_size_request ((GtkWidget*) self, _tmp3_, _tmp5_);
	return self;
}


/**
         * Return the used renderer object
         */
pdfpcRendererBase* pdfpc_view_base_get_renderer (pdfpcViewBase* self) {
	pdfpcRendererBase* result = NULL;
	pdfpcRendererBase* _tmp0_;
	pdfpcRendererBase* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->renderer;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


/**
         * Display a specific slide
         *
         * If the slide number does not exist a RenderError.SLIDE_DOES_NOT_EXIST is thrown
         */
static void pdfpc_view_base_real_display (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_view_base_display'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void pdfpc_view_base_display (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error) {
	g_return_if_fail (self != NULL);
	PDFPC_VIEW_BASE_GET_CLASS (self)->display (self, slide_number, force_redraw, error);
}


/**
         * Make the screen black. Useful for presentations together with a whiteboard
         */
static void pdfpc_view_base_real_fade_to_black (pdfpcViewBase* self) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_view_base_fade_to_black'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void pdfpc_view_base_fade_to_black (pdfpcViewBase* self) {
	g_return_if_fail (self != NULL);
	PDFPC_VIEW_BASE_GET_CLASS (self)->fade_to_black (self);
}


/**
         * Redraw the current slide. Useful for example when exiting from fade_to_black
         */
static void pdfpc_view_base_real_redraw (pdfpcViewBase* self, GError** error) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_view_base_redraw'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void pdfpc_view_base_redraw (pdfpcViewBase* self, GError** error) {
	g_return_if_fail (self != NULL);
	PDFPC_VIEW_BASE_GET_CLASS (self)->redraw (self, error);
}


/**
         * Return the currently shown slide number
         */
static gint pdfpc_view_base_real_get_current_slide_number (pdfpcViewBase* self) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_view_base_get_current_slide_number'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return 0;
}


gint pdfpc_view_base_get_current_slide_number (pdfpcViewBase* self) {
	g_return_val_if_fail (self != NULL, 0);
	return PDFPC_VIEW_BASE_GET_CLASS (self)->get_current_slide_number (self);
}


static void g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
	typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, gint arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__INT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), data2);
}


static void pdfpc_view_base_class_init (pdfpcViewBaseClass * klass) {
	pdfpc_view_base_parent_class = g_type_class_peek_parent (klass);
	PDFPC_VIEW_BASE_CLASS (klass)->display = pdfpc_view_base_real_display;
	PDFPC_VIEW_BASE_CLASS (klass)->fade_to_black = pdfpc_view_base_real_fade_to_black;
	PDFPC_VIEW_BASE_CLASS (klass)->redraw = pdfpc_view_base_real_redraw;
	PDFPC_VIEW_BASE_CLASS (klass)->get_current_slide_number = pdfpc_view_base_real_get_current_slide_number;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_view_base_finalize;
	/**
	         * Signal fired every time a slide is about to be left
	         */
	g_signal_new ("leaving_slide", PDFPC_VIEW_TYPE_BASE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
	/**
	         * Signal fired every time a slide is entered
	         */
	g_signal_new ("entering_slide", PDFPC_VIEW_TYPE_BASE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}


static void pdfpc_view_base_instance_init (pdfpcViewBase * self) {
}


static void pdfpc_view_base_finalize (GObject* obj) {
	pdfpcViewBase * self;
	self = PDFPC_VIEW_BASE (obj);
	_g_object_unref0 (self->renderer);
	G_OBJECT_CLASS (pdfpc_view_base_parent_class)->finalize (obj);
}


/**
     * Base class for every slide view
     */
GType pdfpc_view_base_get_type (void) {
	static volatile gsize pdfpc_view_base_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_view_base_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcViewBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_view_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcViewBase), 0, (GInstanceInitFunc) pdfpc_view_base_instance_init, NULL };
		GType pdfpc_view_base_type_id;
		pdfpc_view_base_type_id = g_type_register_static (GTK_TYPE_DRAWING_AREA, "pdfpcViewBase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&pdfpc_view_base_type_id__volatile, pdfpc_view_base_type_id);
	}
	return pdfpc_view_base_type_id__volatile;
}



