1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis 3 * 4 * gimpcontainer.h 5 * Copyright (C) 2001 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_H__ 22 #define __GIMP_CONTAINER_H__ 23 24 25 #include "gimpobject.h" 26 27 28 #define GIMP_TYPE_CONTAINER (gimp_container_get_type ()) 29 #define GIMP_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTAINER, GimpContainer)) 30 #define GIMP_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONTAINER, GimpContainerClass)) 31 #define GIMP_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTAINER)) 32 #define GIMP_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER)) 33 #define GIMP_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONTAINER, GimpContainerClass)) 34 35 36 typedef gboolean (* GimpContainerSearchFunc) (GimpObject *object, 37 gpointer user_data); 38 39 40 typedef struct _GimpContainerClass GimpContainerClass; 41 typedef struct _GimpContainerPrivate GimpContainerPrivate; 42 43 struct _GimpContainer 44 { 45 GimpObject parent_instance; 46 47 GimpContainerPrivate *priv; 48 }; 49 50 struct _GimpContainerClass 51 { 52 GimpObjectClass parent_class; 53 54 /* signals */ 55 void (* add) (GimpContainer *container, 56 GimpObject *object); 57 void (* remove) (GimpContainer *container, 58 GimpObject *object); 59 void (* reorder) (GimpContainer *container, 60 GimpObject *object, 61 gint new_index); 62 void (* freeze) (GimpContainer *container); 63 void (* thaw) (GimpContainer *container); 64 65 /* virtual functions */ 66 void (* clear) (GimpContainer *container); 67 gboolean (* have) (GimpContainer *container, 68 GimpObject *object); 69 void (* foreach) (GimpContainer *container, 70 GFunc func, 71 gpointer user_data); 72 GimpObject * (* search) (GimpContainer *container, 73 GimpContainerSearchFunc func, 74 gpointer user_data); 75 gboolean (* get_unique_names) (GimpContainer *container); 76 GimpObject * (* get_child_by_name) (GimpContainer *container, 77 const gchar *name); 78 GimpObject * (* get_child_by_index) (GimpContainer *container, 79 gint index); 80 gint (* get_child_index) (GimpContainer *container, 81 GimpObject *object); 82 }; 83 84 85 GType gimp_container_get_type (void) G_GNUC_CONST; 86 87 GType gimp_container_get_children_type (GimpContainer *container); 88 GimpContainerPolicy gimp_container_get_policy (GimpContainer *container); 89 gint gimp_container_get_n_children (GimpContainer *container); 90 91 gboolean gimp_container_add (GimpContainer *container, 92 GimpObject *object); 93 gboolean gimp_container_remove (GimpContainer *container, 94 GimpObject *object); 95 gboolean gimp_container_insert (GimpContainer *container, 96 GimpObject *object, 97 gint new_index); 98 gboolean gimp_container_reorder (GimpContainer *container, 99 GimpObject *object, 100 gint new_index); 101 102 void gimp_container_freeze (GimpContainer *container); 103 void gimp_container_thaw (GimpContainer *container); 104 gboolean gimp_container_frozen (GimpContainer *container); 105 gint gimp_container_freeze_count (GimpContainer *container); 106 107 void gimp_container_clear (GimpContainer *container); 108 gboolean gimp_container_is_empty (GimpContainer *container); 109 gboolean gimp_container_have (GimpContainer *container, 110 GimpObject *object); 111 void gimp_container_foreach (GimpContainer *container, 112 GFunc func, 113 gpointer user_data); 114 GimpObject * gimp_container_search (GimpContainer *container, 115 GimpContainerSearchFunc func, 116 gpointer user_data); 117 118 gboolean gimp_container_get_unique_names (GimpContainer *container); 119 120 GimpObject * gimp_container_get_child_by_name (GimpContainer *container, 121 const gchar *name); 122 GimpObject * gimp_container_get_child_by_index (GimpContainer *container, 123 gint index); 124 GimpObject * gimp_container_get_first_child (GimpContainer *container); 125 GimpObject * gimp_container_get_last_child (GimpContainer *container); 126 gint gimp_container_get_child_index (GimpContainer *container, 127 GimpObject *object); 128 129 GimpObject * gimp_container_get_neighbor_of (GimpContainer *container, 130 GimpObject *object); 131 132 gchar ** gimp_container_get_name_array (GimpContainer *container, 133 gint *length); 134 135 GQuark gimp_container_add_handler (GimpContainer *container, 136 const gchar *signame, 137 GCallback callback, 138 gpointer callback_data); 139 void gimp_container_remove_handler (GimpContainer *container, 140 GQuark id); 141 void gimp_container_remove_handlers_by_func 142 (GimpContainer *container, 143 GCallback callback, 144 gpointer callback_data); 145 void gimp_container_remove_handlers_by_data 146 (GimpContainer *container, 147 gpointer callback_data); 148 149 150 #endif /* __GIMP_CONTAINER_H__ */ 151