NeoMutt  2023-05-17-16-g61469c
Teaching an old dog new tricks
DOXYGEN
msgcont.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include <stdbool.h>
32#include "mutt/lib.h"
33#include "lib.h"
34#ifdef USE_DEBUG_WINDOW
35#include "debug/lib.h"
36#endif
37
39static struct MuttWindow *MessageContainer = NULL;
40
46{
49 return MessageContainer;
50}
51
57{
59 return NULL;
60
61 struct MuttWindow *win_pop = TAILQ_LAST(&MessageContainer->children, MuttWindowList);
62 // Don't pop the last entry
63 if (!TAILQ_PREV(win_pop, MuttWindowList, entries))
64 return NULL;
65
66 TAILQ_REMOVE(&MessageContainer->children, win_pop, entries);
67
68 // Make the top of the stack visible
69 struct MuttWindow *win_top = TAILQ_PREV(win_pop, MuttWindowList, entries);
70 if (win_top)
71 {
72 window_set_visible(win_top, true);
73 win_top->actions |= WA_RECALC;
74 }
75
76 window_redraw(NULL);
77#ifdef USE_DEBUG_WINDOW
79#endif
80 return win_pop;
81}
82
88{
89 if (!MessageContainer || !win)
90 return;
91
92 // Hide the current top window
93 struct MuttWindow *win_top = TAILQ_LAST(&MessageContainer->children, MuttWindowList);
94 window_set_visible(win_top, false);
95
97 win->actions |= WA_RECALC;
98 window_redraw(NULL);
99#ifdef USE_DEBUG_WINDOW
101#endif
102}
Convenience wrapper for the debug headers.
void debug_win_dump(void)
Definition: window.c:78
struct MuttWindow * msgcont_new(void)
Create a new Message Container.
Definition: msgcont.c:45
static struct MuttWindow * MessageContainer
Window acting as a stack for the message windows.
Definition: msgcont.c:39
void msgcont_push_window(struct MuttWindow *win)
Add a window to the Container Stack.
Definition: msgcont.c:87
struct MuttWindow * msgcont_pop_window(void)
Remove the last Window from the Container Stack.
Definition: msgcont.c:56
Convenience wrapper for the library headers.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:605
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:440
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:180
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:163
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_CONTAINER
Invisible shaping container Window.
Definition: mutt_window.h:73
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition: mutt_window.h:38
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:52
@ MUTT_WIN_SIZE_MINIMISE
Window size depends on its children.
Definition: mutt_window.h:49
#define TAILQ_PREV(elm, headname, field)
Definition: queue.h:834
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
#define TAILQ_LAST(head, headname)
Definition: queue.h:819
Key value store.
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132