]> git.decadent.org.uk Git - ion3.git/blob - mod_query/listing.h
Imported Upstream version 20090110
[ion3.git] / mod_query / listing.h
1 /*
2  * ion/mod_query/listing.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2009. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_MOD_QUERY_LISTING_H
10 #define ION_MOD_QUERY_LISTING_H
11
12 #include <ioncore/common.h>
13 #include <ioncore/gr.h>
14 #include <ioncore/rectangle.h>
15 #include <libtu/minmax.h>
16
17 INTRSTRUCT(WListing);
18 INTRSTRUCT(WListingItemInfo);
19
20 DECLSTRUCT(WListingItemInfo){
21     int len;
22     int n_parts;
23     int *part_lens;
24 };
25
26 DECLSTRUCT(WListing){
27     char **strs;
28     WListingItemInfo *iteminfos;
29     int nstrs;
30     int selected_str;
31     int ncol, nrow, nitemcol, visrow;
32     int firstitem, firstoff;
33     int itemw, itemh, toth;
34     bool onecol;
35 };
36
37
38 #define LISTING_DRAW_COMPLETE 1
39 #define LISTING_DRAW_ALL 0
40 #define LISTING_DRAW_SELECTED(X) minof(-1, -(X)-2)
41 #define LISTING_DRAW_GET_SELECTED(X) (-(X)-2)
42
43     
44 extern void init_listing(WListing *l);
45 extern void setup_listing(WListing *l, char **strs, int nstrs, bool onecol);
46 extern void deinit_listing(WListing *l);
47 extern void fit_listing(GrBrush *brush, const WRectangle *geom, WListing *l);
48 extern void draw_listing(GrBrush *brush, const WRectangle *geom, WListing *l, 
49                          bool complete, GrAttr selattr);
50 extern bool scrollup_listing(WListing *l);
51 extern bool scrolldown_listing(WListing *l);
52 extern bool listing_select(WListing *l, int i);
53
54 #endif /* ION_MOD_QUERY_LISTING_H */