Code

Documentation update for 0.11.0
[ncmpc.git] / src / list_window.h
1 #ifndef LIST_WINDOW_H
2 #define LIST_WINDOW_H
4 #define LW_ROW(lw) (lw ? lw->selected-lw->start :  0)
6 typedef char *  (*list_window_callback_fn_t)   (int index, 
7                                                 int *highlight,
8                                                 void *data);
10 typedef struct
11 {
12   WINDOW *w;
13   int rows, cols;
15   int start;
16   int selected;
17   int xoffset;
18   int clear;
19   int repaint;
21 } list_window_t;
24 /* create a new list window */
25 list_window_t *list_window_init(WINDOW *w, int width, int height);
27 /* destroy a list window (returns NULL) */
28 list_window_t *list_window_free(list_window_t *lw);
30 /* reset a list window (selected=0, start=0, clear=1) */
31 void list_window_reset(list_window_t *lw);
33 /* paint a list window */
34 void list_window_paint(list_window_t *lw,
35                        list_window_callback_fn_t callback,
36                        void *callback_data);
38 /* perform basic list window commands (movement) */
39 int list_window_cmd(list_window_t *lw, int rows, command_t cmd);
42 /* select functions */
43 void list_window_set_selected(list_window_t *lw, int n);
44 void list_window_previous(list_window_t *lw, int length);
45 void list_window_next(list_window_t *lw, int length);
46 void list_window_first(list_window_t *lw);
47 void list_window_last(list_window_t *lw, int length);
48 void list_window_previous_page(list_window_t *lw);
49 void list_window_next_page(list_window_t *lw, int length);
50 void list_window_check_selected(list_window_t *lw, int length);
51 /* not implemented yet */
52 void list_window_right(list_window_t *lw, int length);
53 void list_window_left(list_window_t *lw);
55 /* find a string in a list window */
56 int  list_window_find(list_window_t *lw, 
57                       list_window_callback_fn_t callback,
58                       void *callback_data,
59                       char *str,
60                       int wrap);
62 /* find a string in a list window (reversed) */
63 int
64 list_window_rfind(list_window_t *lw, 
65                   list_window_callback_fn_t callback,
66                   void *callback_data,
67                   char *str,
68                   int wrap,
69                   int rows);
71 #endif