1 /* 2 * e-sorter.h 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION) 19 #error "Only <e-util/e-util.h> should be included directly." 20 #endif 21 22 #ifndef E_SORTER_H 23 #define E_SORTER_H 24 25 #include <glib-object.h> 26 27 /* Standard GObject macros */ 28 #define E_TYPE_SORTER \ 29 (e_sorter_get_type ()) 30 #define E_SORTER(obj) \ 31 (G_TYPE_CHECK_INSTANCE_CAST \ 32 ((obj), E_TYPE_SORTER, ESorter)) 33 #define E_IS_SORTER(obj) \ 34 (G_TYPE_CHECK_INSTANCE_TYPE \ 35 ((obj), E_TYPE_SORTER)) 36 #define E_SORTER_GET_INTERFACE(obj) \ 37 (G_TYPE_INSTANCE_GET_INTERFACE \ 38 ((obj), E_TYPE_SORTER, ESorterInterface)) 39 40 G_BEGIN_DECLS 41 42 typedef struct _ESorter ESorter; 43 typedef struct _ESorterInterface ESorterInterface; 44 45 struct _ESorterInterface { 46 GTypeInterface parent_interface; 47 48 gint (*model_to_sorted) (ESorter *sorter, 49 gint row); 50 gint (*sorted_to_model) (ESorter *sorter, 51 gint row); 52 53 void (*get_model_to_sorted_array) 54 (ESorter *sorter, 55 gint **array, 56 gint *count); 57 void (*get_sorted_to_model_array) 58 (ESorter *sorter, 59 gint **array, 60 gint *count); 61 62 gboolean (*needs_sorting) (ESorter *sorter); 63 }; 64 65 GType e_sorter_get_type (void) G_GNUC_CONST; 66 gint e_sorter_model_to_sorted (ESorter *sorter, 67 gint row); 68 gint e_sorter_sorted_to_model (ESorter *sorter, 69 gint row); 70 void e_sorter_get_model_to_sorted_array 71 (ESorter *sorter, 72 gint **array, 73 gint *count); 74 void e_sorter_get_sorted_to_model_array 75 (ESorter *sorter, 76 gint **array, 77 gint *count); 78 gboolean e_sorter_needs_sorting (ESorter *sorter); 79 80 G_END_DECLS 81 82 #endif /* E_SORTER_H */ 83