2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
20 * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
24 #include "mutt_regex.h"
26 #define REDRAW_INDEX (1)
27 #define REDRAW_MOTION (1<<1)
28 #define REDRAW_MOTION_RESYNCH (1<<2)
29 #define REDRAW_CURRENT (1<<3)
30 #define REDRAW_STATUS (1<<4)
31 #define REDRAW_FULL (1<<5)
32 #define REDRAW_BODY (1<<6)
33 #define REDRAW_SIGWINCH (1<<7)
34 #define REDRAW_SIDEBAR (1<<8)
36 #define M_MODEFMT "-- Mutt-ng: %s"
40 char *title; /* the title of this menu */
41 char *help; /* quickref for the current menu */
42 void *data; /* extra data for the current menu */
43 int current; /* current entry */
44 int max; /* the number of entries in the menu */
45 int redraw; /* when to redraw the screen */
46 int menu; /* menu definition for keymap entries. */
47 int offset; /* which screen row to start the index */
48 int pagelen; /* number of entries per screen */
51 /* Setting dialog != NULL overrides normal menu behaviour.
52 * In dialog mode menubar is hidden and prompt keys are checked before
53 * normal menu movement keys. This can cause problems with scrolling, if
54 * prompt keys override movement keys.
56 char **dialog; /* dialog lines themselves */
57 char *prompt; /* prompt for user, similar to mutt_multi_choice */
58 char *keys; /* keys used in the prompt */
60 /* callback to generate an index line for the requested element */
61 void (*make_entry) (char *, size_t, struct menu_t *, int);
63 /* how to search the menu */
64 int (*search) (struct menu_t *, regex_t *re, int n);
66 int (*tag) (struct menu_t *, int i, int m);
68 /* color pair to be used for the requested element
69 * (default function returns ColorDefs[MT_COLOR_NORMAL])
73 /* the following are used only by mutt_menuLoop() */
74 int top; /* entry that is the top of the current page */
75 int oldcurrent; /* for driver use only. */
76 char *searchBuf; /* last search pattern */
77 int searchDir; /* direction of search */
78 int tagged; /* number of tagged entries */
81 void menu_jump (MUTTMENU *);
82 void menu_redraw_full (MUTTMENU *);
83 void menu_redraw_index (MUTTMENU *);
84 void menu_redraw_status (MUTTMENU *);
85 void menu_redraw_motion (MUTTMENU *);
86 void menu_redraw_current (MUTTMENU *);
87 int menu_redraw (MUTTMENU *);
88 void menu_first_entry (MUTTMENU *);
89 void menu_last_entry (MUTTMENU *);
90 void menu_top_page (MUTTMENU *);
91 void menu_bottom_page (MUTTMENU *);
92 void menu_middle_page (MUTTMENU *);
93 void menu_next_page (MUTTMENU *);
94 void menu_prev_page (MUTTMENU *);
95 void menu_next_line (MUTTMENU *);
96 void menu_prev_line (MUTTMENU *);
97 void menu_half_up (MUTTMENU *);
98 void menu_half_down (MUTTMENU *);
99 void menu_current_top (MUTTMENU *);
100 void menu_current_middle (MUTTMENU *);
101 void menu_current_bottom (MUTTMENU *);
102 void menu_check_recenter (MUTTMENU *);
103 void menu_status_line (char *, size_t, MUTTMENU *, const char *);
105 MUTTMENU *mutt_new_menu (void);
106 void mutt_menuDestroy (MUTTMENU **);
107 int mutt_menuLoop (MUTTMENU *);
109 /* used in both the index and pager index to make an entry. */
110 void index_make_entry (char *, size_t, struct menu_t *, int);
111 int index_color (int);