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.
11 * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
15 #include "mutt_regex.h"
17 #define REDRAW_INDEX (1)
18 #define REDRAW_MOTION (1<<1)
19 #define REDRAW_MOTION_RESYNCH (1<<2)
20 #define REDRAW_CURRENT (1<<3)
21 #define REDRAW_STATUS (1<<4)
22 #define REDRAW_FULL (1<<5)
23 #define REDRAW_BODY (1<<6)
24 #define REDRAW_SIGWINCH (1<<7)
25 #define REDRAW_SIDEBAR (1<<8)
27 #define M_MODEFMT "-- Mutt-ng: %s"
29 typedef struct menu_t {
30 char *title; /* the title of this menu */
31 char *help; /* quickref for the current menu */
32 void *data; /* extra data for the current menu */
33 int current; /* current entry */
34 int max; /* the number of entries in the menu */
35 int redraw; /* when to redraw the screen */
36 int menu; /* menu definition for keymap entries. */
37 int offset; /* which screen row to start the index */
38 int pagelen; /* number of entries per screen */
41 /* Setting dialog != NULL overrides normal menu behaviour.
42 * In dialog mode menubar is hidden and prompt keys are checked before
43 * normal menu movement keys. This can cause problems with scrolling, if
44 * prompt keys override movement keys.
46 char **dialog; /* dialog lines themselves */
47 char *prompt; /* prompt for user, similar to mutt_multi_choice */
48 char *keys; /* keys used in the prompt */
50 /* callback to generate an index line for the requested element */
51 void (*make_entry) (char *, size_t, struct menu_t *, int);
53 /* how to search the menu */
54 int (*search) (struct menu_t *, regex_t * re, int n);
56 int (*tag) (struct menu_t *, int i, int m);
58 /* color pair to be used for the requested element
59 * (default function returns ColorDefs[MT_COLOR_NORMAL])
63 /* the following are used only by mutt_menuLoop() */
64 int top; /* entry that is the top of the current page */
65 int oldcurrent; /* for driver use only. */
66 char *searchBuf; /* last search pattern */
67 int searchDir; /* direction of search */
68 int tagged; /* number of tagged entries */
71 void menu_jump (MUTTMENU *);
72 void menu_redraw_full (MUTTMENU *);
73 void menu_redraw_index (MUTTMENU *);
74 void menu_redraw_status (MUTTMENU *);
75 void menu_redraw_motion (MUTTMENU *);
76 void menu_redraw_current (MUTTMENU *);
77 int menu_redraw (MUTTMENU *);
78 void menu_first_entry (MUTTMENU *);
79 void menu_last_entry (MUTTMENU *);
80 void menu_top_page (MUTTMENU *);
81 void menu_bottom_page (MUTTMENU *);
82 void menu_middle_page (MUTTMENU *);
83 void menu_next_page (MUTTMENU *);
84 void menu_prev_page (MUTTMENU *);
85 void menu_next_line (MUTTMENU *);
86 void menu_prev_line (MUTTMENU *);
87 void menu_half_up (MUTTMENU *);
88 void menu_half_down (MUTTMENU *);
89 void menu_current_top (MUTTMENU *);
90 void menu_current_middle (MUTTMENU *);
91 void menu_current_bottom (MUTTMENU *);
92 void menu_check_recenter (MUTTMENU *);
93 void menu_status_line (char *, size_t, MUTTMENU *, const char *);
95 MUTTMENU *mutt_new_menu (void);
96 void mutt_menuDestroy (MUTTMENU **);
97 int mutt_menuLoop (MUTTMENU *);
99 /* used in both the index and pager index to make an entry. */
100 void index_make_entry (char *, size_t, struct menu_t *, int);
101 int index_color (int);