NeoMutt  2024-04-25-89-g194907
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
msgcont.c File Reference

Message Container. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "msgcont.h"
#include "mutt_window.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.
 
struct MuttWindowmsgcont_pop_window (void)
 Remove the last Window from the Container Stack.
 
void msgcont_push_window (struct MuttWindow *win)
 Add a window to the Container Stack.
 
struct MuttWindowmsgcont_get_msgwin (void)
 Get the Message Window.
 

Variables

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

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 46 of file msgcont.c.

47{
50 return MessageContainer;
51}
struct MuttWindow * MessageContainer
Window acting as a stack for the message windows.
Definition: msgcont.c:40
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
@ 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 57 of file msgcont.c.

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}
void debug_win_dump(void)
Definition: window.c:96
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 window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
#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 93 of file msgcont.c.

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

◆ msgcont_get_msgwin()

struct MuttWindow * msgcont_get_msgwin ( void  )

Get the Message Window.

Return values
ptrMessage Window

The Message Window is the first child of the MessageContainer and will have type WT_MESSAGE.

Definition at line 117 of file msgcont.c.

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}
@ WT_MESSAGE
Window for messages/errors.
Definition: mutt_window.h:99
#define TAILQ_FIRST(head)
Definition: queue.h:723
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
+ Here is the caller graph for this function:

Variable Documentation

◆ MessageContainer

struct MuttWindow* MessageContainer = NULL

Window acting as a stack for the message windows.

Definition at line 40 of file msgcont.c.