1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * gimpitemtreeview.h
5  * Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GIMP_ITEM_TREE_VIEW_H__
22 #define __GIMP_ITEM_TREE_VIEW_H__
23 
24 
25 #include "gimpcontainertreeview.h"
26 
27 
28 typedef GimpContainer * (* GimpGetContainerFunc) (GimpImage *image);
29 typedef GimpItem      * (* GimpGetItemFunc)      (GimpImage *image);
30 typedef void            (* GimpSetItemFunc)      (GimpImage *image,
31                                                   GimpItem  *item);
32 typedef void            (* GimpAddItemFunc)      (GimpImage *image,
33                                                   GimpItem  *item,
34                                                   GimpItem  *parent,
35                                                   gint       index,
36                                                   gboolean   push_undo);
37 typedef void            (* GimpRemoveItemFunc)   (GimpImage *image,
38                                                   GimpItem  *item,
39                                                   gboolean   push_undo,
40                                                   GimpItem  *new_active);
41 typedef GimpItem      * (* GimpNewItemFunc)      (GimpImage *image);
42 
43 
44 #define GIMP_TYPE_ITEM_TREE_VIEW            (gimp_item_tree_view_get_type ())
45 #define GIMP_ITEM_TREE_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeView))
46 #define GIMP_ITEM_TREE_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeViewClass))
47 #define GIMP_IS_ITEM_TREE_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM_TREE_VIEW))
48 #define GIMP_IS_ITEM_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM_TREE_VIEW))
49 #define GIMP_ITEM_TREE_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeViewClass))
50 
51 
52 typedef struct _GimpItemTreeViewClass   GimpItemTreeViewClass;
53 typedef struct _GimpItemTreeViewPrivate GimpItemTreeViewPrivate;
54 
55 struct _GimpItemTreeView
56 {
57   GimpContainerTreeView    parent_instance;
58 
59   GimpItemTreeViewPrivate *priv;
60 };
61 
62 struct _GimpItemTreeViewClass
63 {
64   GimpContainerTreeViewClass  parent_class;
65 
66   /*  signals  */
67   void (* set_image) (GimpItemTreeView *view,
68                       GimpImage        *image);
69 
70   GType                 item_type;
71   const gchar          *signal_name;
72 
73   /*  virtual functions for manipulating the image's item tree  */
74   GimpGetContainerFunc  get_container;
75   GimpGetItemFunc       get_active_item;
76   GimpSetItemFunc       set_active_item;
77   GimpAddItemFunc       add_item;
78   GimpRemoveItemFunc    remove_item;
79   GimpNewItemFunc       new_item;
80 
81   /*  action names  */
82   const gchar          *action_group;
83   const gchar          *activate_action;
84   const gchar          *new_action;
85   const gchar          *new_default_action;
86   const gchar          *raise_action;
87   const gchar          *raise_top_action;
88   const gchar          *lower_action;
89   const gchar          *lower_bottom_action;
90   const gchar          *duplicate_action;
91   const gchar          *delete_action;
92 
93   /*  lock content button appearance  */
94   const gchar          *lock_content_icon_name;
95   const gchar          *lock_content_tooltip;
96   const gchar          *lock_content_help_id;
97 
98   /* lock position (translation and transformation) button appearance */
99   const gchar          *lock_position_icon_name;
100   const gchar          *lock_position_tooltip;
101   const gchar          *lock_position_help_id;
102 };
103 
104 
105 GType       gimp_item_tree_view_get_type          (void) G_GNUC_CONST;
106 
107 GtkWidget * gimp_item_tree_view_new               (GType             view_type,
108                                                    gint              view_size,
109                                                    gint              view_border_width,
110                                                    GimpImage        *image,
111                                                    GimpMenuFactory  *menu_facotry,
112                                                    const gchar      *menu_identifier,
113                                                    const gchar      *ui_identifier);
114 
115 void        gimp_item_tree_view_set_image         (GimpItemTreeView *view,
116                                                    GimpImage        *image);
117 GimpImage * gimp_item_tree_view_get_image         (GimpItemTreeView *view);
118 
119 void        gimp_item_tree_view_add_options       (GimpItemTreeView *view,
120                                                    const gchar      *label,
121                                                    GtkWidget        *options);
122 GtkWidget * gimp_item_tree_view_get_lock_box      (GimpItemTreeView *view);
123 
124 GtkWidget * gimp_item_tree_view_get_new_button    (GimpItemTreeView *view);
125 GtkWidget * gimp_item_tree_view_get_delete_button (GimpItemTreeView *view);
126 
127 gint        gimp_item_tree_view_get_drop_index    (GimpItemTreeView *view,
128                                                    GimpViewable     *dest_viewable,
129                                                    GtkTreeViewDropPosition drop_pos,
130                                                    GimpViewable    **parent);
131 
132 
133 #endif  /*  __GIMP_ITEM_TREE_VIEW_H__  */
134