1 /* Copyright (c) 2010 2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) 3 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program (see the file COPYING); if not, see 17 * https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 19 * 20 **************************************************************** 21 */ 22 23 struct ListData; 24 25 struct ListRow 26 { 27 void *data; /* Some data relevant to this row */ 28 struct ListRow *next, *prev; /* doubly linked list */ 29 int y; /* -1 if not on display */ 30 }; 31 32 struct GenericList 33 { 34 int (*gl_printheader) __P((struct ListData *)); /* Print the header */ 35 int (*gl_printfooter) __P((struct ListData *)); /* Print the footer */ 36 int (*gl_printrow) __P((struct ListData *, struct ListRow *)); /* Print one row */ 37 int (*gl_pinput) __P((struct ListData *, char **inp, int *len)); /* Process input */ 38 int (*gl_freerow) __P((struct ListData *, struct ListRow *)); /* Free data for a row */ 39 int (*gl_free) __P((struct ListData *)); /* Free data for the list */ 40 int (*gl_matchrow) __P((struct ListData *, struct ListRow *, const char *)); 41 }; 42 43 struct ListData 44 { 45 const char *name; /* An identifier for the list */ 46 struct ListRow *root; /* The first item in the list */ 47 struct ListRow *selected; /* The selected row */ 48 struct ListRow *top; /* The topmost visible row */ 49 50 struct GenericList *list_fn; /* The functions that deal with the list */ 51 52 char *search; /* The search term, if any */ 53 54 void *data; /* List specific data */ 55 }; 56 57 extern struct LayFuncs ListLf; 58 59 60 struct ListRow * glist_add_row __P((struct ListData *ldata, void *data, struct ListRow *after)); 61 62 void glist_remove_rows __P((struct ListData *ldata)); 63 64 void glist_display_all __P((struct ListData *list)); 65 66 struct ListData * glist_display __P((struct GenericList *list, const char *name)); 67 68 void glist_abort __P((void)); 69 70 void display_displays __P((void)); 71 72 void display_windows __P((int onblank, int order, struct win *group)); 73 74