NeoMutt  2020-04-24
Teaching an old dog new tricks
Go to the documentation of this file.
23 #ifndef MUTT_MENU_H
24 #define MUTT_MENU_H
26 #include "config.h"
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include <stdio.h>
30 #include "keymap.h"
31 #include "mutt/regex3.h"
33 struct NotifyCallback;
35 /* These Config Variables are only used in menu.c */
36 extern short C_MenuContext;
37 extern bool C_MenuMoveOff;
38 extern bool C_MenuScroll;
40 typedef uint16_t MuttRedrawFlags;
41 #define REDRAW_NO_FLAGS 0
42 #define REDRAW_INDEX (1 << 0)
43 #define REDRAW_MOTION (1 << 1)
44 #define REDRAW_MOTION_RESYNC (1 << 2)
45 #define REDRAW_CURRENT (1 << 3)
46 #define REDRAW_STATUS (1 << 4)
47 #define REDRAW_FULL (1 << 5)
48 #define REDRAW_BODY (1 << 6)
49 #define REDRAW_FLOW (1 << 7)
50 #ifdef USE_SIDEBAR
51 #define REDRAW_SIDEBAR (1 << 8)
52 #endif
60 {
77 };
82 struct Menu
83 {
84  const char *title;
85  const char *help;
86  void *data;
87  int current;
88  int max;
90  enum MenuType type;
91  int pagelen;
92  bool tagprefix : 1;
93  bool is_mailbox_list : 1;
97  /* Setting dialog != NULL overrides normal menu behavior.
98  * In dialog mode menubar is hidden and prompt keys are checked before
99  * normal menu movement keys. This can cause problems with scrolling, if
100  * prompt keys override movement keys. */
101  char **dialog;
102  int dsize;
103  char *prompt;
104  char *keys;
106  /* the following are used only by mutt_menu_loop() */
107  int top;
110  int tagged;
119  void (*make_entry)(char *buf, size_t buflen, struct Menu *menu, int line);
129  int (*search)(struct Menu *menu, regex_t *rx, int line);
138  int (*tag)(struct Menu *menu, int sel, int act);
146  int (*color)(int line);
152  void (*custom_redraw)(struct Menu *menu);
154  void *redraw_data;
155 };
157 void menu_bottom_page(struct Menu *menu);
158 void menu_check_recenter(struct Menu *menu);
159 void menu_current_bottom(struct Menu *menu);
160 void menu_current_middle(struct Menu *menu);
161 void menu_current_top(struct Menu *menu);
162 void menu_first_entry(struct Menu *menu);
163 void menu_half_down(struct Menu *menu);
164 void menu_half_up(struct Menu *menu);
165 void menu_last_entry(struct Menu *menu);
166 void menu_middle_page(struct Menu *menu);
167 void menu_next_line(struct Menu *menu);
168 void menu_next_page(struct Menu *menu);
169 void menu_prev_line(struct Menu *menu);
170 void menu_prev_page(struct Menu *menu);
171 void menu_redraw_current(struct Menu *menu);
172 void menu_redraw_full(struct Menu *menu);
173 void menu_redraw_index(struct Menu *menu);
174 void menu_redraw_motion(struct Menu *menu);
175 #ifdef USE_SIDEBAR
176 void menu_redraw_sidebar(struct Menu *menu);
177 #endif
178 void menu_redraw_status(struct Menu *menu);
179 int menu_redraw(struct Menu *menu);
180 void menu_top_page(struct Menu *menu);
181 void mutt_menu_add_dialog_row(struct Menu *menu, const char *row);
182 void mutt_menu_current_redraw(void);
183 void mutt_menu_free(struct Menu **ptr);
184 void mutt_menu_init(void);
185 int mutt_menu_loop(struct Menu *menu);
186 struct Menu *mutt_menu_new(enum MenuType type);
187 void mutt_menu_pop_current(struct Menu *menu);
188 void mutt_menu_push_current(struct Menu *menu);
191 void mutt_menu_set_redraw_full(enum MenuType menu);
197 #endif /* MUTT_MENU_H */
void menu_check_recenter(struct Menu *menu)
Recentre the menu on screen.
Definition: menu.c:571
void menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: menu.c:880
void mutt_menu_set_current_redraw_full(void)
Flag the current menu to be fully redrawn.
Definition: menu.c:1102
Manage keymappings.
Lower left corner.
Definition: mutt_menu.h:61
GUI selectable list of items.
Definition: mutt_menu.h:82
Data passed to a notification function.
Definition: observer.h:39
void mutt_menu_set_redraw(enum MenuType menu, MuttRedrawFlags redraw)
Set redraw flags on a menu.
Definition: menu.c:1116
Types of GUI selections.
Definition: keymap.h:69
int oldcurrent
For driver use only.
Definition: mutt_menu.h:108
struct Menu * mutt_menu_new(enum MenuType type)
Create a new Menu.
Definition: menu.c:973
char * prompt
Prompt for user, similar to mutt_multi_choice.
Definition: mutt_menu.h:103
void menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition: menu.c:865
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:101
void menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition: menu.c:751
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: menu.c:410
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: menu.c:352
A division of the screen.
Definition: mutt_window.h:88
bool C_MenuMoveOff
Config: Allow the last menu item to move off the bottom of the screen.
Definition: menu.c:57
short C_MenuContext
Config: Number of lines of overlap when changing pages in the index.
Definition: menu.c:56
void mutt_menu_push_current(struct Menu *menu)
Add a new Menu to the stack.
Definition: menu.c:1038
void mutt_menu_set_current_redraw(MuttRedrawFlags redraw)
Set redraw flags on the current menu.
Definition: menu.c:1092
Right arrow.
Definition: mutt_menu.h:67
void mutt_menu_set_redraw_full(enum MenuType menu)
Flag a menu to be fully redrawn.
Definition: menu.c:1128
Bottom T-piece.
Definition: mutt_menu.h:72
Blank space.
Definition: mutt_menu.h:66
void * redraw_data
Definition: mutt_menu.h:154
void menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition: menu.c:817
Vertical line.
Definition: mutt_menu.h:65
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
Top T-piece.
Definition: mutt_menu.h:71
struct MuttWindow * win_ibar
Definition: mutt_menu.h:95
const char * title
Title of this menu.
Definition: mutt_menu.h:84
void menu_redraw_status(struct Menu *menu)
Force the redraw of the status bar.
Definition: menu.c:380
void menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: menu.c:769
Star character (for threads)
Definition: mutt_menu.h:68
Equals (for threads)
Definition: mutt_menu.h:70
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: menu.c:461
Ampersand character (for threads)
Definition: mutt_menu.h:69
const char * help
Quickref for the current menu.
Definition: mutt_menu.h:85
void menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition: menu.c:835
void menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition: menu.c:897
void menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition: menu.c:652
void mutt_menu_add_dialog_row(struct Menu *menu, const char *row)
Add a row to a Menu.
Definition: menu.c:1013
Question mark.
Definition: mutt_menu.h:73
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:146
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:107
void mutt_menu_init(void)
Initialise all the Menus.
Definition: menu.c:962
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition: menu.c:1300
bool tagprefix
Definition: mutt_menu.h:92
bool is_mailbox_list
Definition: mutt_menu.h:93
void menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition: menu.c:800
Tree characters for menus.
Definition: mutt_menu.h:59
int search_dir
Direction of search.
Definition: mutt_menu.h:109
int mutt_menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:1343
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:152
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:138
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:91
char * keys
Keys used in the prompt.
Definition: mutt_menu.h:104
int tagged
Number of tagged entries.
Definition: mutt_menu.h:110
int mutt_menu_config_observer(struct NotifyCallback *nc)
Listen for config changes affecting the menu - Implements observer_t.
Definition: menu.c:1644
void mutt_menu_free(struct Menu **ptr)
Destroy a menu.
Definition: menu.c:991
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
void menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition: menu.c:778
Colour indicator.
Definition: mutt_menu.h:76
int mutt_menu_color_observer(struct NotifyCallback *nc)
Listen for colour changes affecting the menu - Implements observer_t.
Definition: menu.c:1600
void menu_redraw_sidebar(struct Menu *menu)
Force the redraw of the sidebar.
Definition: menu.c:397
void menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition: menu.c:850
void menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition: menu.c:760
void * data
Extra data for the current menu.
Definition: mutt_menu.h:86
int dsize
Number of allocated dialog lines.
Definition: mutt_menu.h:102
bool C_MenuScroll
Config: Scroll the menu/index by one line, rather than a page.
Definition: menu.c:58
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: menu.c:521
Manage regular expressions.
void mutt_menu_pop_current(struct Menu *menu)
Remove a Menu from the stack.
Definition: menu.c:1056
int const char int line
Definition: acutest.h:617
int current
Current entry.
Definition: mutt_menu.h:87
void menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition: menu.c:787
struct MuttWindow * win_index
Definition: mutt_menu.h:94
void menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition: menu.c:678
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:129
void(* make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:119
Left T-piece.
Definition: mutt_menu.h:63
Upper left corner.
Definition: mutt_menu.h:62
uint16_t MuttRedrawFlags
Flags, e.g. REDRAW_INDEX.
Definition: mutt_menu.h:40
void mutt_menu_current_redraw(void)
Redraw the current menu.
Definition: menu.c:1137
Horizontal line.
Definition: mutt_menu.h:64