NeoMutt  2019-12-07-168-gc45f47
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 <regex.h>
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include <stdio.h>
31 #include "keymap.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  char *title;
85  char *help;
86  void *data;
87  int current;
88  int max;
90  enum MenuType type;
91  int offset;
92  int pagelen;
93  bool tagprefix : 1;
94  bool is_mailbox_list : 1;
98  /* Setting dialog != NULL overrides normal menu behavior.
99  * In dialog mode menubar is hidden and prompt keys are checked before
100  * normal menu movement keys. This can cause problems with scrolling, if
101  * prompt keys override movement keys. */
102  char **dialog;
103  int dsize;
104  char *prompt;
105  char *keys;
107  /* the following are used only by mutt_menu_loop() */
108  int top;
111  int tagged;
120  void (*menu_make_entry)(char *buf, size_t buflen, struct Menu *menu, int line);
129  int (*menu_search)(struct Menu *menu, regex_t *rx, int line);
137  int (*menu_tag)(struct Menu *menu, int sel, int act);
144  int (*menu_color)(int line);
149  void (*menu_custom_redraw)(struct Menu *menu);
150  void *redraw_data;
151 };
153 void menu_bottom_page(struct Menu *menu);
154 void menu_check_recenter(struct Menu *menu);
155 void menu_current_bottom(struct Menu *menu);
156 void menu_current_middle(struct Menu *menu);
157 void menu_current_top(struct Menu *menu);
158 void menu_first_entry(struct Menu *menu);
159 void menu_half_down(struct Menu *menu);
160 void menu_half_up(struct Menu *menu);
161 void menu_last_entry(struct Menu *menu);
162 void menu_middle_page(struct Menu *menu);
163 void menu_next_line(struct Menu *menu);
164 void menu_next_page(struct Menu *menu);
165 void menu_prev_line(struct Menu *menu);
166 void menu_prev_page(struct Menu *menu);
167 void menu_redraw_current(struct Menu *menu);
168 void menu_redraw_full(struct Menu *menu);
169 void menu_redraw_index(struct Menu *menu);
170 void menu_redraw_motion(struct Menu *menu);
171 #ifdef USE_SIDEBAR
172 void menu_redraw_sidebar(struct Menu *menu);
173 #endif
174 void menu_redraw_status(struct Menu *menu);
175 int menu_redraw(struct Menu *menu);
176 void menu_top_page(struct Menu *menu);
177 void mutt_menu_add_dialog_row(struct Menu *menu, const char *row);
178 void mutt_menu_current_redraw(void);
179 void mutt_menu_free(struct Menu **ptr);
180 void mutt_menu_init(void);
181 int mutt_menu_loop(struct Menu *menu);
182 struct Menu *mutt_menu_new(enum MenuType type);
183 void mutt_menu_pop_current(struct Menu *menu);
184 void mutt_menu_push_current(struct Menu *menu);
187 void mutt_menu_set_redraw_full(enum MenuType menu);
193 #endif /* MUTT_MENU_H */
void menu_check_recenter(struct Menu *menu)
Recentre the menu on screen.
Definition: menu.c:570
void menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: menu.c:879
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:40
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:109
struct Menu * mutt_menu_new(enum MenuType type)
Create a new Menu.
Definition: menu.c:972
char * prompt
Prompt for user, similar to mutt_multi_choice.
Definition: mutt_menu.h:104
void menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition: menu.c:864
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition: menu.c:750
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: menu.c:412
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: menu.c:353
A division of the screen.
Definition: mutt_window.h:86
bool C_MenuMoveOff
Config: Allow the last menu item to move off the bottom of the screen.
Definition: menu.c:58
short C_MenuContext
Config: Number of lines of overlap when changing pages in the index.
Definition: menu.c:57
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
void(* menu_make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:120
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:150
void menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition: menu.c:816
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:96
void menu_redraw_status(struct Menu *menu)
Force the redraw of the status bar.
Definition: menu.c:382
void menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: menu.c:768
Star character (for threads)
Definition: mutt_menu.h:68
Equals (for threads)
Definition: mutt_menu.h:70
void(* menu_custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:149
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: menu.c:462
Ampersand character (for threads)
Definition: mutt_menu.h:69
void menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition: menu.c:834
void menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition: menu.c:896
void menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition: menu.c:651
void mutt_menu_add_dialog_row(struct Menu *menu, const char *row)
Add a row to a Menu.
Definition: menu.c:1013
const char * line
Definition: common.c:36
Question mark.
Definition: mutt_menu.h:73
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
void mutt_menu_init(void)
Initialise all the Menus.
Definition: menu.c:961
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:93
bool is_mailbox_list
Definition: mutt_menu.h:94
void menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition: menu.c:799
Tree characters for menus.
Definition: mutt_menu.h:59
int search_dir
Direction of search.
Definition: mutt_menu.h:110
int mutt_menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:1343
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
char * keys
Keys used in the prompt.
Definition: mutt_menu.h:105
int tagged
Number of tagged entries.
Definition: mutt_menu.h:111
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(* menu_color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
int(* menu_tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:137
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int(* menu_search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:129
void menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition: menu.c:777
char * title
Title of this menu.
Definition: mutt_menu.h:84
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
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
void menu_redraw_sidebar(struct Menu *menu)
Force the redraw of the sidebar.
Definition: menu.c:399
void menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition: menu.c:849
void menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition: menu.c:759
void * data
Extra data for the current menu.
Definition: mutt_menu.h:86
int dsize
Number of allocated dialog lines.
Definition: mutt_menu.h:103
bool C_MenuScroll
Config: Scroll the menu/index by one line, rather than a page.
Definition: menu.c:59
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: menu.c:520
void mutt_menu_pop_current(struct Menu *menu)
Remove a Menu from the stack.
Definition: menu.c:1056
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:786
struct MuttWindow * win_index
Definition: mutt_menu.h:95
void menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition: menu.c:677
Left T-piece.
Definition: mutt_menu.h:63
char * help
Quickref for the current menu.
Definition: mutt_menu.h:85
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