Thanks to visit codestin.com
Credit goes to code.neomutt.org

NeoMutt  2025-12-11-189-gceedb6
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 "config.h"
45#include <stdbool.h>
46#include <stdint.h>
47#include "mutt/lib.h"
48#include "type.h"
49
50struct ConfigSubset;
51struct KeyEvent;
52struct MuttWindow;
53
54// Observers of #NT_MENU will not be passed any Event data.
55typedef uint8_t MenuRedrawFlags;
56#define MENU_REDRAW_NO_FLAGS 0
57#define MENU_REDRAW_INDEX (1 << 0)
58#define MENU_REDRAW_MOTION (1 << 1)
59#define MENU_REDRAW_CURRENT (1 << 2)
60#define MENU_REDRAW_FULL (1 << 3)
61
71
79struct Menu
80{
81 int current;
82 int max;
86 bool tag_prefix : 1;
87 bool show_indicator : 1;
88 struct MuttWindow *win;
89 struct ConfigSubset *sub;
90
91 /* the following are used only by menu_loop() */
92 int top;
96
108 int (*make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf);
109
121 int (*search)(struct Menu *menu, regex_t *rx, int line);
122
133 int (*tag)(struct Menu *menu, int sel, int act);
134
145 const struct AttrColor *(*color)(struct Menu *menu, int line);
146
147 struct Notify *notify;
148
149 void *mdata;
150
163 void (*mdata_free)(struct Menu *menu, void **ptr);
164};
165
166// Simple movement
172MenuRedrawFlags menu_half_down (struct Menu *menu);
173MenuRedrawFlags menu_half_up (struct Menu *menu);
177MenuRedrawFlags menu_next_line (struct Menu *menu);
178MenuRedrawFlags menu_next_page (struct Menu *menu);
180MenuRedrawFlags menu_prev_line (struct Menu *menu);
181MenuRedrawFlags menu_prev_page (struct Menu *menu);
182MenuRedrawFlags menu_top_page (struct Menu *menu);
183
184void menu_redraw_current(struct Menu *menu);
185void menu_redraw_full (struct Menu *menu);
186void menu_redraw_index (struct Menu *menu);
187void menu_redraw_motion (struct Menu *menu);
188int menu_redraw (struct Menu *menu);
189
190void menu_add_dialog_row(struct Menu *menu, const char *row);
191void menu_cleanup(void);
193void menu_init(void);
194
195struct MuttWindow *menu_window_new(enum MenuType type, struct ConfigSubset *sub);
196
197int menu_get_index(struct Menu *menu);
198MenuRedrawFlags menu_set_index(struct Menu *menu, int index);
199MenuRedrawFlags menu_move_selection(struct Menu *menu, int index);
200void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw);
201MenuRedrawFlags menu_move_view_relative(struct Menu *menu, int relative);
202MenuRedrawFlags menu_set_and_notify(struct Menu *menu, int top, int index);
203void menu_adjust(struct Menu *menu);
204
205int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event);
206int menu_tagging_dispatcher(struct MuttWindow *win, const struct KeyEvent *event);
207
208#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:230
int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Menu function - Implements function_dispatcher_t -.
Definition functions.c:318
enum MenuType menu_get_current_type(void)
Get the type of the current Window.
Definition menu.c:90
void menu_init(void)
Initialise all the Menus.
Definition menu.c:80
MenuRedrawFlags menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition move.c:562
MenuRedrawFlags menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition move.c:363
void menu_cleanup(void)
Free the saved Menu searches.
Definition menu.c:71
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition move.c:319
MenuRedrawFlags menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition move.c:506
MenuRedrawFlags menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition move.c:526
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition draw.c:443
MenuRedrawFlags menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition move.c:484
MenuRedrawFlags menu_move_view_relative(struct Menu *menu, int relative)
Move the view relatively.
Definition move.c:254
MenuRedrawFlags menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition move.c:464
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition draw.c:320
ExpandoDataMenu
Expando UIDs for Menus.
Definition lib.h:68
@ ED_MEN_PERCENTAGE
Menu.top, ...
Definition lib.h:69
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition draw.c:478
MenuRedrawFlags menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition move.c:343
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:186
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:162
MenuRedrawFlags menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition move.c:410
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition draw.c:306
uint8_t MenuRedrawFlags
Flags, e.g. MENU_REDRAW_INDEX.
Definition lib.h:55
MenuRedrawFlags menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition move.c:516
MenuRedrawFlags menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition move.c:333
MenuRedrawFlags menu_move_selection(struct Menu *menu, int index)
Move the selection, keeping within between [0, menu->max].
Definition move.c:236
MenuRedrawFlags menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition move.c:426
MenuRedrawFlags menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition move.c:552
MenuRedrawFlags menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition move.c:539
MenuRedrawFlags menu_prev_entry(struct Menu *menu)
Move the focus to the previous item in the menu.
Definition move.c:382
struct MuttWindow * menu_window_new(enum MenuType type, struct ConfigSubset *sub)
Create a new Menu Window.
Definition window.c:140
MenuRedrawFlags menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition move.c:443
void menu_add_dialog_row(struct Menu *menu, const char *row)
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition draw.c:384
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:176
MenuRedrawFlags menu_next_entry(struct Menu *menu)
Move the focus to the next item in the menu.
Definition move.c:396
Convenience wrapper for the library headers.
A curses colour and its attributes.
Definition attr.h:66
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:50
Definition lib.h:80
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:88
int search_dir
Direction of search.
Definition lib.h:94
int current
Current entry.
Definition lib.h:81
int num_tagged
Number of tagged entries.
Definition lib.h:95
MenuRedrawFlags redraw
When to redraw the screen.
Definition lib.h:83
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition lib.h:163
bool show_indicator
Show the Indicator colour.
Definition lib.h:87
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition lib.h:121
int top
Entry that is the top of the current page.
Definition lib.h:92
int(* tag)(struct Menu *menu, int sel, int act)
Definition lib.h:133
enum MenuType type
Menu definition for keymap entries.
Definition lib.h:84
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition lib.h:108
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:89
struct Notify * notify
Notifications.
Definition lib.h:147
void * mdata
Private data.
Definition lib.h:149
bool tag_prefix
User has pressed <tag-prefix>
Definition lib.h:86
int max
Number of entries in the menu.
Definition lib.h:82
int page_len
Number of entries per screen.
Definition lib.h:85
int old_current
For driver use only.
Definition lib.h:93
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Notification API.
Definition notify.c:53
Menu types.
MenuType
Types of GUI selections.
Definition type.h:33