NeoMutt  2025-12-11-872-g385a04
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
msgcont.h File Reference

Message Window. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct MuttWindowmsgcont_get_msgwin (void)
 Get the Message Window.
 
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.
 

Detailed Description

Message Window.

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.h.

Function Documentation

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

141{
143 if (!mod_data || !mod_data->message_container)
144 return NULL;
145
146 struct MuttWindow **wp = ARRAY_FIRST(&mod_data->message_container->children);
147 if (!wp)
148 return NULL;
149
150 struct MuttWindow *win = *wp;
151 if (win->type != WT_MESSAGE)
152 return NULL;
153
154 return win;
155}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition array.h:136
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
@ WT_MESSAGE
Window for messages/errors.
Definition mutt_window.h:98
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
Gui private Module data.
Definition module_data.h:32
struct MuttWindow * message_container
Message Container Window.
Definition module_data.h:40
struct MuttWindowArray children
Children Windows.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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{
51 if (mod_data)
52 mod_data->message_container = win;
53 return win;
54}
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
@ 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_MAXIMISE
Window wants as much space as possible.
Definition mutt_window.h:48
+ 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 60 of file msgcont.c.

61{
63 if (!mod_data || !mod_data->message_container)
64 return NULL;
65
66 struct MuttWindow *mc = mod_data->message_container;
67
68 struct MuttWindow **wp_pop = ARRAY_LAST(&mc->children);
69 if (!wp_pop)
70 return NULL;
71
72 struct MuttWindow *win_pop = *wp_pop;
73
74 // Don't pop the last entry (check if there's a previous one)
75 if (ARRAY_SIZE(&mc->children) <= 1)
76 return NULL;
77
78 // Hide the old window
79 window_set_visible(win_pop, false);
80
81 // Get the window that will become top of stack
82 struct MuttWindow **wp_top = ARRAY_GET(&mc->children, ARRAY_SIZE(&mc->children) - 2);
83 struct MuttWindow *win_top = wp_top ? *wp_top : NULL;
84
85 ARRAY_REMOVE(&mc->children, wp_pop);
86
87 if (win_top)
88 {
89 window_set_visible(win_top, true);
90 win_top->actions |= WA_RECALC;
91
92 if (mod_data->bottom_bar)
93 mod_data->bottom_bar->req_rows = win_top->req_rows;
94 }
95
97 window_redraw(NULL);
98#ifdef USE_DEBUG_WINDOW
100#endif
101 return win_pop;
102}
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_LAST(head)
Convenience method to get the last element.
Definition array.h:145
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
void debug_win_dump(void)
Dump all windows to debug output.
Definition window.c:116
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
@ WA_RECALC
Recalculate the contents of the Window.
struct MuttWindow * bottom_bar
Bottom Bar Container Window.
Definition module_data.h:39
short req_rows
Number of rows required.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
+ 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 108 of file msgcont.c.

109{
111 if (!mod_data || !mod_data->message_container || !win)
112 return;
113
114 struct MuttWindow *mc = mod_data->message_container;
115
116 // Hide the current top window
117 struct MuttWindow **wp_top = ARRAY_LAST(&mc->children);
118 if (wp_top)
119 window_set_visible(*wp_top, false);
120
121 mutt_window_add_child(mc, win);
122
123 if (mod_data->bottom_bar)
124 mod_data->bottom_bar->req_rows = win->req_rows;
125
126 mutt_window_reflow(NULL);
127 window_redraw(NULL);
128#ifdef USE_DEBUG_WINDOW
130#endif
131}
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
+ Here is the call graph for this function:
+ Here is the caller graph for this function: