NeoMutt  2024-11-14-138-ge5ca67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mutt_window.c
Go to the documentation of this file.
1
30#include "config.h"
31#include <stdarg.h>
32#include <string.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "mutt_window.h"
36#include "curs_lib.h"
37#include "globals.h"
38#include "mutt_curses.h"
39#include "reflow.h"
40#include "rootwin.h"
41#ifdef USE_DEBUG_WINDOW
42#include "debug/lib.h"
43#endif
44
46static const struct Mapping WindowNames[] = {
47 // clang-format off
48 { "WT_ALL_DIALOGS", WT_ALL_DIALOGS },
49 { "WT_CONTAINER", WT_CONTAINER },
50 { "WT_CUSTOM", WT_CUSTOM },
51 { "WT_DLG_ALIAS", WT_DLG_ALIAS },
52 { "WT_DLG_ATTACHMENT", WT_DLG_ATTACHMENT },
53 { "WT_DLG_AUTOCRYPT", WT_DLG_AUTOCRYPT },
54 { "WT_DLG_BROWSER", WT_DLG_BROWSER },
55 { "WT_DLG_CERTIFICATE", WT_DLG_CERTIFICATE },
56 { "WT_DLG_COMPOSE", WT_DLG_COMPOSE },
57 { "WT_DLG_GPGME", WT_DLG_GPGME },
58 { "WT_DLG_HISTORY", WT_DLG_HISTORY },
59 { "WT_DLG_INDEX", WT_DLG_INDEX },
60 { "WT_DLG_PAGER", WT_DLG_PAGER },
61 { "WT_DLG_PATTERN", WT_DLG_PATTERN },
62 { "WT_DLG_PGP", WT_DLG_PGP },
63 { "WT_DLG_POSTPONED", WT_DLG_POSTPONED },
64 { "WT_DLG_QUERY", WT_DLG_QUERY },
65 { "WT_DLG_SMIME", WT_DLG_SMIME },
66 { "WT_HELP_BAR", WT_HELP_BAR },
67 { "WT_INDEX", WT_INDEX },
68 { "WT_MENU", WT_MENU },
69 { "WT_MESSAGE", WT_MESSAGE },
70 { "WT_PAGER", WT_PAGER },
71 { "WT_ROOT", WT_ROOT },
72 { "WT_SIDEBAR", WT_SIDEBAR },
73 { "WT_STATUS_BAR", WT_STATUS_BAR },
74 { NULL, 0 },
75 // clang-format on
76};
77
87static bool window_was_visible(struct MuttWindow *win)
88{
89 if (!win)
90 return false;
91
92 for (; win; win = win->parent)
93 {
94 if (!win->old.visible)
95 return false;
96 }
97
98 return true;
99}
100
105static void window_notify(struct MuttWindow *win)
106{
107 if (!win->notify)
108 return;
109
110 const struct WindowState *old = &win->old;
111 const struct WindowState *wstate = &win->state;
113
114 const bool was_visible = window_was_visible(win);
115 const bool is_visible = mutt_window_is_visible(win);
116 if (was_visible != is_visible)
117 flags |= is_visible ? WN_VISIBLE : WN_HIDDEN;
118
119 if ((wstate->row_offset != old->row_offset) || (wstate->col_offset != old->col_offset))
120 flags |= WN_MOVED;
121
122 if (wstate->rows > old->rows)
123 flags |= WN_TALLER;
124 else if (wstate->rows < old->rows)
125 flags |= WN_SHORTER;
126
127 if (wstate->cols > old->cols)
128 flags |= WN_WIDER;
129 else if (wstate->cols < old->cols)
130 flags |= WN_NARROWER;
131
132 if (flags == WN_NO_FLAGS)
133 return;
134
135 mutt_debug(LL_NOTIFY, "NT_WINDOW_STATE: %s, %p\n", mutt_window_win_name(win),
136 (void *) win);
137 struct EventWindow ev_w = { win, flags };
139}
140
146{
147 if (!win)
148 win = RootWindow;
149
151
152 struct MuttWindow *np = NULL;
153 TAILQ_FOREACH(np, &win->children, entries)
154 {
156 }
157 win->old = win->state;
158}
159
165void window_set_visible(struct MuttWindow *win, bool visible)
166{
167 if (!win)
168 win = RootWindow;
169
170 win->state.visible = visible;
171}
172
183 enum MuttWindowSize size, int cols, int rows)
184{
185 struct MuttWindow *win = MUTT_MEM_CALLOC(1, struct MuttWindow);
186
187 win->type = type;
188 win->orient = orient;
189 win->size = size;
190 win->req_rows = rows;
191 win->req_cols = cols;
192 win->state.visible = true;
193 win->notify = notify_new();
194 TAILQ_INIT(&win->children);
195 return win;
196}
197
202void mutt_window_free(struct MuttWindow **ptr)
203{
204 if (!ptr || !*ptr)
205 return;
206
207 struct MuttWindow *win = *ptr;
208
209 if (win->parent && (win->parent->focus == win))
210 win->parent->focus = NULL;
211
212 mutt_debug(LL_NOTIFY, "NT_WINDOW_DELETE: %s, %p\n", mutt_window_win_name(win),
213 (void *) win);
214 struct EventWindow ev_w = { win, WN_NO_FLAGS };
216
218
219 if (win->wdata_free && win->wdata)
220 win->wdata_free(win, &win->wdata); // Custom function to free private data
221
223
224 FREE(ptr);
225}
226
233{
234 mutt_window_move(win, 0, row);
236}
237
245{
246 if (!win || !stdscr)
247 return;
248
249 if ((win->state.col_offset + win->state.cols) == COLS)
250 {
251 clrtoeol();
252 }
253 else
254 {
255 int row = 0;
256 int col = 0;
257 getyx(stdscr, row, col);
258 int curcol = col;
259 while (curcol < (win->state.col_offset + win->state.cols))
260 {
261 addch(' ');
262 curcol++;
263 }
264 move(row, col);
265 }
266}
267
277void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
278{
279 int x = 0;
280 int y = 0;
281
282 getyx(stdscr, y, x);
283 if (col)
284 *col = x - win->state.col_offset;
285 if (row)
286 *row = y - win->state.row_offset;
287}
288
297int mutt_window_move(struct MuttWindow *win, int col, int row)
298{
299 return move(win->state.row_offset + row, win->state.col_offset + col);
300}
301
311int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
312{
313 return mvaddstr(win->state.row_offset + row, win->state.col_offset + col, str);
314}
315
326int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt, ...)
327{
328 int rc = mutt_window_move(win, col, row);
329 if (rc == ERR)
330 return rc;
331
332 va_list ap;
333 va_start(ap, fmt);
334 rc = vw_printw(stdscr, fmt, ap);
335 va_end(ap);
336
337 return rc;
338}
339
345{
346 if (OptNoCurses)
347 return;
348
349 if (!win)
350 win = RootWindow;
351
354
355 // Allow Windows to resize themselves based on the first reflow
358
359#ifdef USE_DEBUG_WINDOW
361#endif
362}
363
372int mutt_window_wrap_cols(int width, short wrap)
373{
374 if (wrap < 0)
375 return (width > -wrap) ? (width + wrap) : width;
376 if (wrap)
377 return (wrap < width) ? wrap : width;
378 return width;
379}
380
388int mutt_window_addch(struct MuttWindow *win, int ch)
389{
390 return addch(ch);
391}
392
401int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
402{
403 if (!str)
404 return -1;
405
406 return addnstr(str, num);
407}
408
416int mutt_window_addstr(struct MuttWindow *win, const char *str)
417{
418 if (!str)
419 return -1;
420
421 return addstr(str);
422}
423
431int mutt_window_printf(struct MuttWindow *win, const char *fmt, ...)
432{
433 va_list ap;
434 va_start(ap, fmt);
435 int rc = vw_printw(stdscr, fmt, ap);
436 va_end(ap);
437
438 return rc;
439}
440
446void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
447{
448 if (!parent || !child)
449 return;
450
451 TAILQ_INSERT_TAIL(&parent->children, child, entries);
452 child->parent = parent;
453
454 notify_set_parent(child->notify, parent->notify);
455
456 mutt_debug(LL_NOTIFY, "NT_WINDOW_NEW: %s, %p\n", mutt_window_win_name(child),
457 (void *) child);
458 struct EventWindow ev_w = { child, WN_NO_FLAGS };
459 notify_send(child->notify, NT_WINDOW, NT_WINDOW_ADD, &ev_w);
460}
461
469{
470 if (!parent || !child)
471 return NULL;
472
473 // A notification will be sent when the Window is freed
474 TAILQ_REMOVE(&parent->children, child, entries);
475 child->parent = NULL;
476
477 if (parent->focus == child)
478 parent->focus = NULL;
479
480 notify_set_parent(child->notify, NULL);
481
482 return child;
483}
484
489void mutt_winlist_free(struct MuttWindowList *head)
490{
491 if (!head)
492 return;
493
494 struct MuttWindow *np = NULL;
495 struct MuttWindow *tmp = NULL;
496 TAILQ_FOREACH_SAFE(np, head, entries, tmp)
497 {
498 TAILQ_REMOVE(head, np, entries);
500 mutt_window_free(&np);
501 }
502}
503
513{
514 if (!win)
515 return false;
516
517 for (; win; win = win->parent)
518 {
519 if (!win->state.visible)
520 return false;
521 }
522
523 return true;
524}
525
534{
535 if (!win)
536 return NULL;
537 if (win->type == type)
538 return win;
539
540 struct MuttWindow *np = NULL;
541 struct MuttWindow *match = NULL;
542 TAILQ_FOREACH(np, &win->children, entries)
543 {
544 match = window_find_child(np, type);
545 if (match)
546 return match;
547 }
548
549 return NULL;
550}
551
559{
560 for (; win; win = win->parent)
561 {
562 if (win->type == type)
563 return win;
564 }
565
566 return NULL;
567}
568
573static void window_recalc(struct MuttWindow *win)
574{
575 if (!win || !win->state.visible)
576 return;
577
578 if (win->recalc && (win->actions & WA_RECALC))
579 win->recalc(win);
580 win->actions &= ~WA_RECALC;
581
582 struct MuttWindow *np = NULL;
583 TAILQ_FOREACH(np, &win->children, entries)
584 {
585 window_recalc(np);
586 }
587}
588
593static void window_repaint(struct MuttWindow *win)
594{
595 if (!win || !win->state.visible)
596 return;
597
598 if (win->repaint && (win->actions & WA_REPAINT))
599 win->repaint(win);
600 win->actions &= ~WA_REPAINT;
601
602 struct MuttWindow *np = NULL;
603 TAILQ_FOREACH(np, &win->children, entries)
604 {
605 window_repaint(np);
606 }
607}
608
615static void window_recursor(void)
616{
617 // Give the focussed window an opportunity to set the cursor position
618 struct MuttWindow *win = window_get_focus();
619 if (!win)
620 return;
621
622 if (win->recursor && win->recursor(win))
623 return;
624
626}
627
634void window_redraw(struct MuttWindow *win)
635{
636 if (!win)
637 win = RootWindow;
638
639 window_reflow(win);
641
642 window_recalc(win);
643 window_repaint(win);
645
646 mutt_refresh();
647}
648
654bool window_is_focused(const struct MuttWindow *win)
655{
656 if (!win)
657 return false;
658
659 struct MuttWindow *win_focus = window_get_focus();
660
661 return (win_focus == win);
662}
663
669{
670 struct MuttWindow *win = RootWindow;
671
672 while (win && win->focus)
673 win = win->focus;
674
675 return win;
676}
677
685{
686 if (!win)
687 return NULL;
688
689 struct MuttWindow *old_focus = window_get_focus();
690
691 struct MuttWindow *parent = win->parent;
692 struct MuttWindow *child = win;
693
694 // Set the chain of focus, all the way to the root
695 for (; parent; child = parent, parent = parent->parent)
696 parent->focus = child;
697
698 win->focus = NULL;
699
700 if (win == old_focus)
701 return NULL;
702
703 mutt_debug(LL_NOTIFY, "NT_WINDOW_FOCUS: %s, %p\n", mutt_window_win_name(win),
704 (void *) win);
705 struct EventWindow ev_w = { win, WN_NO_FLAGS };
707#ifdef USE_DEBUG_WINDOW
709#endif
710
711 return old_focus;
712}
713
721{
723 return;
724
725 for (int i = 0; i < win->state.rows; i++)
727}
728
735const char *mutt_window_win_name(const struct MuttWindow *win)
736{
737 if (!win)
738 return "UNKNOWN";
739
740 const char *name = mutt_map_get_name(win->type, WindowNames);
741 if (name)
742 return name;
743 return "UNKNOWN";
744}
745
750static void window_invalidate(struct MuttWindow *win)
751{
752 if (!win)
753 return;
754
756
757 struct MuttWindow *np = NULL;
758 TAILQ_FOREACH(np, &win->children, entries)
759 {
761 }
762}
763
768{
770 clearok(stdscr, true);
771 keypad(stdscr, true);
772}
773
784bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
785{
786 const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
787
788 struct MuttWindow *win = TAILQ_FIRST(&panel->children);
789
790 if ((c_status_on_top && (win->type == WT_STATUS_BAR)) ||
791 (!c_status_on_top && (win->type != WT_STATUS_BAR)))
792 {
793 return false;
794 }
795
796 if (c_status_on_top)
797 {
798 win = TAILQ_LAST(&panel->children, MuttWindowList);
799 TAILQ_REMOVE(&panel->children, win, entries);
800 TAILQ_INSERT_HEAD(&panel->children, win, entries);
801 }
802 else
803 {
804 TAILQ_REMOVE(&panel->children, win, entries);
805 TAILQ_INSERT_TAIL(&panel->children, win, entries);
806 }
807
808 mutt_window_reflow(panel);
810 return true;
811}
812
820bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1,
821 struct MuttWindow *win2)
822{
823 if (!parent || !win1 || !win2)
824 return false;
825
826 // ensure both windows are children of the parent
827 if (win1->parent != parent || win2->parent != parent)
828 return false;
829
830 struct MuttWindow *win1_next = TAILQ_NEXT(win1, entries);
831 if (win1_next == win2)
832 {
833 // win1 is directly in front of win2, move it behind
834 TAILQ_REMOVE(&parent->children, win1, entries);
835 TAILQ_INSERT_AFTER(&parent->children, win2, win1, entries);
836 return true;
837 }
838
839 struct MuttWindow *win2_next = TAILQ_NEXT(win2, entries);
840 if (win2_next == win1)
841 {
842 // win2 is directly in front of win1, move it behind
843 TAILQ_REMOVE(&parent->children, win2, entries);
844 TAILQ_INSERT_AFTER(&parent->children, win1, win2, entries);
845 return true;
846 }
847
848 TAILQ_REMOVE(&parent->children, win1, entries);
849 TAILQ_REMOVE(&parent->children, win2, entries);
850
851 if (win1_next)
852 TAILQ_INSERT_BEFORE(win1_next, win2, entries);
853 else
854 TAILQ_INSERT_TAIL(&parent->children, win2, entries);
855
856 if (win2_next)
857 TAILQ_INSERT_BEFORE(win2_next, win1, entries);
858 else
859 TAILQ_INSERT_TAIL(&parent->children, win1, entries);
860
861 return true;
862}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
Convenience wrapper for the config headers.
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:78
GUI miscellaneous curses (window drawing) routines.
Convenience wrapper for the debug headers.
void debug_win_dump(void)
Definition: window.c:96
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: globals.c:69
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_NOTIFY
Log of notifications.
Definition: logging2.h:48
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
#define FREE(x)
Definition: memory.h:55
#define MUTT_MEM_CALLOC(n, type)
Definition: memory.h:40
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:62
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:95
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:75
enum MuttCursorState mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:94
Define wrapper functions around Curses.
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
Definition: mutt_curses.h:65
static bool is_visible(struct Email *e)
Is the message visible?
Definition: mutt_thread.c:123
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:720
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:512
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:344
static void window_recursor(void)
Recursor the focussed Window.
Definition: mutt_window.c:615
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:558
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
Definition: mutt_window.c:145
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:784
static void window_notify(struct MuttWindow *win)
Notify observers of changes to a Window.
Definition: mutt_window.c:105
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:654
static const struct Mapping WindowNames[]
Lookups for Window Names.
Definition: mutt_window.c:46
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:202
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:446
const char * mutt_window_win_name(const struct MuttWindow *win)
Get the name of a Window.
Definition: mutt_window.c:735
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:431
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:182
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:668
static void window_invalidate(struct MuttWindow *win)
Mark a window as in need of repaint.
Definition: mutt_window.c:750
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:297
bool mutt_window_swap(struct MuttWindow *parent, struct MuttWindow *win1, struct MuttWindow *win2)
Swap the position of two windows.
Definition: mutt_window.c:820
static void window_recalc(struct MuttWindow *win)
Recalculate a tree of Windows.
Definition: mutt_window.c:573
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:684
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
Definition: mutt_window.c:468
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
static bool window_was_visible(struct MuttWindow *win)
Was the Window visible?
Definition: mutt_window.c:87
void mutt_window_get_coords(struct MuttWindow *win, int *col, int *row)
Get the cursor position in the Window.
Definition: mutt_window.c:277
int mutt_window_wrap_cols(int width, short wrap)
Calculate the wrap column for a given screen width.
Definition: mutt_window.c:372
void mutt_winlist_free(struct MuttWindowList *head)
Free a tree of Windows.
Definition: mutt_window.c:489
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
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.
Definition: mutt_window.c:311
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:232
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
Definition: mutt_window.c:416
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:401
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:244
static void window_repaint(struct MuttWindow *win)
Repaint a tree of Windows.
Definition: mutt_window.c:593
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
Definition: mutt_window.c:326
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
Definition: mutt_window.c:388
Window management.
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
#define WN_MOVED
Window moved.
Definition: mutt_window.h:214
uint8_t WindowNotifyFlags
Flags for Changes to a MuttWindow, e.g. WN_TALLER.
Definition: mutt_window.h:208
#define WN_WIDER
Window became wider.
Definition: mutt_window.h:212
WindowType
Type of Window.
Definition: mutt_window.h:71
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ WT_ROOT
Parent of All Windows.
Definition: mutt_window.h:73
@ WT_DLG_ALIAS
Alias Dialog, dlg_alias()
Definition: mutt_window.h:78
@ WT_ALL_DIALOGS
Container for All Dialogs (nested Windows)
Definition: mutt_window.h:75
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
Definition: mutt_window.h:81
@ WT_MESSAGE
Window for messages/errors.
Definition: mutt_window.h:99
@ WT_DLG_SMIME
Smime Dialog, dlg_smime()
Definition: mutt_window.h:92
@ WT_DLG_QUERY
Query Dialog, dlg_query()
Definition: mutt_window.h:91
@ WT_DLG_HISTORY
History Dialog, dlg_history()
Definition: mutt_window.h:86
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
Definition: mutt_window.h:89
@ WT_CONTAINER
Invisible shaping container Window.
Definition: mutt_window.h:74
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_certificate()
Definition: mutt_window.h:82
@ WT_DLG_COMPOSE
Compose Dialog, dlg_compose()
Definition: mutt_window.h:83
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition: mutt_window.h:87
@ WT_PAGER
A panel containing the Pager Window.
Definition: mutt_window.h:100
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
Definition: mutt_window.h:84
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:96
@ WT_DLG_POSTPONED
Postponed Dialog, dlg_postponed()
Definition: mutt_window.h:90
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ WT_DLG_ATTACHMENT
Attachment Dialog, dlg_attachment()
Definition: mutt_window.h:79
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
@ WT_DLG_PAGER
Pager Dialog, dlg_pager()
Definition: mutt_window.h:85
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_autocrypt()
Definition: mutt_window.h:80
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
@ WT_DLG_PATTERN
Pattern Dialog, dlg_pattern()
Definition: mutt_window.h:88
MuttWindowOrientation
Which way does the Window expand?
Definition: mutt_window.h:38
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:230
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:232
@ NT_WINDOW_ADD
New Window has been added.
Definition: mutt_window.h:228
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:215
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:216
#define WN_NO_FLAGS
No flags are set.
Definition: mutt_window.h:209
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
#define WN_TALLER
Window became taller.
Definition: mutt_window.h:210
MuttWindowSize
Control the allocation of Window space.
Definition: mutt_window.h:47
#define WN_NARROWER
Window became narrower.
Definition: mutt_window.h:213
#define WN_SHORTER
Window became shorter.
Definition: mutt_window.h:211
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:743
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:753
#define TAILQ_INIT(head)
Definition: queue.h:783
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:827
#define TAILQ_FIRST(head)
Definition: queue.h:741
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:862
#define TAILQ_NEXT(elm, field)
Definition: queue.h:850
#define TAILQ_INSERT_BEFORE(listelm, elm, field)
Definition: queue.h:804
#define TAILQ_LAST(head, headname)
Definition: queue.h:837
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:814
#define TAILQ_INSERT_AFTER(head, listelm, elm, field)
Definition: queue.h:789
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:220
Window management.
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:106
Root Window.
A set of inherited config items.
Definition: subset.h:47
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:241
Mapping between user-readable string and a constant.
Definition: mapping.h:33
struct WindowState old
Previous state of the Window.
Definition: mutt_window.h:128
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:187
short req_cols
Number of columns required.
Definition: mutt_window.h:124
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
void * wdata
Private data.
Definition: mutt_window.h:145
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:130
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
short req_rows
Number of rows required.
Definition: mutt_window.h:125
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:173
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Definition: mutt_window.h:159
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
bool(* recursor)(struct MuttWindow *win)
Definition: mutt_window.h:205
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
The current, or old, state of a Window.
Definition: mutt_window.h:59
bool visible
Window is visible.
Definition: mutt_window.h:60
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
short row_offset
Absolute on-screen row.
Definition: mutt_window.h:64
short col_offset
Absolute on-screen column.
Definition: mutt_window.h:63
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:62