NeoMutt  2023-03-22
Teaching an old dog new tricks
DOXYGEN
msgwin.h File Reference

Message Window. More...

#include <stdio.h>
#include "color/lib.h"
+ Include dependency graph for msgwin.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void msgwin_clear_text (void)
 Clear the text in the Message Window. More...
 
struct MuttWindowmsgwin_new (void)
 Create the Message Window. More...
 
const char * msgwin_get_text (void)
 Get the text from the Message Window. More...
 
size_t msgwin_get_width (void)
 Get the width of the Message Window. More...
 
struct MuttWindowmsgwin_get_window (void)
 Get the Message Window pointer. More...
 
void msgwin_set_height (short height)
 Resize the Message Window. More...
 
void msgwin_set_text (enum ColorId cid, const char *text)
 Set the text for the Message Window. More...
 

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

Function Documentation

◆ msgwin_clear_text()

void msgwin_clear_text ( void  )

Clear the text in the Message Window.

Definition at line 249 of file msgwin.c.

250{
252}
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:57
void msgwin_set_text(enum ColorId cid, const char *text)
Set the text for the Message Window.
Definition: msgwin.c:233
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_new()

struct MuttWindow * msgwin_new ( void  )

Create the Message Window.

Return values
ptrNew Window

Definition at line 197 of file msgwin.c.

198{
205
207
208 return MessageWindow;
209}
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: msgwin.c:142
static int msgwin_recalc(struct MuttWindow *win)
Recalculate the display of the Message Window - Implements MuttWindow::recalc() -.
Definition: msgwin.c:102
static int msgwin_repaint(struct MuttWindow *win)
Redraw the Message Window - Implements MuttWindow::repaint() -.
Definition: msgwin.c:115
static void msgwin_wdata_free(struct MuttWindow *win, void **ptr)
Free the private data attached to the Message Window - Implements MuttWindow::wdata_free() -.
Definition: msgwin.c:171
static struct MuttWindow * MessageWindow
Message Window for messages, warnings, errors etc.
Definition: msgwin.c:88
static struct MsgWinPrivateData * msgwin_wdata_new(void)
Create new private data for the Message Window.
Definition: msgwin.c:184
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:189
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
@ WT_MESSAGE
Window for messages/errors and command entry.
Definition: mutt_window.h:99
@ 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_FIXED
Window has a fixed size.
Definition: mutt_window.h:47
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:181
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:170
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Definition: mutt_window.h:159
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_get_text()

const char * msgwin_get_text ( void  )

Get the text from the Message Window.

Note
Do not free the returned string

Definition at line 216 of file msgwin.c.

217{
218 if (!MessageWindow)
219 return NULL;
220
221 struct MsgWinPrivateData *priv = MessageWindow->wdata;
222
223 return priv->text;
224}
Private data for the Message Window.
Definition: msgwin.c:94
char * text
Cached display string.
Definition: msgwin.c:96
+ Here is the caller graph for this function:

◆ msgwin_get_width()

size_t msgwin_get_width ( void  )

Get the width of the Message Window.

Return values
numWidth of Message Window

Definition at line 269 of file msgwin.c.

270{
271 if (!MessageWindow)
272 return 0;
273
274 return MessageWindow->state.cols;
275}
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
+ Here is the caller graph for this function:

◆ msgwin_get_window()

struct MuttWindow * msgwin_get_window ( void  )

Get the Message Window pointer.

Return values
ptrMessage Window

Allow some users direct access to the Message Window.

Definition at line 260 of file msgwin.c.

261{
262 return MessageWindow;
263}
+ Here is the caller graph for this function:

◆ msgwin_set_height()

void msgwin_set_height ( short  height)

Resize the Message Window.

Parameters
heightNumber of rows required

Resize the other Windows to allow a multi-line message to be displayed.

Definition at line 283 of file msgwin.c.

284{
285 if (!MessageWindow)
286 return;
287
288 if (height < 1)
289 height = 1;
290 else if (height > 3)
291 height = 3;
292
293 struct MuttWindow *win_cont = MessageWindow->parent;
294
295 win_cont->req_rows = height;
296 mutt_window_reflow(win_cont->parent);
297}
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:339
short req_rows
Number of rows required.
Definition: mutt_window.h:125
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_set_text()

void msgwin_set_text ( enum ColorId  cid,
const char *  text 
)

Set the text for the Message Window.

Parameters
cidColour Id, e.g. MT_COLOR_MESSAGE
textText to set
Note
The text string will be copied

Definition at line 233 of file msgwin.c.

234{
235 if (!MessageWindow)
236 return;
237
238 struct MsgWinPrivateData *priv = MessageWindow->wdata;
239
240 priv->cid = cid;
241 mutt_str_replace(&priv->text, text);
242
244}
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:326
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
enum ColorId cid
Colour for the text, e.g. MT_COLOR_MESSAGE.
Definition: msgwin.c:95
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: