/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * pikacontainertreeview.h
 * Copyright (C) 2003-2004 Michael Natterer <mitch@gimp.org>
 *
 * 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 <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_CONTAINER_TREE_VIEW_H__
#define __PIKA_CONTAINER_TREE_VIEW_H__


#include "pikacontainerbox.h"


#define PIKA_TYPE_CONTAINER_TREE_VIEW            (pika_container_tree_view_get_type ())
#define PIKA_CONTAINER_TREE_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_CONTAINER_TREE_VIEW, PikaContainerTreeView))
#define PIKA_CONTAINER_TREE_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_CONTAINER_TREE_VIEW, PikaContainerTreeViewClass))
#define PIKA_IS_CONTAINER_TREE_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_CONTAINER_TREE_VIEW))
#define PIKA_IS_CONTAINER_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_CONTAINER_TREE_VIEW))
#define PIKA_CONTAINER_TREE_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_CONTAINER_TREE_VIEW, PikaContainerTreeViewClass))


typedef struct _PikaContainerTreeViewClass   PikaContainerTreeViewClass;
typedef struct _PikaContainerTreeViewPrivate PikaContainerTreeViewPrivate;

struct _PikaContainerTreeView
{
  PikaContainerBox              parent_instance;

  GtkTreeModel                 *model;
  gint                          n_model_columns;
  GType                         model_columns[16];

  GtkTreeView                  *view;

  GtkTreeViewColumn            *main_column;
  GtkCellRenderer              *renderer_cell;

  Pika                         *dnd_pika; /* eek */

  PikaContainerTreeViewPrivate *priv;
};

struct _PikaContainerTreeViewClass
{
  PikaContainerBoxClass  parent_class;

  /* signals */

  void     (* edit_name)      (PikaContainerTreeView   *tree_view);

  /* virtual functions */

  gboolean (* drop_possible)  (PikaContainerTreeView   *tree_view,
                               PikaDndType              src_type,
                               GList                   *src_viewables,
                               PikaViewable            *dest_viewable,
                               GtkTreePath             *drop_path,
                               GtkTreeViewDropPosition  drop_pos,
                               GtkTreeViewDropPosition *return_drop_pos,
                               GdkDragAction           *return_drag_action);
  void     (* drop_viewables) (PikaContainerTreeView   *tree_view,
                               GList                   *src_viewables,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
  void     (* drop_color)     (PikaContainerTreeView   *tree_view,
                               const PikaRGB           *src_color,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
  void     (* drop_uri_list)  (PikaContainerTreeView   *tree_view,
                               GList                   *uri_list,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
  void     (* drop_svg)       (PikaContainerTreeView   *tree_view,
                               const gchar             *svg_data,
                               gsize                    svg_data_length,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
  void     (* drop_component) (PikaContainerTreeView   *tree_view,
                               PikaImage               *image,
                               PikaChannelType          component,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
  void     (* drop_pixbuf)    (PikaContainerTreeView   *tree_view,
                               GdkPixbuf               *pixbuf,
                               PikaViewable            *dest_viewable,
                               GtkTreeViewDropPosition  drop_pos);
};


GType       pika_container_tree_view_get_type (void) G_GNUC_CONST;

GtkWidget * pika_container_tree_view_new      (PikaContainer *container,
                                               PikaContext   *context,
                                               gint           view_size,
                                               gint           view_border_width);

GtkCellRenderer *
            pika_container_tree_view_get_name_cell
                                              (PikaContainerTreeView *tree_view);

void        pika_container_tree_view_set_main_column_title
                                              (PikaContainerTreeView *tree_view,
                                               const gchar           *title);

void        pika_container_tree_view_add_toggle_cell
                                              (PikaContainerTreeView *tree_view,
                                               GtkCellRenderer       *cell);

void        pika_container_tree_view_add_renderer_cell
                                              (PikaContainerTreeView *tree_view,
                                               GtkCellRenderer       *cell,
                                               gint                   column_number);

void        pika_container_tree_view_set_dnd_drop_to_empty
                                              (PikaContainerTreeView *tree_view,
                                               gboolean               dnd_drop_to_emtpy);
void        pika_container_tree_view_connect_name_edited
                                              (PikaContainerTreeView *tree_view,
                                               GCallback              callback,
                                               gpointer               data);
gboolean    pika_container_tree_view_name_edited
                                              (GtkCellRendererText   *cell,
                                               const gchar           *path_str,
                                               const gchar           *new_name,
                                               PikaContainerTreeView *tree_view);


#endif  /*  __PIKA_CONTAINER_TREE_VIEW_H__  */
