mutt stable branch with some hacks
1/*
2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
3 *
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.
8 *
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.
13 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19/*
20 * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
21 */
22
23#ifndef _MUTT_MENU_H_
24#define _MUTT_MENU_H_ 1
25
26#include "keymap.h"
27#include "mutt_regex.h"
28#include "mutt_curses.h"
29
30#define REDRAW_INDEX (1)
31#define REDRAW_MOTION (1<<1)
32#define REDRAW_MOTION_RESYNCH (1<<2)
33#define REDRAW_CURRENT (1<<3)
34#define REDRAW_STATUS (1<<4)
35#define REDRAW_FULL (1<<5)
36#define REDRAW_BODY (1<<6)
37#define REDRAW_SIGWINCH (1<<7)
38#ifdef USE_SIDEBAR
39#define REDRAW_SIDEBAR (1<<8)
40#endif
41
42#define MUTT_MODEFMT "-- Mutt: %s"
43
44typedef struct menu_t
45{
46 char *title; /* the title of this menu */
47 char *help; /* quickref for the current menu */
48 void *data; /* extra data for the current menu */
49 int current; /* current entry */
50 int max; /* the number of entries in the menu */
51 int redraw; /* when to redraw the screen */
52 int menu; /* menu definition for keymap entries. */
53 int offset; /* row offset within the window to start the index */
54 int pagelen; /* number of entries per screen */
55 int tagprefix;
56 mutt_window_t *indexwin;
57 mutt_window_t *statuswin;
58 mutt_window_t *helpwin;
59 mutt_window_t *messagewin;
60
61 /* Setting dialog != NULL overrides normal menu behavior.
62 * In dialog mode menubar is hidden and prompt keys are checked before
63 * normal menu movement keys. This can cause problems with scrolling, if
64 * prompt keys override movement keys.
65 */
66 char **dialog; /* dialog lines themselves */
67 char *prompt; /* prompt for user, similar to mutt_multi_choice */
68 char *keys; /* keys used in the prompt */
69
70 /* callback to generate an index line for the requested element */
71 void (*make_entry) (char *, size_t, struct menu_t *, int);
72
73 /* how to search the menu */
74 int (*search) (struct menu_t *, regex_t *re, int n);
75
76 int (*tag) (struct menu_t *, int i, int m);
77
78 /* color pair to be used for the requested element
79 * (default function returns ColorDefs[MT_COLOR_NORMAL])
80 */
81 int (*color) (int i);
82
83 /* the following are used only by mutt_menuLoop() */
84 int top; /* entry that is the top of the current page */
85 int oldcurrent; /* for driver use only. */
86 int searchDir; /* direction of search */
87 int tagged; /* number of tagged entries */
88} MUTTMENU;
89
90void mutt_menu_init (void);
91void menu_jump (MUTTMENU *);
92void menu_redraw_full (MUTTMENU *);
93#ifdef USE_SIDEBAR
94void menu_redraw_sidebar (MUTTMENU *);
95#endif
96void menu_redraw_index (MUTTMENU *);
97void menu_redraw_status (MUTTMENU *);
98void menu_redraw_motion (MUTTMENU *);
99void menu_redraw_current (MUTTMENU *);
100int menu_redraw (MUTTMENU *);
101void menu_first_entry (MUTTMENU *);
102void menu_last_entry (MUTTMENU *);
103void menu_top_page (MUTTMENU *);
104void menu_bottom_page (MUTTMENU *);
105void menu_middle_page (MUTTMENU *);
106void menu_next_page (MUTTMENU *);
107void menu_prev_page (MUTTMENU *);
108void menu_next_line (MUTTMENU *);
109void menu_prev_line (MUTTMENU *);
110void menu_half_up (MUTTMENU *);
111void menu_half_down (MUTTMENU *);
112void menu_current_top (MUTTMENU *);
113void menu_current_middle (MUTTMENU *);
114void menu_current_bottom (MUTTMENU *);
115void menu_check_recenter (MUTTMENU *);
116void menu_status_line (char *, size_t, MUTTMENU *, const char *);
117short mutt_ts_capability (void);
118void mutt_ts_status (char *);
119void mutt_ts_icon (char *);
120
121MUTTMENU *mutt_new_menu (int);
122void mutt_menuDestroy (MUTTMENU **);
123int mutt_menuLoop (MUTTMENU *);
124
125/* used in both the index and pager index to make an entry. */
126void index_make_entry (char *, size_t, struct menu_t *, int);
127int index_color (int);
128
129#endif /* _MUTT_MENU_H_ */