24#ifndef MUTT_GUI_MUTT_WINDOW_H
25#define MUTT_GUI_MUTT_WINDOW_H
53#define MUTT_WIN_SIZE_UNLIMITED -1
109#define WA_REFLOW (1 << 0)
110#define WA_RECALC (1 << 1)
111#define WA_REPAINT (1 << 2)
210#define WN_TALLER (1 << 0)
211#define WN_SHORTER (1 << 1)
212#define WN_WIDER (1 << 2)
213#define WN_NARROWER (1 << 3)
214#define WN_MOVED (1 << 4)
215#define WN_VISIBLE (1 << 5)
216#define WN_HIDDEN (1 << 6)
263 __attribute__((__format__(__printf__, 4, 5)));
265 __attribute__((__format__(__printf__, 2, 3)));
Convenience wrapper for the library headers.
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
int int bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
uint8_t WindowNotifyFlags
Flags for Changes to a MuttWindow, e.g. WN_TALLER.
WindowType
Type of Window.
@ WT_CUSTOM
Window with a custom drawing function.
@ WT_ROOT
Parent of All Windows.
@ WT_DLG_ALIAS
Alias Dialog, dlg_alias()
@ WT_ALL_DIALOGS
Container for All Dialogs (nested Windows)
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
@ WT_MESSAGE
Window for messages/errors.
@ WT_DLG_SMIME
Smime Dialog, dlg_smime()
@ WT_DLG_QUERY
Query Dialog, dlg_query()
@ WT_DLG_HISTORY
History Dialog, dlg_history()
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
@ WT_CONTAINER
Invisible shaping container Window.
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_certificate()
@ WT_DLG_COMPOSE
Compose Dialog, dlg_compose()
@ WT_DLG_INDEX
Index Dialog, dlg_index()
@ WT_PAGER
A panel containing the Pager Window.
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
@ WT_DLG_POSTPONED
Postponed Dialog, dlg_postponed()
@ WT_INDEX
A panel containing the Index Window.
@ WT_DLG_ATTACHMENT
Attachment Dialog, dlg_attachment()
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_autocrypt()
@ WT_MENU
An Window containing a Menu.
@ WT_DLG_PATTERN
Pattern Dialog, dlg_pattern()
MuttWindowOrientation
Which way does the Window expand?
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
@ MUTT_WIN_ORIENT_HORIZONTAL
Window uses all available horizontal space.
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
NotifyWindow
Window notification types.
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
@ NT_WINDOW_DELETE
Window is about to be deleted.
@ NT_WINDOW_FOCUS
Window focus has changed.
@ NT_WINDOW_ADD
New Window has been added.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
int int mutt_window_printf(struct MuttWindow *win, const char *format,...) __attribute__((__format__(__printf__
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
MuttWindowSize
Control the allocation of Window space.
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
@ MUTT_WIN_SIZE_MINIMISE
Window size depends on its children.
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...) __attribute__((__format__(__printf__
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
uint8_t WindowActionFlags
Flags for Actions waiting to be performed on a MuttWindow, e.g. WA_REFLOW.
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
void window_invalidate_all(void)
Mark all windows as in need of repaint.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
#define TAILQ_HEAD(name, type)
A set of inherited config items.
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
WindowNotifyFlags flags
Attributes of Window that changed.
Mapping between user-readable string and a constant.
struct WindowState old
Previous state of the Window.
const struct Mapping * help_data
Data for the Help Bar.
int(* repaint)(struct MuttWindow *win)
short req_cols
Number of columns required.
struct WindowState state
Current state of the Window.
struct MuttWindow * focus
Focused Window.
void * wdata
Private data.
enum MuttWindowOrientation orient
Which direction the Window will expand.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
short req_rows
Number of rows required.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
struct MuttWindowList children
Children Windows.
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
struct MuttWindow * parent
Parent Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
bool(* recursor)(struct MuttWindow *win)
TAILQ_ENTRY(MuttWindow) entries
Linked list.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
The current, or old, state of a Window.
bool visible
Window is visible.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
short row_offset
Absolute on-screen row.
short col_offset
Absolute on-screen column.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.