2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
12 * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
15 #include <lib-lib/lib-lib.h>
19 #define REDRAW_INDEX (1)
20 #define REDRAW_MOTION (1<<1)
21 #define REDRAW_MOTION_RESYNCH (1<<2)
22 #define REDRAW_CURRENT (1<<3)
23 #define REDRAW_STATUS (1<<4)
24 #define REDRAW_FULL (1<<5)
25 #define REDRAW_BODY (1<<6)
26 #define REDRAW_SIGWINCH (1<<7)
27 #define REDRAW_SIDEBAR (1<<8)
29 #define M_MODEFMT "-- Madmutt: %s"
31 typedef struct menu_t {
32 char *title; /* the title of this menu */
33 char *help; /* quickref for the current menu */
34 void *data; /* extra data for the current menu */
35 int current; /* current entry */
36 int max; /* the number of entries in the menu */
37 int redraw; /* when to redraw the screen */
38 int menu; /* menu definition for keymap entries. */
39 int offset; /* which screen row to start the index */
40 int pagelen; /* number of entries per screen */
43 /* Setting dialog != NULL overrides normal menu behaviour.
44 * In dialog mode menubar is hidden and prompt keys are checked before
45 * normal menu movement keys. This can cause problems with scrolling, if
46 * prompt keys override movement keys.
48 char **dialog; /* dialog lines themselves */
49 char *prompt; /* prompt for user, similar to mutt_multi_choice */
50 char *keys; /* keys used in the prompt */
52 /* callback to generate an index line for the requested element */
53 void (*make_entry) (char *, ssize_t, struct menu_t *, int);
55 /* how to search the menu */
56 int (*search) (struct menu_t *, regex_t * re, int n);
58 int (*tag) (struct menu_t *, int i, int m);
60 /* color pair to be used for the requested element
61 * (default function returns ColorDefs[MT_COLOR_NORMAL])
65 /* the following are used only by mutt_menuLoop() */
66 int top; /* entry that is the top of the current page */
67 int oldcurrent; /* for driver use only. */
68 char *searchBuf; /* last search pattern */
69 int searchDir; /* direction of search */
70 int tagged; /* number of tagged entries */
73 void menu_jump (MUTTMENU *);
74 void menu_redraw_full (MUTTMENU *);
75 void menu_redraw_index (MUTTMENU *);
76 void menu_redraw_status (MUTTMENU *);
77 void menu_redraw_motion (MUTTMENU *);
78 void menu_redraw_current (MUTTMENU *);
79 int menu_redraw (MUTTMENU *);
80 void menu_first_entry (MUTTMENU *);
81 void menu_last_entry (MUTTMENU *);
82 void menu_top_page (MUTTMENU *);
83 void menu_bottom_page (MUTTMENU *);
84 void menu_middle_page (MUTTMENU *);
85 void menu_next_page (MUTTMENU *);
86 void menu_prev_page (MUTTMENU *);
87 void menu_next_line (MUTTMENU *);
88 void menu_prev_line (MUTTMENU *);
89 void menu_half_up (MUTTMENU *);
90 void menu_half_down (MUTTMENU *);
91 void menu_current_top (MUTTMENU *);
92 void menu_current_middle (MUTTMENU *);
93 void menu_current_bottom (MUTTMENU *);
94 void menu_check_recenter (MUTTMENU *);
95 void menu_status_line (char *, ssize_t, MUTTMENU *, const char *);
97 MUTTMENU *mutt_new_menu (void);
98 void mutt_menuDestroy (MUTTMENU **);
99 int mutt_menuLoop (MUTTMENU *);
101 /* used in both the index and pager index to make an entry. */
102 void index_make_entry (char *, ssize_t, struct menu_t *, int);
103 int index_color (int);
105 #endif /* !_MUTT_MENU_H */