/*
 * Copyright (C) 2012 - Juan Ferrer Toribio
 *
 * 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
 * (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, see <http://www.gnu.org/licenses/>.
 */

#ifndef VN_GRID_H
#define VN_GRID_H

#include <db/db.h>
#include <gtk/gtk.h>
#include "vn-grid-model.h"
#include "vn-column.h"

#define VN_TYPE_GRID			(vn_grid_get_type ())
#define VN_GRID(obj)			(G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_GRID, VnGrid))
#define VN_IS_GRID(obj)			(G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_GRID))
#define VN_GRID_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_GRID, VnGridClass))
#define VN_IS_GRID_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_GRID))
#define VN_GRID_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_GRID, VnGridClass))

typedef struct _VnGrid VnGrid;
typedef struct _VnGridClass VnGridClass;

struct _VnGrid
{
	GtkTreeView parent;
	DbIterator * iterator;
	DbModel * model;
};

struct _VnGridClass
{
	/* <private> */
	GtkTreeViewClass parent;
};

GType			vn_grid_get_type			();
VnGrid *		vn_grid_new					();
VnGrid *		vn_grid_new_with_iterator	(DbIterator * iterator);
DbIterator *	vn_grid_get_iterator		(VnGrid * obj);
void			vn_grid_set_iterator		(VnGrid * obj, DbIterator * iterator);
DbModel *		vn_grid_get_model			(VnGrid * obj);
VnColumn *		vn_grid_insert_column		(VnGrid * obj, gint position, gint column_index, const gchar * title, GType column_type, gboolean editable, gboolean expand);
VnColumn *		vn_grid_append_column		(VnGrid * obj, gint column_index, const gchar * title, GType column_type, gboolean editable, gboolean expand);
void			vn_grid_append_columns		(VnGrid * obj, ...);

#endif