Code

Hide the cursor on the help screen (#247)
[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 #define LW_HIDE_CURSOR    0x01
8 typedef char *  (*list_window_callback_fn_t)   (int index, 
9                                                 int *highlight,
10                                                 void *data);
12 typedef struct
13 {
14   WINDOW *w;
15   int rows, cols;
17   int start;
18   int selected;
19   int xoffset;
20   int clear;
21   int repaint;
22   int flags;
24 } list_window_t;
27 /* create a new list window */
28 list_window_t *list_window_init(WINDOW *w, int width, int height);
30 /* destroy a list window (returns NULL) */
31 list_window_t *list_window_free(list_window_t *lw);
33 /* reset a list window (selected=0, start=0, clear=1) */
34 void list_window_reset(list_window_t *lw);
36 /* paint a list window */
37 void list_window_paint(list_window_t *lw,
38                        list_window_callback_fn_t callback,
39                        void *callback_data);
41 /* perform basic list window commands (movement) */
42 int list_window_cmd(list_window_t *lw, int rows, command_t cmd);
45 /* select functions */
46 void list_window_set_selected(list_window_t *lw, int n);
47 void list_window_previous(list_window_t *lw, int length);
48 void list_window_next(list_window_t *lw, int length);
49 void list_window_first(list_window_t *lw);
50 void list_window_last(list_window_t *lw, int length);
51 void list_window_previous_page(list_window_t *lw);
52 void list_window_next_page(list_window_t *lw, int length);
53 void list_window_check_selected(list_window_t *lw, int length);
54 /* not implemented yet */
55 void list_window_right(list_window_t *lw, int length);
56 void list_window_left(list_window_t *lw);
58 /* find a string in a list window */
59 int  list_window_find(list_window_t *lw, 
60                       list_window_callback_fn_t callback,
61                       void *callback_data,
62                       char *str,
63                       int wrap);
65 /* find a string in a list window (reversed) */
66 int
67 list_window_rfind(list_window_t *lw, 
68                   list_window_callback_fn_t callback,
69                   void *callback_data,
70                   char *str,
71                   int wrap,
72                   int rows);
74 #endif