iPXE
Functions
clear.c File Reference

MuCurses clearing 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 wclrtobot (WINDOW *win)
 Clear a window to the bottom from current cursor position.
int wclrtoeol (WINDOW *win)
 Clear a window to the end of the current line.
int wdelch (WINDOW *win)
 Delete character under the cursor in a window.
int wdeleteln (WINDOW *win)
 Delete line under a window's cursor.
int werase (WINDOW *win)
 Completely clear a window.
int erase (void)
 Completely clear the screen.

Detailed Description

MuCurses clearing functions.

Definition in file clear.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int wclrtobot ( WINDOW win)

Clear a window to the bottom from current cursor position.

Parameters:
*winsubject window
Return values:
rcreturn status code

Definition at line 19 of file clear.c.

References _restore_curs_pos(), _store_curs_pos(), _wputc(), _curses_window::curs_x, _curses_window::curs_y, OK, and WRAP.

Referenced by clrtobot(), and werase().

                              {
        struct cursor_pos pos;

        _store_curs_pos( win, &pos );
        do {
                _wputc( win, ' ', WRAP );
        } while ( win->curs_y + win->curs_x );
        _restore_curs_pos( win, &pos );

        return OK;
}
int wclrtoeol ( WINDOW win)

Clear a window to the end of the current line.

Parameters:
*winsubject window
Return values:
rcreturn status code

Definition at line 37 of file clear.c.

References _restore_curs_pos(), _store_curs_pos(), _wputc(), _curses_window::curs_y, OK, WRAP, and cursor_pos::y.

Referenced by clrtoeol(), slk_clear(), and wdeleteln().

                              {
        struct cursor_pos pos;

        _store_curs_pos( win, &pos );
        while ( ( win->curs_y - pos.y ) == 0 ) {
                _wputc( win, ' ', WRAP );
        }
        _restore_curs_pos( win, &pos );

        return OK;
}
int wdelch ( WINDOW win)

Delete character under the cursor in a window.

Parameters:
*winsubject window
Return values:
rcreturn status code

Definition at line 55 of file clear.c.

References _wcursback(), _wputc(), NOWRAP, and OK.

Referenced by delch(), mvdelch(), mvwdelch(), wgetch(), and wgetnstr().

                           {
        _wputc( win, ' ', NOWRAP );
        _wcursback( win );

        return OK;
}
int wdeleteln ( WINDOW win)

Delete line under a window's cursor.

Parameters:
*winsubject window
Return values:
rcreturn status code

Definition at line 68 of file clear.c.

References _restore_curs_pos(), _store_curs_pos(), _curses_window::curs_y, OK, wclrtoeol(), and wmove().

Referenced by deleteln().

                              {
        struct cursor_pos pos;

        _store_curs_pos( win, &pos );
        /* let's just set the cursor to the beginning of the line and
           let wclrtoeol do the work :) */
        wmove( win, win->curs_y, 0 );
        wclrtoeol( win );
        _restore_curs_pos( win, &pos );
        return OK;
}
int werase ( WINDOW win)

Completely clear a window.

Parameters:
*winsubject window
Return values:
rcreturn status code

Definition at line 86 of file clear.c.

References OK, wclrtobot(), and wmove().

                           {
        wmove( win, 0, 0 );
        wclrtobot( win );
        return OK;
}
int erase ( void  )

Completely clear the screen.

Return values:
rcreturn status code

Definition at line 97 of file clear.c.

References OK, and stdscr.

Referenced by login_ui(), settings_ui(), and show_menu().

                   {
        stdscr->scr->erase( stdscr->scr, stdscr->attrs );
        return OK;
}