NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
msgwin.h File Reference

Message Window. More...

#include <stdio.h>
#include "color.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...
 
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 color, 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.

Note
Changes will appear on screen immediately

Definition at line 242 of file msgwin.c.

243 {
245 }
Plain text.
Definition: color.h:58
void msgwin_set_text(enum ColorId color, const char *text)
Set the text for the Message Window.
Definition: msgwin.c:223
+ 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 {
199  struct MuttWindow *win =
202 
203  win->wdata = msgwin_wdata_new();
205  win->recalc = msgwin_recalc;
206  win->repaint = msgwin_repaint;
207 
209 
210  MessageWindow = win;
211  return win;
212 }
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Definition: mutt_window.h:160
Window for messages/errors and command entry.
Definition: mutt_window.h:99
Window uses all available vertical space.
Definition: mutt_window.h:38
static struct MsgWinPrivateData * msgwin_wdata_new(void)
Create new private data for the Message Window.
Definition: msgwin.c:183
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
static int msgwin_recalc(struct MuttWindow *win)
Recalculate the display of the Message Window - Implements MuttWindow::recalc() -.
Definition: msgwin.c:104
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
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
Window has a fixed size.
Definition: mutt_window.h:47
static int msgwin_repaint(struct MuttWindow *win)
Redraw the Message Window - Implements MuttWindow::repaint() -.
Definition: msgwin.c:117
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:52
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:170
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:90
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t.
Definition: msgwin.c:143
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:182
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:171
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
void * wdata
Private data.
Definition: mutt_window.h:145
+ Here is the call graph for this function:
+ 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 262 of file msgwin.c.

263 {
264  if (!MessageWindow)
265  return 0;
266 
267  return MessageWindow->state.cols;
268 }
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:90
+ 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 253 of file msgwin.c.

254 {
255  return MessageWindow;
256 }
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:90
+ 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 276 of file msgwin.c.

277 {
278  if (!MessageWindow)
279  return;
280 
281  if (height < 1)
282  height = 1;
283  else if (height > 3)
284  height = 3;
285 
286  MessageWindow->req_rows = height;
288 }
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:90
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:361
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
short req_rows
Number of rows required.
Definition: mutt_window.h:125
+ 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  color,
const char *  text 
)

Set the text for the Message Window.

Parameters
colorColour, e.g. MT_COLOR_MESSAGE
textText to set
Note
Changes will appear on screen immediately
The text string will be copied

Definition at line 223 of file msgwin.c.

224 {
225  if (!MessageWindow)
226  return;
227 
228  struct MsgWinPrivateData *priv = MessageWindow->wdata;
229 
230  priv->color = color;
231  mutt_str_replace(&priv->text, text);
232 
235 }
enum ColorId color
Colour for the text, e.g. MT_COLOR_MESSAGE.
Definition: msgwin.c:97
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:632
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
Private data for the Message Window.
Definition: msgwin.c:95
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:90
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:446
char * text
Cached display string.
Definition: msgwin.c:98
void * wdata
Private data.
Definition: mutt_window.h:145
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function: