mutt stable branch with some hacks
at jcs 142 lines 4.9 kB view raw
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_FLOW (1<<7) /* Used by pager to reflow text */ 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 int dsize; /* number of allocated dialog lines */ 68 char *prompt; /* prompt for user, similar to mutt_multi_choice */ 69 char *keys; /* keys used in the prompt */ 70 71 /* callback to generate an index line for the requested element */ 72 void (*make_entry) (char *, size_t, struct menu_t *, int); 73 74 /* how to search the menu */ 75 int (*search) (struct menu_t *, regex_t *re, int n); 76 77 int (*tag) (struct menu_t *, int i, int m); 78 79 /* these are used for custom redrawing callbacks */ 80 void (*custom_menu_redraw) (struct menu_t *); 81 void *redraw_data; 82 83 /* color pair to be used for the requested element 84 * (default function returns ColorDefs[MT_COLOR_NORMAL]) 85 */ 86 int (*color) (int i); 87 88 /* the following are used only by mutt_menuLoop() */ 89 int top; /* entry that is the top of the current page */ 90 int oldcurrent; /* for driver use only. */ 91 int searchDir; /* direction of search */ 92 int tagged; /* number of tagged entries */ 93} MUTTMENU; 94 95void mutt_menu_init (void); 96void menu_jump (MUTTMENU *); 97void menu_redraw_full (MUTTMENU *); 98#ifdef USE_SIDEBAR 99void menu_redraw_sidebar (MUTTMENU *); 100#endif 101void menu_redraw_index (MUTTMENU *); 102void menu_redraw_status (MUTTMENU *); 103void menu_redraw_motion (MUTTMENU *); 104void menu_redraw_current (MUTTMENU *); 105int menu_redraw (MUTTMENU *); 106void menu_first_entry (MUTTMENU *); 107void menu_last_entry (MUTTMENU *); 108void menu_top_page (MUTTMENU *); 109void menu_bottom_page (MUTTMENU *); 110void menu_middle_page (MUTTMENU *); 111void menu_next_page (MUTTMENU *); 112void menu_prev_page (MUTTMENU *); 113void menu_next_line (MUTTMENU *); 114void menu_prev_line (MUTTMENU *); 115void menu_half_up (MUTTMENU *); 116void menu_half_down (MUTTMENU *); 117void menu_current_top (MUTTMENU *); 118void menu_current_middle (MUTTMENU *); 119void menu_current_bottom (MUTTMENU *); 120void menu_check_recenter (MUTTMENU *); 121void menu_status_line (char *, size_t, MUTTMENU *, const char *); 122short mutt_ts_capability (void); 123void mutt_ts_status (char *); 124void mutt_ts_icon (char *); 125 126MUTTMENU *mutt_new_menu (int); 127void mutt_menuDestroy (MUTTMENU **); 128void mutt_menu_add_dialog_row (MUTTMENU *, const char *); 129void mutt_push_current_menu (MUTTMENU *); 130void mutt_pop_current_menu (MUTTMENU *); 131void mutt_set_current_menu_redraw (int); 132void mutt_set_current_menu_redraw_full (void); 133void mutt_set_menu_redraw (int, int); 134void mutt_set_menu_redraw_full (int); 135void mutt_current_menu_redraw (void); 136int mutt_menuLoop (MUTTMENU *); 137 138/* used in both the index and pager index to make an entry. */ 139void index_make_entry (char *, size_t, struct menu_t *, int); 140int index_color (int); 141 142#endif /* _MUTT_MENU_H_ */