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

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

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

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

Parameters:
*win window to be bordered
verch vertical chtype
horch horizontal chtype
Return values:
rc return status code

Definition at line 20 of file edging.c.

References _curses_window::attrs, and wborder().

00020                                                     {
00021         chtype corner = '+' | win->attrs; /* default corner character */
00022         return wborder( win, verch, verch, horch, horch,
00023                         corner, corner, corner, corner );
00024 }

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:
*win window to be bordered
ls left side
rs right side
ts top
bs bottom
tl top left corner
tr top right corner
bl bottom left corner
br bottom right corner
Return values:
rc return status code

Definition at line 41 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().

00043                                                 {
00044         struct cursor_pos pos;
00045 
00046         _store_curs_pos( win, &pos );
00047         wmove(win,0,0);
00048 
00049         _wputch(win,tl,WRAP);
00050         while ( ( win->width - 1 ) - win->curs_x ) {
00051                 _wputch(win,ts,WRAP);
00052         }
00053         _wputch(win,tr,WRAP);
00054 
00055         while ( ( win->height - 1 ) - win->curs_y ) {
00056                 _wputch(win,ls,WRAP);
00057                 wmove(win,win->curs_y,(win->width)-1);
00058                 _wputch(win,rs,WRAP);
00059         }
00060 
00061         _wputch(win,bl,WRAP);
00062         while ( ( win->width -1 ) - win->curs_x ) {
00063                 _wputch(win,bs,WRAP);
00064         }
00065         _wputch(win,br,NOWRAP); /* do not wrap last char to leave
00066                                    cursor in last position */
00067         _restore_curs_pos( win, &pos );
00068 
00069         return OK;
00070 }

int whline ( WINDOW win,
chtype  ch,
int  n 
)

Create a horizontal line in a window.

Parameters:
*win subject window
ch rendition and character
n max number of chars (wide) to render
Return values:
rc return status code

Definition at line 80 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().

00080                                              {
00081         struct cursor_pos pos;
00082 
00083         _store_curs_pos ( win, &pos );
00084         while ( ( win->curs_x - win->width ) && n-- ) {
00085                 _wputch ( win, ch, NOWRAP );
00086         }
00087         _restore_curs_pos ( win, &pos );
00088 
00089         return OK;
00090 }

int wvline ( WINDOW win,
chtype  ch,
int  n 
)

Create a vertical line in a window.

Parameters:
*win subject window
ch rendition and character
n max number of chars (high) to render
Return values:
rc return status code

Definition at line 100 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().

00100                                              {
00101         struct cursor_pos pos;
00102 
00103         _store_curs_pos ( win, &pos );
00104         while ( ( win->curs_y - win->height ) && n-- ) {
00105                 _wputch ( win, ch, NOWRAP );
00106                 wmove( win, ++(win->curs_y), pos.x);
00107         }
00108         _restore_curs_pos ( win, &pos );
00109 
00110         return OK;
00111 }


Generated on Tue Apr 6 20:01:46 2010 for gPXE by  doxygen 1.5.7.1