NeoMutt
2025-12-11-1009-ga75d9e
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
22
40
41
#ifndef MUTT_MENU_LIB_H
42
#define MUTT_MENU_LIB_H
43
44
#include <stdbool.h>
45
#include <stdint.h>
46
#include "
mutt/lib.h
"
47
#include "
type.h
"
48
49
struct
ConfigSubset
;
50
struct
KeyEvent
;
51
struct
MenuDefinition
;
52
struct
MuttWindow
;
53
54
// Observers of #NT_MENU will not be passed any Event data.
58
enum
MenuRedrawFlag
59
{
60
MENU_REDRAW_NONE
= 0,
61
MENU_REDRAW_INDEX
= 1U << 0,
62
MENU_REDRAW_MOTION
= 1U << 1,
63
MENU_REDRAW_CURRENT
= 1U << 2,
64
MENU_REDRAW_FULL
= 1U << 3,
65
};
66
typedef
uint8_t
MenuRedrawFlags
;
67
73
enum
ExpandoDataMenu
74
{
75
ED_MEN_PERCENTAGE
,
76
};
77
85
struct
Menu
86
{
87
int
current
;
88
int
max
;
89
MenuRedrawFlags
redraw
;
90
const
struct
MenuDefinition
*
md
;
91
int
page_len
;
92
bool
tag_prefix
: 1;
93
bool
show_indicator
: 1;
94
struct
MuttWindow
*
win
;
95
struct
ConfigSubset
*
sub
;
96
97
/* the following are used only by menu_loop() */
98
int
top
;
99
int
old_current
;
100
int
search_dir
;
101
int
num_tagged
;
102
114
int (*
make_entry
)(
struct
Menu
*menu,
int
line,
int
max_cols,
struct
Buffer
*buf);
115
127
int (*
search
)(
struct
Menu
*menu, regex_t *rx,
int
line);
128
139
int (*
tag
)(
struct
Menu
*menu,
int
sel,
int
act);
140
151
const
struct
AttrColor
*(*color)(
struct
Menu
*menu,
int
line);
152
153
struct
Notify
*
notify
;
154
155
void
*
mdata
;
156
169
void (*
mdata_free
)(
struct
Menu
*menu,
void
**ptr);
170
};
171
172
// Simple movement
173
MenuRedrawFlags
menu_bottom_page
(
struct
Menu
*menu);
174
MenuRedrawFlags
menu_current_bottom
(
struct
Menu
*menu);
175
MenuRedrawFlags
menu_current_middle
(
struct
Menu
*menu);
176
MenuRedrawFlags
menu_current_top
(
struct
Menu
*menu);
177
MenuRedrawFlags
menu_first_entry
(
struct
Menu
*menu,
int
count);
178
MenuRedrawFlags
menu_half_down
(
struct
Menu
*menu,
int
count);
179
MenuRedrawFlags
menu_half_up
(
struct
Menu
*menu,
int
count);
180
MenuRedrawFlags
menu_last_entry
(
struct
Menu
*menu,
int
count);
181
MenuRedrawFlags
menu_middle_page
(
struct
Menu
*menu);
182
MenuRedrawFlags
menu_next_entry
(
struct
Menu
*menu,
int
count);
183
MenuRedrawFlags
menu_next_line
(
struct
Menu
*menu,
int
count);
184
MenuRedrawFlags
menu_next_page
(
struct
Menu
*menu,
int
count);
185
MenuRedrawFlags
menu_prev_entry
(
struct
Menu
*menu,
int
count);
186
MenuRedrawFlags
menu_prev_line
(
struct
Menu
*menu,
int
count);
187
MenuRedrawFlags
menu_prev_page
(
struct
Menu
*menu,
int
count);
188
MenuRedrawFlags
menu_top_page
(
struct
Menu
*menu);
189
190
void
menu_redraw_current
(
struct
Menu
*menu);
191
void
menu_redraw_full
(
struct
Menu
*menu);
192
void
menu_redraw_index
(
struct
Menu
*menu);
193
void
menu_redraw_motion
(
struct
Menu
*menu);
194
int
menu_redraw
(
struct
Menu
*menu);
195
196
enum
MenuType
menu_get_current_type
(
void
);
197
void
menu_init2
(
char
**search_buffers);
198
199
struct
MuttWindow
*
menu_window_new
(
const
struct
MenuDefinition
*md,
struct
ConfigSubset
*sub);
200
201
int
menu_get_index
(
struct
Menu
*menu);
202
MenuRedrawFlags
menu_set_index
(
struct
Menu
*menu,
int
index);
203
MenuRedrawFlags
menu_move_selection
(
struct
Menu
*menu,
int
index);
204
void
menu_queue_redraw
(
struct
Menu
*menu,
MenuRedrawFlags
redraw);
205
MenuRedrawFlags
menu_move_view_relative
(
struct
Menu
*menu,
int
relative);
206
MenuRedrawFlags
menu_set_and_notify
(
struct
Menu
*menu,
int
top,
int
index);
207
void
menu_adjust
(
struct
Menu
*menu);
208
209
int
menu_function_dispatcher
(
struct
MuttWindow
*win,
const
struct
KeyEvent
*event);
210
int
menu_tagging_dispatcher
(
struct
MuttWindow
*win,
const
struct
KeyEvent
*event);
211
212
#endif
/* MUTT_MENU_LIB_H */
menu_tagging_dispatcher
int menu_tagging_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition
tagging.c:239
menu_function_dispatcher
int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Menu function - Implements function_dispatcher_t -.
Definition
functions.c:366
menu_get_current_type
enum MenuType menu_get_current_type(void)
Get the type of the current Window.
Definition
menu.c:80
menu_bottom_page
MenuRedrawFlags menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition
move.c:369
menu_next_page
MenuRedrawFlags menu_next_page(struct Menu *menu, int count)
Move the focus to the next page in the menu.
Definition
move.c:590
menu_window_new
struct MuttWindow * menu_window_new(const struct MenuDefinition *md, struct ConfigSubset *sub)
Create a new Menu Window.
Definition
window.c:141
menu_adjust
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition
move.c:325
menu_redraw_current
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition
draw.c:451
menu_prev_page
MenuRedrawFlags menu_prev_page(struct Menu *menu, int count)
Move the focus to the previous page in the menu.
Definition
move.c:579
menu_current_bottom
MenuRedrawFlags menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition
move.c:506
menu_init2
void menu_init2(char **search_buffers)
Initialise all the Menus.
Definition
menu.c:70
menu_move_view_relative
MenuRedrawFlags menu_move_view_relative(struct Menu *menu, int relative)
Move the view relatively.
Definition
move.c:257
menu_current_middle
MenuRedrawFlags menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition
move.c:486
menu_redraw_index
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition
draw.c:328
ExpandoDataMenu
ExpandoDataMenu
Expando UIDs for Menus.
Definition
lib.h:74
ED_MEN_PERCENTAGE
@ ED_MEN_PERCENTAGE
Menu.top, ...
Definition
lib.h:75
menu_redraw
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition
draw.c:486
menu_middle_page
MenuRedrawFlags menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition
move.c:349
menu_queue_redraw
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition
menu.c:177
menu_set_and_notify
MenuRedrawFlags menu_set_and_notify(struct Menu *menu, int top, int index)
Set the Menu selection/view and notify others.
Definition
move.c:66
menu_get_index
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition
menu.c:153
menu_redraw_full
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition
draw.c:314
menu_first_entry
MenuRedrawFlags menu_first_entry(struct Menu *menu, int count)
Move the focus to the first entry in the menu.
Definition
move.c:425
MenuRedrawFlags
uint8_t MenuRedrawFlags
Definition
lib.h:66
menu_prev_line
MenuRedrawFlags menu_prev_line(struct Menu *menu, int count)
Move the view up one line, keeping the selection the same.
Definition
move.c:551
menu_top_page
MenuRedrawFlags menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition
move.c:339
MenuRedrawFlag
MenuRedrawFlag
Flags, e.g.
Definition
lib.h:59
MENU_REDRAW_INDEX
@ MENU_REDRAW_INDEX
Redraw the index.
Definition
lib.h:61
MENU_REDRAW_FULL
@ MENU_REDRAW_FULL
Redraw everything.
Definition
lib.h:64
MENU_REDRAW_CURRENT
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition
lib.h:63
MENU_REDRAW_NONE
@ MENU_REDRAW_NONE
No flags are set.
Definition
lib.h:60
MENU_REDRAW_MOTION
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition
lib.h:62
menu_prev_entry
MenuRedrawFlags menu_prev_entry(struct Menu *menu, int count)
Move the focus to the previous item in the menu.
Definition
move.c:389
menu_move_selection
MenuRedrawFlags menu_move_selection(struct Menu *menu, int index)
Move the selection, keeping within between [0, menu->max].
Definition
move.c:236
menu_next_line
MenuRedrawFlags menu_next_line(struct Menu *menu, int count)
Move the view down one line, keeping the selection the same.
Definition
move.c:565
menu_last_entry
MenuRedrawFlags menu_last_entry(struct Menu *menu, int count)
Move the focus to the last entry in the menu.
Definition
move.c:445
menu_next_entry
MenuRedrawFlags menu_next_entry(struct Menu *menu, int count)
Move the focus to the next item in the menu.
Definition
move.c:407
menu_current_top
MenuRedrawFlags menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition
move.c:465
menu_half_down
MenuRedrawFlags menu_half_down(struct Menu *menu, int count)
Move the focus down half a page in the menu.
Definition
move.c:540
menu_redraw_motion
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition
draw.c:392
menu_set_index
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition
menu.c:167
menu_half_up
MenuRedrawFlags menu_half_up(struct Menu *menu, int count)
Move the focus up half a page in the menu.
Definition
move.c:529
lib.h
Convenience wrapper for the library headers.
AttrColor
A curses colour and its attributes.
Definition
attr.h:65
Buffer
String manipulation buffer.
Definition
buffer.h:36
ConfigSubset
A set of inherited config items.
Definition
subset.h:46
KeyEvent
An event such as a keypress.
Definition
get.h:75
MenuDefinition
Functions for a Dialog or Window.
Definition
menudef.h:44
Menu
Definition
lib.h:86
Menu::win
struct MuttWindow * win
Window holding the Menu.
Definition
lib.h:94
Menu::search_dir
int search_dir
Direction of search.
Definition
lib.h:100
Menu::current
int current
Current entry.
Definition
lib.h:87
Menu::num_tagged
int num_tagged
Number of tagged entries.
Definition
lib.h:101
Menu::redraw
MenuRedrawFlags redraw
When to redraw the screen.
Definition
lib.h:89
Menu::mdata_free
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition
lib.h:169
Menu::show_indicator
bool show_indicator
Show the Indicator colour.
Definition
lib.h:93
Menu::search
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition
lib.h:127
Menu::top
int top
Entry that is the top of the current page.
Definition
lib.h:98
Menu::tag
int(* tag)(struct Menu *menu, int sel, int act)
Definition
lib.h:139
Menu::md
const struct MenuDefinition * md
Menu definition for keymap entries.
Definition
lib.h:90
Menu::make_entry
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition
lib.h:114
Menu::sub
struct ConfigSubset * sub
Inherited config items.
Definition
lib.h:95
Menu::notify
struct Notify * notify
Notifications.
Definition
lib.h:153
Menu::mdata
void * mdata
Private data.
Definition
lib.h:155
Menu::tag_prefix
bool tag_prefix
User has pressed <tag-prefix>.
Definition
lib.h:92
Menu::max
int max
Number of entries in the menu.
Definition
lib.h:88
Menu::page_len
int page_len
Number of entries per screen.
Definition
lib.h:91
Menu::old_current
int old_current
For driver use only.
Definition
lib.h:99
MuttWindow
Definition
mutt_window.h:129
Notify
Notification API.
Definition
notify.c:53
type.h
Menu types.
MenuType
MenuType
Types of GUI selections.
Definition
type.h:33