iPXE
Functions
edging.c File Reference

MuCurses edging functions. More...

#include <curses.h>
#include "mucurses.h"
#include "cursor.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int box (WINDOW *win, chtype verch, chtype horch)
 Draw borders from single-byte characters and renditions around a window.
int wborder (WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
 Draw borders from single-byte characters and renditions around a window.
int whline (WINDOW *win, chtype ch, int n)
 Create a horizontal line in a window.
int wvline (WINDOW *win, chtype ch, int n)
 Create a vertical line in a window.

Detailed Description

MuCurses edging functions.

Definition in file edging.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int box ( WINDOW win,
chtype  verch,
chtype  horch 
)

Draw borders from single-byte characters and renditions around a window.

Parameters:
*winwindow to be bordered
verchvertical chtype
horchhorizontal chtype
Return values:
rcreturn status code

Definition at line 22 of file edging.c.

References _curses_window::attrs, and wborder().

                                                    {
        chtype corner = '+' | win->attrs; /* default corner character */
        return wborder( win, verch, verch, horch, horch,
                        corner, corner, corner, corner );
}
int wborder ( WINDOW win,
chtype  ls,
chtype  rs,
chtype  ts,
chtype  bs,
chtype  tl,
chtype  tr,
chtype  bl,
chtype  br 
)

Draw borders from single-byte characters and renditions around a window.

Parameters:
*winwindow to be bordered
lsleft side
rsright side
tstop
bsbottom
tltop left corner
trtop right corner
blbottom left corner
brbottom right corner
Return values:
rcreturn status code

Definition at line 43 of file edging.c.

References _restore_curs_pos(), _store_curs_pos(), _wputch(), _curses_window::curs_x, _curses_window::curs_y, _curses_window::height, NOWRAP, OK, _curses_window::width, wmove(), and WRAP.

Referenced by border(), and box().

                                                {
        struct cursor_pos pos;

        _store_curs_pos( win, &pos );
        wmove(win,0,0);

        _wputch(win,tl,WRAP);
        while ( ( win->width - 1 ) - win->curs_x ) {
                _wputch(win,ts,WRAP);
        }
        _wputch(win,tr,WRAP);

        while ( ( win->height - 1 ) - win->curs_y ) {
                _wputch(win,ls,WRAP);
                wmove(win,win->curs_y,(win->width)-1);
                _wputch(win,rs,WRAP);
        }

        _wputch(win,bl,WRAP);
        while ( ( win->width -1 ) - win->curs_x ) {
                _wputch(win,bs,WRAP);
        }
        _wputch(win,br,NOWRAP); /* do not wrap last char to leave
                                   cursor in last position */
        _restore_curs_pos( win, &pos );

        return OK;
}
int whline ( WINDOW win,
chtype  ch,
int  n 
)

Create a horizontal line in a window.

Parameters:
*winsubject window
chrendition and character
nmax number of chars (wide) to render
Return values:
rcreturn status code

Definition at line 82 of file edging.c.

References _restore_curs_pos(), _store_curs_pos(), _wputch(), _curses_window::curs_x, NOWRAP, OK, and _curses_window::width.

Referenced by hline(), mvhline(), and mvwhline().

                                             {
        struct cursor_pos pos;

        _store_curs_pos ( win, &pos );
        while ( ( win->curs_x - win->width ) && n-- ) {
                _wputch ( win, ch, NOWRAP );
        }
        _restore_curs_pos ( win, &pos );

        return OK;
}
int wvline ( WINDOW win,
chtype  ch,
int  n 
)

Create a vertical line in a window.

Parameters:
*winsubject window
chrendition and character
nmax number of chars (high) to render
Return values:
rcreturn status code

Definition at line 102 of file edging.c.

References _restore_curs_pos(), _store_curs_pos(), _wputch(), _curses_window::curs_y, _curses_window::height, NOWRAP, OK, wmove(), and cursor_pos::x.

Referenced by mvvline(), mvwvline(), and vline().

                                             {
        struct cursor_pos pos;

        _store_curs_pos ( win, &pos );
        while ( ( win->curs_y - win->height ) && n-- ) {
                _wputch ( win, ch, NOWRAP );
                wmove( win, ++(win->curs_y), pos.x);
        }
        _restore_curs_pos ( win, &pos );

        return OK;
}