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

/*
Copyright (C) 2012, 2013, 2014, 2015 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library 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 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.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

static GType bird_font_native_window_get_type_once (void);

void
bird_font_native_window_file_chooser (BirdFontNativeWindow* self,
                                      const gchar* title,
                                      BirdFontFileChooser* file_chooser_callback,
                                      guint flags)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->file_chooser) {
		_iface_->file_chooser (self, title, file_chooser_callback, flags);
	}
}

void
bird_font_native_window_update_window_size (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->update_window_size) {
		_iface_->update_window_size (self);
	}
}

gchar*
bird_font_native_window_get_clipboard_data (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->get_clipboard_data) {
		return _iface_->get_clipboard_data (self);
	}
	return NULL;
}

void
bird_font_native_window_set_clipboard (BirdFontNativeWindow* self,
                                       const gchar* data)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->set_clipboard) {
		_iface_->set_clipboard (self, data);
	}
}

void
bird_font_native_window_set_inkscape_clipboard (BirdFontNativeWindow* self,
                                                const gchar* data)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->set_inkscape_clipboard) {
		_iface_->set_inkscape_clipboard (self, data);
	}
}

/** Notify the UI about the new font. */
void
bird_font_native_window_font_loaded (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->font_loaded) {
		_iface_->font_loaded (self);
	}
}

/** Exit the application. */
void
bird_font_native_window_quit (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->quit) {
		_iface_->quit (self);
	}
}

/** Convert an image to PNG format. */
gboolean
bird_font_native_window_convert_to_png (BirdFontNativeWindow* self,
                                        const gchar* from,
                                        const gchar* to)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->convert_to_png) {
		return _iface_->convert_to_png (self, from, to);
	}
	return FALSE;
}

/** Export fonts in a background thread. */
void
bird_font_native_window_export_font (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->export_font) {
		_iface_->export_font (self);
	}
}

/** Load font in a background thread. */
void
bird_font_native_window_load (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->load) {
		_iface_->load (self);
	}
}

/** Save font in a background thread. */
void
bird_font_native_window_save (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->save) {
		_iface_->save (self);
	}
}

/** Load images in a background thread. */
void
bird_font_native_window_load_background_image (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->load_background_image) {
		_iface_->load_background_image (self);
	}
}

/** Run a background thread and block the gui. */
void
bird_font_native_window_run_background_thread (BirdFontNativeWindow* self,
                                               BirdFontTask* t)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->run_background_thread) {
		_iface_->run_background_thread (self, t);
	}
}

/** Run a background thread without blocking the gui. */
void
bird_font_native_window_run_non_blocking_background_thread (BirdFontNativeWindow* self,
                                                            BirdFontTask* t)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->run_non_blocking_background_thread) {
		_iface_->run_non_blocking_background_thread (self, t);
	}
}

/** Copy text to clipboard. */
void
bird_font_native_window_set_clipboard_text (BirdFontNativeWindow* self,
                                            const gchar* text)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->set_clipboard_text) {
		_iface_->set_clipboard_text (self, text);
	}
}

/** Get text from clipboard. */
gchar*
bird_font_native_window_get_clipboard_text (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->get_clipboard_text) {
		return _iface_->get_clipboard_text (self);
	}
	return NULL;
}

/** @return true if the current font can be exported. */
gboolean
bird_font_native_window_can_export (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->can_export) {
		return _iface_->can_export (self);
	}
	return FALSE;
}

/** Set cursor visibility */
void
bird_font_native_window_set_cursor (BirdFontNativeWindow* self,
                                    gint visible)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->set_cursor) {
		_iface_->set_cursor (self, visible);
	}
}

/** Scale all offscreen buffers by this factor in order to 
 * support high resolution screens.
 */
gdouble
bird_font_native_window_get_screen_scale (BirdFontNativeWindow* self)
{
	BirdFontNativeWindowIface* _iface_;
	g_return_val_if_fail (self != NULL, 0.0);
	_iface_ = BIRD_FONT_NATIVE_WINDOW_GET_INTERFACE (self);
	if (_iface_->get_screen_scale) {
		return _iface_->get_screen_scale (self);
	}
	return -1.0;
}

static void
bird_font_native_window_default_init (BirdFontNativeWindowIface * iface,
                                      gpointer iface_data)
{
}

static GType
bird_font_native_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontNativeWindowIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_native_window_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType bird_font_native_window_type_id;
	bird_font_native_window_type_id = g_type_register_static (G_TYPE_INTERFACE, "BirdFontNativeWindow", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (bird_font_native_window_type_id, G_TYPE_OBJECT);
	return bird_font_native_window_type_id;
}

GType
bird_font_native_window_get_type (void)
{
	static volatile gsize bird_font_native_window_type_id__once = 0;
	if (g_once_init_enter (&bird_font_native_window_type_id__once)) {
		GType bird_font_native_window_type_id;
		bird_font_native_window_type_id = bird_font_native_window_get_type_once ();
		g_once_init_leave (&bird_font_native_window_type_id__once, bird_font_native_window_type_id);
	}
	return bird_font_native_window_type_id__once;
}

