00001 /* GLIB - Library of useful routines for C programming 00002 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 00022 * file for a list of people on the GLib Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GLib at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #ifndef __G_COMPLETION_H__ 00028 #define __G_COMPLETION_H__ 00029 00030 #include <glist.h> 00031 #include <stddef.h> /* For size_t */ 00032 #ifdef G_OS_UNIX 00033 #include <unistd.h> 00034 #endif 00035 00036 G_BEGIN_DECLS 00037 00038 typedef struct _GCompletion GCompletion; 00039 00040 typedef gchar* (*GCompletionFunc) (gpointer); 00041 00042 /* GCompletion 00043 */ 00044 00045 typedef int (*GCompletionStrncmpFunc)(const char *s1, const char *s2, size_t n); 00046 00047 struct _GCompletion 00048 { 00049 GList* items; 00050 GCompletionFunc func; 00051 00052 gchar* prefix; 00053 GList* cache; 00054 GCompletionStrncmpFunc strncmp_func; 00055 }; 00056 00057 GCompletion* g_completion_new (GCompletionFunc func); 00058 void g_completion_add_items (GCompletion* cmp, 00059 GList* items); 00060 void g_completion_remove_items (GCompletion* cmp, 00061 GList* items); 00062 void g_completion_clear_items (GCompletion* cmp); 00063 GList* g_completion_complete (GCompletion* cmp, 00064 gchar* prefix, 00065 gchar** new_prefix); 00066 void g_completion_set_compare (GCompletion *cmp, 00067 GCompletionStrncmpFunc strncmp_func); 00068 void g_completion_free (GCompletion* cmp); 00069 00070 G_END_DECLS 00071 00072 #endif /* __G_COMPLETION_H__ */ 00073