NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
msgcont.c File Reference

Message Container. More...

#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include "mutt/lib.h"
#include "lib.h"
+ Include dependency graph for msgcont.c:

Go to the source code of this file.

Functions

struct MuttWindowmsgcont_new (void)
 Create a new Message Container. More...
 
struct MuttWindowmsgcont_pop_window (void)
 Remove the last Window from the Container Stack. More...
 
void msgcont_push_window (struct MuttWindow *win)
 Add a window to the Container Stack. More...
 

Variables

static struct MuttWindowMessageContainer = NULL
 Window acting as a stack for the message windows. More...
 

Detailed Description

Message Container.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file msgcont.c.

Function Documentation

◆ msgcont_new()

struct MuttWindow * msgcont_new ( void  )

Create a new Message Container.

Return values
ptrNew Container Window

Definition at line 45 of file msgcont.c.

46{
49 return MessageContainer;
50}
static struct MuttWindow * MessageContainer
Window acting as a stack for the message windows.
Definition: msgcont.c:39
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:181
@ 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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgcont_pop_window()

struct MuttWindow * msgcont_pop_window ( void  )

Remove the last Window from the Container Stack.

Return values
ptrWindow removed from the stack

Definition at line 56 of file msgcont.c.

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}
void debug_win_dump(void)
Definition: window.c:95
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:604
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:164
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
#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
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgcont_push_window()

void msgcont_push_window ( struct MuttWindow win)

Add a window to the Container Stack.

Parameters
winWindow to add

Definition at line 87 of file msgcont.c.

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}
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:439
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ MessageContainer

struct MuttWindow* MessageContainer = NULL
static

Window acting as a stack for the message windows.

Definition at line 39 of file msgcont.c.