1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * gimpcontainerview.h 5 * Copyright (C) 2001-2010 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_CONTAINER_VIEW_H__ 22 #define __GIMP_CONTAINER_VIEW_H__ 23 24 25 typedef enum 26 { 27 GIMP_CONTAINER_VIEW_PROP_0, 28 GIMP_CONTAINER_VIEW_PROP_CONTAINER, 29 GIMP_CONTAINER_VIEW_PROP_CONTEXT, 30 GIMP_CONTAINER_VIEW_PROP_SELECTION_MODE, 31 GIMP_CONTAINER_VIEW_PROP_REORDERABLE, 32 GIMP_CONTAINER_VIEW_PROP_VIEW_SIZE, 33 GIMP_CONTAINER_VIEW_PROP_VIEW_BORDER_WIDTH, 34 GIMP_CONTAINER_VIEW_PROP_LAST = GIMP_CONTAINER_VIEW_PROP_VIEW_BORDER_WIDTH 35 } GimpContainerViewProp; 36 37 38 #define GIMP_TYPE_CONTAINER_VIEW (gimp_container_view_get_type ()) 39 #define GIMP_CONTAINER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTAINER_VIEW, GimpContainerView)) 40 #define GIMP_IS_CONTAINER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTAINER_VIEW)) 41 #define GIMP_CONTAINER_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_CONTAINER_VIEW, GimpContainerViewInterface)) 42 43 44 typedef struct _GimpContainerViewInterface GimpContainerViewInterface; 45 46 struct _GimpContainerViewInterface 47 { 48 GTypeInterface base_iface; 49 50 /* signals */ 51 gboolean (* select_item) (GimpContainerView *view, 52 GimpViewable *object, 53 gpointer insert_data); 54 void (* activate_item) (GimpContainerView *view, 55 GimpViewable *object, 56 gpointer insert_data); 57 void (* context_item) (GimpContainerView *view, 58 GimpViewable *object, 59 gpointer insert_data); 60 61 /* virtual functions */ 62 void (* set_container) (GimpContainerView *view, 63 GimpContainer *container); 64 void (* set_context) (GimpContainerView *view, 65 GimpContext *context); 66 void (* set_selection_mode) (GimpContainerView *view, 67 GtkSelectionMode mode); 68 69 gpointer (* insert_item) (GimpContainerView *view, 70 GimpViewable *object, 71 gpointer parent_insert_data, 72 gint index); 73 void (* insert_item_after) (GimpContainerView *view, 74 GimpViewable *object, 75 gpointer insert_data); 76 void (* remove_item) (GimpContainerView *view, 77 GimpViewable *object, 78 gpointer insert_data); 79 void (* reorder_item) (GimpContainerView *view, 80 GimpViewable *object, 81 gint new_index, 82 gpointer insert_data); 83 void (* rename_item) (GimpContainerView *view, 84 GimpViewable *object, 85 gpointer insert_data); 86 void (* expand_item) (GimpContainerView *view, 87 GimpViewable *object, 88 gpointer insert_data); 89 void (* clear_items) (GimpContainerView *view); 90 void (* set_view_size) (GimpContainerView *view); 91 gint (* get_selected) (GimpContainerView *view, 92 GList **items); 93 94 95 /* the destroy notifier for private->hash_table's values */ 96 GDestroyNotify insert_data_free; 97 gboolean model_is_tree; 98 }; 99 100 101 GType gimp_container_view_get_type (void) G_GNUC_CONST; 102 103 GimpContainer * gimp_container_view_get_container (GimpContainerView *view); 104 void gimp_container_view_set_container (GimpContainerView *view, 105 GimpContainer *container); 106 107 GimpContext * gimp_container_view_get_context (GimpContainerView *view); 108 void gimp_container_view_set_context (GimpContainerView *view, 109 GimpContext *context); 110 111 GtkSelectionMode gimp_container_view_get_selection_mode (GimpContainerView *view); 112 void gimp_container_view_set_selection_mode (GimpContainerView *view, 113 GtkSelectionMode mode); 114 115 gint gimp_container_view_get_view_size (GimpContainerView *view, 116 gint *view_border_width); 117 void gimp_container_view_set_view_size (GimpContainerView *view, 118 gint view_size, 119 gint view_border_width); 120 121 gboolean gimp_container_view_get_reorderable (GimpContainerView *view); 122 void gimp_container_view_set_reorderable (GimpContainerView *view, 123 gboolean reorderable); 124 125 GtkWidget * gimp_container_view_get_dnd_widget (GimpContainerView *view); 126 void gimp_container_view_set_dnd_widget (GimpContainerView *view, 127 GtkWidget *dnd_widget); 128 129 void gimp_container_view_enable_dnd (GimpContainerView *editor, 130 GtkButton *button, 131 GType children_type); 132 133 gboolean gimp_container_view_select_item (GimpContainerView *view, 134 GimpViewable *viewable); 135 void gimp_container_view_activate_item (GimpContainerView *view, 136 GimpViewable *viewable); 137 void gimp_container_view_context_item (GimpContainerView *view, 138 GimpViewable *viewable); 139 gint gimp_container_view_get_selected (GimpContainerView *view, 140 GList **list); 141 142 /* protected */ 143 144 gpointer gimp_container_view_lookup (GimpContainerView *view, 145 GimpViewable *viewable); 146 147 gboolean gimp_container_view_item_selected (GimpContainerView *view, 148 GimpViewable *item); 149 gboolean gimp_container_view_multi_selected (GimpContainerView *view, 150 GList *items); 151 void gimp_container_view_item_activated (GimpContainerView *view, 152 GimpViewable *item); 153 void gimp_container_view_item_context (GimpContainerView *view, 154 GimpViewable *item); 155 156 /* convenience functions */ 157 158 void gimp_container_view_install_properties (GObjectClass *klass); 159 void gimp_container_view_set_property (GObject *object, 160 guint property_id, 161 const GValue *value, 162 GParamSpec *pspec); 163 void gimp_container_view_get_property (GObject *object, 164 guint property_id, 165 GValue *value, 166 GParamSpec *pspec); 167 168 #endif /* __GIMP_CONTAINER_VIEW_H__ */ 169