NeoMutt  2025-09-05-43-g177ed6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
sbar.c File Reference

Simple Bar (status) More...

#include "config.h"
#include "mutt/lib.h"
#include "sbar.h"
#include "color/lib.h"
#include "curs_lib.h"
#include "mutt_curses.h"
#include "mutt_window.h"
+ Include dependency graph for sbar.c:

Go to the source code of this file.

Data Structures

struct  SBarPrivateData
 Private data for the Simple Bar. More...
 

Functions

static int sbar_recalc (struct MuttWindow *win)
 Recalculate the Window data - Implements MuttWindow::recalc() -.
 
static int sbar_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
static void sbar_wdata_free (struct MuttWindow *win, void **ptr)
 Free the private data of the Simple Bar - Implements MuttWindow::wdata_free() -.
 
static struct SBarPrivateDatasbar_data_new (void)
 Create the private data for the Simple Bar.
 
struct MuttWindowsbar_new (void)
 Add the Simple Bar (status)
 
void sbar_set_title (struct MuttWindow *win, const char *title)
 Set the title for the Simple Bar.
 

Detailed Description

Simple Bar (status)

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 sbar.c.

Function Documentation

◆ sbar_data_new()

static struct SBarPrivateData * sbar_data_new ( void )
static

Create the private data for the Simple Bar.

Return values
ptrNew SBar

Definition at line 194 of file sbar.c.

195{
196 return MUTT_MEM_CALLOC(1, struct SBarPrivateData);
197}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:47
Private data for the Simple Bar.
Definition sbar.c:75
+ Here is the caller graph for this function:

◆ sbar_new()

struct MuttWindow * sbar_new ( void )

Add the Simple Bar (status)

Return values
ptrNew Simple Bar

Definition at line 203 of file sbar.c.

204{
208
209 win_sbar->wdata = sbar_data_new();
210 win_sbar->wdata_free = sbar_wdata_free;
211 win_sbar->recalc = sbar_recalc;
212 win_sbar->repaint = sbar_repaint;
213
216
217 return win_sbar;
218}
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition notify.c:61
static int sbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition sbar.c:116
static int sbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition sbar.c:148
static int sbar_recalc(struct MuttWindow *win)
Recalculate the Window data - Implements MuttWindow::recalc() -.
Definition sbar.c:82
static int sbar_repaint(struct MuttWindow *win)
Repaint the Window - Implements MuttWindow::repaint() -.
Definition sbar.c:95
static void sbar_wdata_free(struct MuttWindow *win, void **ptr)
Free the private data of the Simple Bar - Implements MuttWindow::wdata_free() -.
Definition sbar.c:178
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:191
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition mutt_window.h:39
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition mutt_window.h:53
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
Definition mutt_window.h:48
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
static struct SBarPrivateData * sbar_data_new(void)
Create the private data for the Simple Bar.
Definition sbar.c:194
int(* repaint)(struct MuttWindow *win)
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sbar_set_title()

void sbar_set_title ( struct MuttWindow * win,
const char * title )

Set the title for the Simple Bar.

Parameters
winWindow of the Simple Bar
titleString to set
Note
The title string will be copied

Definition at line 227 of file sbar.c.

228{
229 if (!win || !win->wdata || (win->type != WT_STATUS_BAR))
230 return;
231
232 struct SBarPrivateData *priv = win->wdata;
233 mutt_str_replace(&priv->display, title);
234
235 win->actions |= WA_REPAINT;
236}
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:282
#define WA_REPAINT
Redraw the contents of the Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
enum WindowType type
Window type, e.g. WT_SIDEBAR.
char * display
Cached display string.
Definition sbar.c:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function: