Release v.5.0.0
[screen.git] / src / list_generic.h
blob448041a2b1b19e4c510087e4586a3deb304eceb4
1 /* Copyright (c) 2010
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
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.
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.
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
20 ****************************************************************
23 #ifndef SCREEN_LIST_GENERIC_H
24 #define SCREEN_LIST_GENERIC_H
26 #include <stdlib.h>
28 #include "window.h"
30 typedef struct ListData ListData;
31 typedef struct ListRow ListRow;
32 typedef struct GenericList GenericList;
34 struct ListRow {
35 void *data; /* Some data relevant to this row */
36 ListRow *next, *prev; /* doubly linked list */
37 int y; /* -1 if not on display */
40 struct GenericList {
41 int (*gl_printheader) (ListData *); /* Print the header */
42 int (*gl_printfooter) (ListData *); /* Print the footer */
43 int (*gl_printrow) (ListData *, ListRow *); /* Print one row */
44 int (*gl_pinput) (ListData *, char **inp, size_t *len); /* Process input */
45 int (*gl_freerow) (ListData *, ListRow *); /* Free data for a row */
46 int (*gl_free) (ListData *); /* Free data for the list */
47 int (*gl_rebuild) (ListData *); /* Rebuild display */
48 int (*gl_matchrow) (ListData *, ListRow *, const char *);
51 struct ListData {
52 const char *name; /* An identifier for the list */
53 ListRow *root; /* The first item in the list */
54 ListRow *selected; /* The selected row */
55 ListRow *top; /* The topmost visible row */
57 const GenericList *list_fn; /* The functions that deal with the list */
59 char *search; /* The search term, if any */
61 void *data; /* List specific data */
65 ListRow * glist_add_row (ListData *ldata, void *data, ListRow *after);
67 void glist_remove_rows (ListData *ldata);
69 void glist_display_all (ListData *list);
71 ListData * glist_display (const GenericList *list, const char *name);
73 void glist_abort (void);
75 void display_displays (void);
77 void display_license (void);
79 void display_windows (int onblank, int order, Window *group);
81 /* global variables */
83 extern const struct LayFuncs ListLf;
85 #endif /* SCREEN_LIST_GENERIC_H */