NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
mutt_menu.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_MENU_H
24 #define MUTT_MENU_H
25 
26 #include "config.h"
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include <stdio.h>
30 #include "mutt/lib.h"
31 #include "keymap.h"
32 
33 /* These Config Variables are only used in menu.c */
34 extern short C_MenuContext;
35 extern bool C_MenuMoveOff;
36 extern bool C_MenuScroll;
37 
38 typedef uint16_t MuttRedrawFlags;
39 #define REDRAW_NO_FLAGS 0
40 #define REDRAW_INDEX (1 << 0)
41 #define REDRAW_MOTION (1 << 1)
42 #define REDRAW_MOTION_RESYNC (1 << 2)
43 #define REDRAW_CURRENT (1 << 3)
44 #define REDRAW_STATUS (1 << 4)
45 #define REDRAW_FULL (1 << 5)
46 #define REDRAW_BODY (1 << 6)
47 #define REDRAW_FLOW (1 << 7)
48 
49 
52 struct Menu
53 {
54  const char *title;
55  void *mdata;
56  int current;
57  int max;
59  enum MenuType type;
60  int pagelen;
61  bool tagprefix : 1;
62  bool is_mailbox_list : 1;
65 
66  /* Setting a non-empty dialog overrides normal menu behavior.
67  * In dialog mode menubar is hidden and prompt keys are checked before
68  * normal menu movement keys. This can cause problems with scrolling, if
69  * prompt keys override movement keys. */
70  ARRAY_HEAD(,char*) dialog;
71  char *prompt;
72  char *keys;
73 
74  /* the following are used only by mutt_menu_loop() */
75  int top;
76  int oldcurrent;
77  int search_dir;
78  int tagged;
79  bool custom_search : 1;
80 
88  void (*make_entry)(struct Menu *menu, char *buf, size_t buflen, int line);
89 
98  int (*search)(struct Menu *menu, regex_t *rx, int line);
99 
107  int (*tag)(struct Menu *menu, int sel, int act);
108 
116  int (*color)(struct Menu *menu, int line);
117 
122  void (*custom_redraw)(struct Menu *menu);
123 
124  void *redraw_data;
125 };
126 
127 void menu_bottom_page(struct Menu *menu);
128 void menu_check_recenter(struct Menu *menu);
129 void menu_current_bottom(struct Menu *menu);
130 void menu_current_middle(struct Menu *menu);
131 void menu_current_top(struct Menu *menu);
132 void menu_first_entry(struct Menu *menu);
133 void menu_half_down(struct Menu *menu);
134 void menu_half_up(struct Menu *menu);
135 void menu_last_entry(struct Menu *menu);
136 void menu_middle_page(struct Menu *menu);
137 void menu_next_line(struct Menu *menu);
138 void menu_next_page(struct Menu *menu);
139 void menu_prev_line(struct Menu *menu);
140 void menu_prev_page(struct Menu *menu);
141 void menu_redraw_current(struct Menu *menu);
142 void menu_redraw_full(struct Menu *menu);
143 void menu_redraw_index(struct Menu *menu);
144 void menu_redraw_motion(struct Menu *menu);
145 void menu_redraw_status(struct Menu *menu);
146 int menu_redraw(struct Menu *menu);
147 void menu_top_page(struct Menu *menu);
148 void mutt_menu_add_dialog_row(struct Menu *menu, const char *row);
149 void mutt_menu_current_redraw(void);
150 void mutt_menu_free(struct Menu **ptr);
151 void mutt_menu_init(void);
152 int mutt_menu_loop(struct Menu *menu);
153 struct Menu *mutt_menu_new(enum MenuType type);
154 void mutt_menu_pop_current(struct Menu *menu);
155 void mutt_menu_push_current(struct Menu *menu);
158 void mutt_menu_set_redraw_full(enum MenuType menu);
160 
163 
164 #endif /* MUTT_MENU_H */
Menu::oldcurrent
int oldcurrent
For driver use only.
Definition: mutt_menu.h:76
Menu::prompt
char * prompt
Prompt for user, similar to mutt_multi_choice.
Definition: mutt_menu.h:71
Menu::search
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:98
NotifyCallback
Data passed to a notification function.
Definition: observer.h:39
menu_redraw
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition: menu.c:1270
Menu::ARRAY_HEAD
ARRAY_HEAD(, char *) dialog
Dialog lines themselves.
C_MenuScroll
bool C_MenuScroll
Config: Scroll the menu/index by one line, rather than a page.
Definition: menu.c:58
mutt_menu_color_observer
int mutt_menu_color_observer(struct NotifyCallback *nc)
Listen for colour changes affecting the menu - Implements observer_t.
Definition: menu.c:1570
MuttWindow
A division of the screen.
Definition: mutt_window.h:115
menu_current_bottom
void menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition: menu.c:879
menu_redraw_status
void menu_redraw_status(struct Menu *menu)
Force the redraw of the status bar.
Definition: menu.c:365
menu_bottom_page
void menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition: menu.c:776
menu_current_top
void menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition: menu.c:845
Menu::make_entry
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Format a item for a menu.
Definition: mutt_menu.h:88
Menu::win_ibar
struct MuttWindow * win_ibar
Definition: mutt_menu.h:64
menu_redraw_index
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: menu.c:381
menu_current_middle
void menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: menu.c:861
Menu::redraw_data
void * redraw_data
Definition: mutt_menu.h:124
mutt_menu_init
void mutt_menu_init(void)
Initialise all the Menus.
Definition: menu.c:945
menu_top_page
void menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition: menu.c:763
menu_last_entry
void menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition: menu.c:829
Menu::search_dir
int search_dir
Direction of search.
Definition: mutt_menu.h:77
mutt_menu_set_current_redraw
void mutt_menu_set_current_redraw(MuttRedrawFlags redraw)
Set redraw flags on the current menu.
Definition: menu.c:1062
keymap.h
lib.h
mutt_menu_set_current_redraw_full
void mutt_menu_set_current_redraw_full(void)
Flag the current menu to be fully redrawn.
Definition: menu.c:1072
mutt_menu_pop_current
void mutt_menu_pop_current(struct Menu *menu)
Remove a Menu from the stack.
Definition: menu.c:1027
Menu::type
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:59
MuttRedrawFlags
uint16_t MuttRedrawFlags
Flags, e.g. REDRAW_INDEX.
Definition: mutt_menu.h:38
Menu::pagelen
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:60
Menu::tagprefix
bool tagprefix
Definition: mutt_menu.h:61
Menu::keys
char * keys
Keys used in the prompt.
Definition: mutt_menu.h:72
C_MenuContext
short C_MenuContext
Config: Number of lines of overlap when changing pages in the index.
Definition: menu.c:56
mutt_menu_config_observer
int mutt_menu_config_observer(struct NotifyCallback *nc)
Listen for config changes affecting the menu - Implements observer_t.
Definition: menu.c:1614
menu_first_entry
void menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition: menu.c:813
C_MenuMoveOff
bool C_MenuMoveOff
Config: Allow the last menu item to move off the bottom of the screen.
Definition: menu.c:57
Menu::tag
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:107
menu_prev_page
void menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition: menu.c:736
Menu::title
const char * title
Title of this menu.
Definition: mutt_menu.h:54
Menu::is_mailbox_list
bool is_mailbox_list
Definition: mutt_menu.h:62
menu_redraw_motion
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: menu.c:434
Menu::custom_search
bool custom_search
The menu implements its own non-Menusearch()-compatible search, trickle OP_SEARCH*.
Definition: mutt_menu.h:79
Menu::top
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:75
menu_next_line
void menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition: menu.c:625
mutt_menu_loop
int mutt_menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:1309
menu_half_up
void menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition: menu.c:754
menu_prev_line
void menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition: menu.c:652
mutt_menu_current_redraw
void mutt_menu_current_redraw(void)
Redraw the current menu.
Definition: menu.c:1107
Menu::mdata
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:55
Menu::tagged
int tagged
Number of tagged entries.
Definition: mutt_menu.h:78
Menu::custom_redraw
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:122
menu_next_page
void menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition: menu.c:727
Menu::max
int max
Number of entries in the menu.
Definition: mutt_menu.h:57
menu_middle_page
void menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition: menu.c:794
MenuType
MenuType
Types of GUI selections.
Definition: keymap.h:72
mutt_menu_add_dialog_row
void mutt_menu_add_dialog_row(struct Menu *menu, const char *row)
Add a row to a Menu.
Definition: menu.c:993
Menu::redraw
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:58
menu_redraw_current
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: menu.c:494
mutt_menu_new
struct Menu * mutt_menu_new(enum MenuType type)
Create a new Menu.
Definition: menu.c:956
mutt_menu_set_redraw
void mutt_menu_set_redraw(enum MenuType menu, MuttRedrawFlags redraw)
Set redraw flags on a menu.
Definition: menu.c:1086
Menu::current
int current
Current entry.
Definition: mutt_menu.h:56
mutt_menu_free
void mutt_menu_free(struct Menu **ptr)
Destroy a menu.
Definition: menu.c:972
menu_redraw_full
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: menu.c:348
mutt_menu_set_redraw_full
void mutt_menu_set_redraw_full(enum MenuType menu)
Flag a menu to be fully redrawn.
Definition: menu.c:1098
mutt_menu_push_current
void mutt_menu_push_current(struct Menu *menu)
Add a new Menu to the stack.
Definition: menu.c:1015
Menu::win_index
struct MuttWindow * win_index
Definition: mutt_menu.h:63
Menu
GUI selectable list of items.
Definition: mutt_menu.h:52
Menu::color
int(* color)(struct Menu *menu, int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:116
menu_half_down
void menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: menu.c:745
menu_check_recenter
void menu_check_recenter(struct Menu *menu)
Recentre the menu on screen.
Definition: menu.c:544