NeoMutt  2019-12-07-60-g0cfa53
Teaching an old dog new tricks
Go to the documentation of this file.
26 #include "config.h"
32 {
35 };
41 {
45 };
53 {
54  bool visible;
55  short rows;
56  short cols;
57  short row_offset;
58  short col_offset;
59 };
65 {
77 };
79 TAILQ_HEAD(MuttWindowList, MuttWindow);
86 struct MuttWindow
87 {
88  short req_rows;
89  short req_cols;
91  struct WindowState state;
92  struct WindowState old;
94  enum MuttWindowOrientation orient;
95  enum MuttWindowSize size;
97  TAILQ_ENTRY(MuttWindow) entries;
98  struct MuttWindow *parent;
99  struct MuttWindowList children;
101  enum WindowType type;
102  void *wdata;
103  void (*free_wdata)(struct MuttWindow *win, void **);
104 };
106 extern struct MuttWindow *MuttDialogWindow;
107 extern struct MuttWindow *MuttHelpWindow;
108 extern struct MuttWindow *MuttMessageWindow;
110 // Functions that deal with the Window
111 void mutt_window_add_child (struct MuttWindow *parent, struct MuttWindow *child);
112 void mutt_window_copy_size (const struct MuttWindow *win_src, struct MuttWindow *win_dst);
113 void mutt_window_free (struct MuttWindow **ptr);
114 void mutt_window_free_all (void);
115 void mutt_window_get_coords (struct MuttWindow *win, int *col, int *row);
116 void mutt_window_init (void);
118 void mutt_window_reflow (struct MuttWindow *win);
119 void mutt_window_reflow_message_rows(int mw_rows);
120 void mutt_window_set_root (int rows, int cols);
121 int mutt_window_wrap_cols (int width, short wrap);
123 // Functions for drawing on the Window
124 int mutt_window_addch (int ch);
125 int mutt_window_addnstr (const char *str, int num);
126 int mutt_window_addstr (const char *str);
127 void mutt_window_clearline(struct MuttWindow *win, int row);
128 void mutt_window_clrtobot (void);
129 void mutt_window_clrtoeol (struct MuttWindow *win);
130 int mutt_window_move (struct MuttWindow *win, int row, int col);
131 void mutt_window_move_abs (int row, int col);
132 int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str);
133 int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char *fmt, ...);
134 int mutt_window_printf (const char *format, ...);
135 bool mutt_window_is_visible(struct MuttWindow *win);
137 void mutt_winlist_free (struct MuttWindowList *head);
138 struct MuttWindow *mutt_window_find(struct MuttWindow *root, enum WindowType type);
139 struct MuttWindow *mutt_window_dialog(struct MuttWindow *win);
141 void mutt_winlist_free (struct MuttWindowList *head);
142 void dialog_pop(void);
143 void dialog_push(struct MuttWindow *dlg);
145 #endif /* MUTT_MUTT_WINDOW_H */
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
Definition: mutt_window.c:221
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:537
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:94
Pager Bar containing status info about the Pager.
Definition: mutt_window.h:75
Dialog (nested Windows) displayed to the user.
Definition: mutt_window.h:68
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:135
Window for messages/errors and command entry.
Definition: mutt_window.h:71
Window uses all available vertical space.
Definition: mutt_window.h:33
void mutt_window_move_abs(int row, int col)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:445
void mutt_window_reflow_message_rows(int mw_rows)
Resize the Message Window.
Definition: mutt_window.c:365
int mutt_window_printf(const char *format,...)
Write a formatted string to a Window.
Definition: mutt_window.c:456
Type of Window.
Definition: mutt_window.h:64
Which way does the Window expand?
Definition: mutt_window.h:31
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:471
Invisible shaping container Window.
Definition: mutt_window.h:69
Parent of All Windows.
Definition: mutt_window.h:66
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:75
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:575
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: mutt_window.c:603
A division of the screen.
Definition: mutt_window.h:86
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:58
TAILQ_HEAD(MuttWindowList, MuttWindow)
An Index Window containing a selection list.
Definition: mutt_window.h:72
int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
Definition: mutt_window.c:312
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
Window has a fixed size.
Definition: mutt_window.h:42
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:76
Window size depends on its children.
Definition: mutt_window.h:44
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
bool visible
Window is visible.
Definition: mutt_window.h:54
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:57
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:55
void mutt_window_init(void)
Create the default Windows.
Definition: mutt_window.c:238
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:70
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:346
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:95
struct MuttWindow * mutt_window_dialog(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: mutt_window.c:558
Container for All Dialogs (nested Windows)
Definition: mutt_window.h:67
struct MuttWindow * mutt_window_new(enum MuttWindowOrientation orient, enum MuttWindowSize size, int rows, int cols)
Create a new Window.
Definition: mutt_window.c:57
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:410
The current, or old, state of a Window.
Definition: mutt_window.h:52
void mutt_window_set_root(int rows, int cols)
Set the dimensions of the Root Window.
Definition: mutt_window.c:504
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
#define TAILQ_ENTRY(type)
Definition: queue.h:633
Window containing paged free-form text.
Definition: mutt_window.h:74
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
Definition: mutt_window.c:484
struct MuttWindow * MuttHelpWindow
Help Window.
Definition: mutt_window.c:46
Window uses all available horizontal space.
Definition: mutt_window.h:34
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:98
Control the allocation of Window space.
Definition: mutt_window.h:40
void dialog_pop(void)
Hide a Window from the user.
Definition: mutt_window.c:623
void mutt_window_free_all(void)
Free all the default Windows.
Definition: mutt_window.c:202
short req_rows
Number of rows required.
Definition: mutt_window.h:88
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
void mutt_window_copy_size(const struct MuttWindow *win_src, struct MuttWindow *win_dst)
Copy the size of one Window to another.
Definition: mutt_window.c:331
Window wants as much space as possible.
Definition: mutt_window.h:43
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:113
void * wdata
Private data.
Definition: mutt_window.h:102
Index Bar containing status info about the Index.
Definition: mutt_window.h:73
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:101
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
Definition: mutt_window.c:383
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:124
struct MuttWindow * MuttDialogWindow
Parent of all Dialogs.
Definition: mutt_window.c:45
short req_cols
Number of columns required.
Definition: mutt_window.h:89