NeoMutt  2025-12-11-924-g64e75a
Teaching an old dog new tricks
DOXYGEN
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
49struct ConfigSubset;
50struct KeyEvent;
51struct MenuDefinition;
52struct MuttWindow;
53
54// Observers of #NT_MENU will not be passed any Event data.
66typedef uint8_t MenuRedrawFlags;
67
77
85struct Menu
86{
87 int current;
88 int max;
90 const struct MenuDefinition *md;
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;
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
177MenuRedrawFlags menu_first_entry (struct Menu *menu, int count);
178MenuRedrawFlags menu_half_down (struct Menu *menu, int count);
179MenuRedrawFlags menu_half_up (struct Menu *menu, int count);
180MenuRedrawFlags menu_last_entry (struct Menu *menu, int count);
182MenuRedrawFlags menu_next_entry (struct Menu *menu, int count);
183MenuRedrawFlags menu_next_line (struct Menu *menu, int count);
184MenuRedrawFlags menu_next_page (struct Menu *menu, int count);
185MenuRedrawFlags menu_prev_entry (struct Menu *menu, int count);
186MenuRedrawFlags menu_prev_line (struct Menu *menu, int count);
187MenuRedrawFlags menu_prev_page (struct Menu *menu, int count);
188MenuRedrawFlags menu_top_page (struct Menu *menu);
189
190void menu_redraw_current(struct Menu *menu);
191void menu_redraw_full (struct Menu *menu);
192void menu_redraw_index (struct Menu *menu);
193void menu_redraw_motion (struct Menu *menu);
194int menu_redraw (struct Menu *menu);
195
197void menu_init2(char **search_buffers);
198
199struct MuttWindow *menu_window_new(const struct MenuDefinition *md, struct ConfigSubset *sub);
200
201int menu_get_index(struct Menu *menu);
202MenuRedrawFlags menu_set_index(struct Menu *menu, int index);
203MenuRedrawFlags menu_move_selection(struct Menu *menu, int index);
204void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw);
205MenuRedrawFlags menu_move_view_relative(struct Menu *menu, int relative);
206MenuRedrawFlags menu_set_and_notify(struct Menu *menu, int top, int index);
207void menu_adjust(struct Menu *menu);
208
209int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event);
210int menu_tagging_dispatcher(struct MuttWindow *win, const struct KeyEvent *event);
211
212#endif /* MUTT_MENU_LIB_H */
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
int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Menu function - Implements function_dispatcher_t -.
Definition functions.c:366
enum MenuType menu_get_current_type(void)
Get the type of the current Window.
Definition menu.c:82
MenuRedrawFlags menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition move.c:369
MenuRedrawFlags menu_next_page(struct Menu *menu, int count)
Move the focus to the next page in the menu.
Definition move.c:590
struct MuttWindow * menu_window_new(const struct MenuDefinition *md, struct ConfigSubset *sub)
Create a new Menu Window.
Definition window.c:140
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition move.c:325
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition draw.c:464
MenuRedrawFlags menu_prev_page(struct Menu *menu, int count)
Move the focus to the previous page in the menu.
Definition move.c:579
MenuRedrawFlags menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition move.c:506
void menu_init2(char **search_buffers)
Initialise all the Menus.
Definition menu.c:72
MenuRedrawFlags menu_move_view_relative(struct Menu *menu, int relative)
Move the view relatively.
Definition move.c:257
MenuRedrawFlags menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition move.c:486
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition draw.c:341
ExpandoDataMenu
Expando UIDs for Menus.
Definition lib.h:74
@ ED_MEN_PERCENTAGE
Menu.top, ...
Definition lib.h:75
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition draw.c:499
MenuRedrawFlags menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition move.c:349
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:179
MenuRedrawFlags menu_set_and_notify(struct Menu *menu, int top, int index)
Set the Menu selection/view and notify others.
Definition move.c:66
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:155
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition draw.c:327
MenuRedrawFlags menu_first_entry(struct Menu *menu, int count)
Move the focus to the first entry in the menu.
Definition move.c:425
uint8_t MenuRedrawFlags
Definition lib.h:66
MenuRedrawFlags menu_prev_line(struct Menu *menu, int count)
Move the view up one line, keeping the selection the same.
Definition move.c:551
MenuRedrawFlags menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition move.c:339
MenuRedrawFlag
Flags, e.g.
Definition lib.h:59
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:64
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:63
@ MENU_REDRAW_NONE
No flags are set.
Definition lib.h:60
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition lib.h:62
MenuRedrawFlags menu_prev_entry(struct Menu *menu, int count)
Move the focus to the previous item in the menu.
Definition move.c:389
MenuRedrawFlags menu_move_selection(struct Menu *menu, int index)
Move the selection, keeping within between [0, menu->max].
Definition move.c:236
MenuRedrawFlags menu_next_line(struct Menu *menu, int count)
Move the view down one line, keeping the selection the same.
Definition move.c:565
MenuRedrawFlags menu_last_entry(struct Menu *menu, int count)
Move the focus to the last entry in the menu.
Definition move.c:445
MenuRedrawFlags menu_next_entry(struct Menu *menu, int count)
Move the focus to the next item in the menu.
Definition move.c:407
MenuRedrawFlags menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition move.c:465
MenuRedrawFlags menu_half_down(struct Menu *menu, int count)
Move the focus down half a page in the menu.
Definition move.c:540
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition draw.c:405
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:169
MenuRedrawFlags menu_half_up(struct Menu *menu, int count)
Move the focus up half a page in the menu.
Definition move.c:529
Convenience wrapper for the library headers.
A curses colour and its attributes.
Definition attr.h:65
String manipulation buffer.
Definition buffer.h:36
A set of inherited config items.
Definition subset.h:46
An event such as a keypress.
Definition get.h:75
Functions for a Dialog or Window.
Definition menu.h:77
Definition lib.h:86
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
int search_dir
Direction of search.
Definition lib.h:100
int current
Current entry.
Definition lib.h:87
int num_tagged
Number of tagged entries.
Definition lib.h:101
MenuRedrawFlags redraw
When to redraw the screen.
Definition lib.h:89
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition lib.h:169
bool show_indicator
Show the Indicator colour.
Definition lib.h:93
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition lib.h:127
int top
Entry that is the top of the current page.
Definition lib.h:98
int(* tag)(struct Menu *menu, int sel, int act)
Definition lib.h:139
const struct MenuDefinition * md
Menu definition for keymap entries.
Definition lib.h:90
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition lib.h:114
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:95
struct Notify * notify
Notifications.
Definition lib.h:153
void * mdata
Private data.
Definition lib.h:155
bool tag_prefix
User has pressed <tag-prefix>
Definition lib.h:92
int max
Number of entries in the menu.
Definition lib.h:88
int page_len
Number of entries per screen.
Definition lib.h:91
int old_current
For driver use only.
Definition lib.h:99
Notification API.
Definition notify.c:53
Menu types.
MenuType
Types of GUI selections.
Definition type.h:33