#ifndef __ROCCAT_MACRO_TREE_STORE_H__
#define __ROCCAT_MACRO_TREE_STORE_H__

/*
 * This file is part of roccat-tools.
 *
 * roccat-tools 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.
 *
 * roccat-tools 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 roccat-tools. If not, see <http://www.gnu.org/licenses/>.
 */

#include "roccat/roccat.h"
#include <gtk/gtk.h>

G_BEGIN_DECLS

#define ROCCAT_MACRO_TREE_STORE_TYPE (roccat_macro_tree_store_get_type())
#define ROCCAT_MACRO_TREE_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ROCCAT_MACRO_TREE_STORE_TYPE, RoccatMacroTreeStore))
#define IS_ROCCAT_MACRO_TREE_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ROCCAT_MACRO_TREE_STORE_TYPE))

typedef struct _RoccatMacroTreeStore RoccatMacroTreeStore;
typedef struct _RoccatMacroTreeStorePrivate RoccatMacroTreeStorePrivate;

struct _RoccatMacroTreeStore {
	GtkTreeStore parent;
	RoccatMacroTreeStorePrivate *priv;
};

GType roccat_macro_tree_store_get_type(void);

RoccatMacroTreeStore *roccat_macro_tree_store_new(void);
guint roccat_macro_tree_store_name_column(void);
gboolean roccat_macro_tree_store_is_macroset_with_iter(RoccatMacroTreeStore *store, GtkTreeIter *iter);
gboolean roccat_macro_tree_store_is_macroset_with_path(GtkTreePath *path);
void roccat_macro_tree_store_set_modified(RoccatMacroTreeStore *macro_tree_store, gboolean state);
gboolean roccat_macro_tree_store_get_modified(RoccatMacroTreeStore *macro_tree_store);
void roccat_macro_tree_store_add_macroset(RoccatMacroTreeStore *macro_tree_store, GtkTreeIter *iter, gchar const *name);
void roccat_macro_tree_store_add_macro_with_keystrokes(RoccatMacroTreeStore *macro_tree_store, GtkTreeIter *macroset_iter, GtkTreeIter *macro_iter, gchar const *macro_name, RoccatMacroKeystrokes *keystrokes);
void roccat_macro_tree_store_add_macro(RoccatMacroTreeStore *macro_tree_store, GtkTreeIter *macroset_iter, GtkTreeIter *macro_iter, gchar const *macro_name);

/* returns true if at least one macro was added */
gboolean roccat_macro_tree_store_add_macros(RoccatMacroTreeStore *macro_tree_store, RoccatMacros *roccat_macros);

RoccatMacros *roccat_macro_tree_store_get_macros(RoccatMacroTreeStore *store);
gboolean roccat_macro_tree_store_remove(RoccatMacroTreeStore *store, GtkTreeIter *iter);
gchar *roccat_macro_tree_store_get_name(RoccatMacroTreeStore *store, GtkTreeIter *macro_iter);
RoccatMacroKeystrokes *roccat_macro_tree_store_get_keystrokes(RoccatMacroTreeStore *store, GtkTreeIter *macro_iter);
void roccat_macro_tree_store_set_keystrokes(RoccatMacroTreeStore *store, GtkTreeIter *macro_iter, RoccatMacroKeystrokes *keystrokes);
RoccatMacro *roccat_macro_tree_store_get_macro(RoccatMacroTreeStore *store, GtkTreeIter *macro_iter);
void roccat_macro_tree_store_clear(RoccatMacroTreeStore *store);
gboolean roccat_macro_tree_store_is_macroset_name_unique(RoccatMacroTreeStore *store, gchar const *macroset_name);
gboolean roccat_macro_tree_store_is_macro_name_unique(RoccatMacroTreeStore *store, GtkTreeIter *macroset_iter, gchar const *macro_name);
gchar *roccat_macro_tree_store_generate_unique_macro_name(RoccatMacroTreeStore *store, GtkTreeIter *macroset_iter, gchar const *wanted_macro_name);
void roccat_macro_tree_store_rename(RoccatMacroTreeStore *store, GtkTreeIter *iter, gchar const *new_name);
void roccat_macro_tree_store_dup_macro(RoccatMacroTreeStore *store, GtkTreeIter *macro_iter);

G_END_DECLS

#endif
