NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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 "msgcont.h"
34#include "mutt_window.h"
35#ifdef USE_DEBUG_WINDOW
36#include "debug/lib.h"
37#endif
38
41
47{
50 return MessageContainer;
51}
52
58{
60 return NULL;
61
62 struct MuttWindow *win_pop = TAILQ_LAST(&MessageContainer->children, MuttWindowList);
63 // Don't pop the last entry
64 if (!TAILQ_PREV(win_pop, MuttWindowList, entries))
65 return NULL;
66
67 // Hide the old window
68 window_set_visible(win_pop, false);
69
70 // Make the top of the stack visible
71 struct MuttWindow *win_top = TAILQ_PREV(win_pop, MuttWindowList, entries);
72
73 TAILQ_REMOVE(&MessageContainer->children, win_pop, entries);
74
75 if (win_top)
76 {
77 window_set_visible(win_top, true);
78 win_top->actions |= WA_RECALC;
79 }
80
82 window_redraw(NULL);
83#ifdef USE_DEBUG_WINDOW
85#endif
86 return win_pop;
87}
88
94{
95 if (!MessageContainer || !win)
96 return;
97
98 // Hide the current top window
99 struct MuttWindow *win_top = TAILQ_LAST(&MessageContainer->children, MuttWindowList);
100 window_set_visible(win_top, false);
101
103 mutt_window_reflow(NULL);
104 window_redraw(NULL);
105#ifdef USE_DEBUG_WINDOW
107#endif
108}
109
118{
119 if (!MessageContainer)
120 return NULL;
121
123 if (!win)
124 return NULL;
125
126 if (win->type != WT_MESSAGE)
127 return NULL;
128
129 return win;
130}
Convenience wrapper for the debug headers.
void debug_win_dump(void)
Definition: window.c:96
struct MuttWindow * msgcont_new(void)
Create a new Message Container.
Definition: msgcont.c:46
struct MuttWindow * MessageContainer
Window acting as a stack for the message windows.
Definition: msgcont.c:40
void msgcont_push_window(struct MuttWindow *win)
Add a window to the Container Stack.
Definition: msgcont.c:93
struct MuttWindow * msgcont_pop_window(void)
Remove the last Window from the Container Stack.
Definition: msgcont.c:57
struct MuttWindow * msgcont_get_msgwin(void)
Get the Message Window.
Definition: msgcont.c:117
Message Window.
Convenience wrapper for the library headers.
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
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:446
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
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
Window management.
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_MESSAGE
Window for messages/errors.
Definition: mutt_window.h:99
@ 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_FIRST(head)
Definition: queue.h:723
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
#define TAILQ_LAST(head, headname)
Definition: queue.h:819
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
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144