libyui-ncurses
 
Loading...
Searching...
No Matches
NCursesWindow Class Reference

C++ class for windows. More...

#include <ncursesw.h>

Inheritance diagram for NCursesWindow:
Collaboration diagram for NCursesWindow:

Public Member Functions

 NCursesWindow (WINDOW *window)
 
 NCursesWindow (int lines, int cols, int begin_y, int begin_x)
 
 NCursesWindow (NCursesWindow &parent, int lines, int cols, int begin_y, int begin_x, char absrel='a')
 
virtual ~NCursesWindow ()
 
NCursesWindow Clone ()
 
int colors () const
 
int height () const
 
int width () const
 
int begx () const
 
int begy () const
 
int maxx () const
 
int maxy () const
 
wsze size () const
 
wpos begpos () const
 
wpos maxpos () const
 
wrect area () const
 
short getcolor () const
 
short foreground () const
 
short background () const
 
int setpalette (short fore, short back)
 
int setcolor (short pair)
 
virtual int mvwin (int begin_y, int begin_x)
 
int mvsubwin (NCursesWindow *sub, int begin_y, int begin_x)
 
virtual int resize (int lines, int columns)
 
int move (int y, int x)
 
void getyx (int &y, int &x) const
 
int mvcur (int oldrow, int oldcol, int newrow, int newcol) const
 
int nodelay (bool bf)
 
int getch ()
 
int getch (int y, int x)
 
int getstr (char *str, int n=-1)
 
int getstr (int y, int x, char *str, int n=-1)
 
int instr (char *s, int n=-1)
 
int instr (int y, int x, char *s, int n=-1)
 
int addch (const char ch)
 
int addch (const chtype ch)
 
int add_attr_char (int y, int x)
 
int add_attr_char ()
 
int add_wch (const cchar_t *cch)
 
int add_wch (int y, int x, const cchar_t *cch)
 
int addch (int y, int x, const char ch)
 
int addch (int y, int x, const chtype ch)
 
int echochar (const char ch)
 
int echochar (const chtype ch)
 
int addstr (const char *str, int n=-1)
 
int addstr (int y, int x, const char *str, int n=-1)
 
int addwstr (const wchar_t *str, int n=-1)
 
int addwstr (int y, int x, const wchar_t *str, int n=-1)
 
int printw (const char *fmt,...)
 
int printw (int y, int x, const char *fmt,...)
 
chtype inch () const
 
chtype inchar () const
 
chtype inch (int y, int x)
 
chtype inchar (int y, int x)
 
int in_wchar (cchar_t *cchar)
 
int in_wchar (int y, int x, cchar_t *cchar)
 
int insch (chtype ch)
 
int insch (int y, int x, chtype ch)
 
int ins_wch (int y, int x, const cchar_t *cchar)
 
int insertln ()
 
int insdelln (int n=1)
 
int insstr (const char *s, int n=-1)
 
int insstr (int y, int x, const char *s, int n=-1)
 
int attron (chtype at)
 
int attroff (chtype at)
 
int attrset (chtype at)
 
int chgat (int n, attr_t attr, short color, const void *opts=NULL)
 
int chgat (int y, int x, int n, attr_t attr, short color, const void *opts=NULL)
 
chtype getbkgd () const
 
int bkgd (const chtype ch)
 
void bkgdset (chtype ch)
 
int box ()
 
int border (chtype left=0, chtype right=0, chtype top=0, chtype bottom=0, chtype top_left=0, chtype top_right=0, chtype bottom_left=0, chtype bottom_right=0)
 
int hline (int len, chtype ch=0)
 
int hline (int y, int x, int len, chtype ch=0)
 
int vline (int len, chtype ch=0)
 
int vline (int y, int x, int len, chtype ch=0)
 
int box (const wrect &dim)
 
int erase ()
 
int clear ()
 
int clearok (bool bf)
 
int clrtobot ()
 
int clrtoeol ()
 
int delch ()
 
int delch (int y, int x)
 
int deleteln ()
 
int scroll (int amount=1)
 
int scrollok (bool bf)
 
int setscrreg (int from, int to)
 
int idlok (bool bf)
 
void idcok (bool bf)
 
int touchwin ()
 
int untouchwin ()
 
int touchln (int s, int cnt, bool changed=TRUE)
 
bool is_wintouched () const
 
int leaveok (bool bf)
 
int redrawln (int from, int n)
 
int redrawwin ()
 
int doupdate ()
 
void syncdown ()
 
void syncup ()
 
void cursyncup ()
 
int syncok (bool bf)
 
void immedok (bool bf)
 
int keypad (bool bf)
 
int meta (bool bf)
 
int standout ()
 
int standend ()
 
virtual int refresh ()
 
virtual int noutrefresh ()
 
int overlay (NCursesWindow &win)
 
int overwrite (NCursesWindow &win)
 
int copywin (NCursesWindow &win, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, bool overlay=TRUE)
 
bool has_mouse () const
 
NCursesWindowchild ()
 
const NCursesWindowchild () const
 
NCursesWindowsibling ()
 
const NCursesWindowsibling () const
 
NCursesWindowparent ()
 
const NCursesWindowparent () const
 
bool isDescendant (NCursesWindow &win)
 

Static Public Member Functions

static void useColors (void)
 
static int ripoffline (int ripoff_lines, int(*init)(NCursesWindow &win))
 
static int lines ()
 
static int cols ()
 
static int tabsize ()
 
static int NumberOfColors ()
 
static int maxcoord ()
 

Protected Member Functions

void err_handler (const char *) const THROWS(NCursesException)
 
void kill_subwindows ()
 
 NCursesWindow ()
 

Protected Attributes

WINDOW * w
 
bool alloced
 
NCursesWindowpar
 
NCursesWindowsubwins
 
NCursesWindowsib
 

Static Protected Attributes

static long count = 0L
 

Friends

class NCursesMenu
 
class NCursesForm
 
std::ostream & operator<< (std::ostream &Stream, const NCursesWindow &Obj_Cv)
 
std::ostream & operator<< (std::ostream &Stream, const NCursesWindow *Obj_Cv)
 

Detailed Description

C++ class for windows.

Constructor & Destructor Documentation

◆ NCursesWindow() [1/4]

NCursesWindow::NCursesWindow ( )
protected

Only for use by derived classes. They are then in charge to fill the member variables correctly.

◆ NCursesWindow() [2/4]

NCursesWindow::NCursesWindow ( WINDOW * window)

Constructor. Useful only for stdscr

◆ NCursesWindow() [3/4]

NCursesWindow::NCursesWindow ( int lines,
int cols,
int begin_y,
int begin_x )

Constructor.

◆ NCursesWindow() [4/4]

NCursesWindow::NCursesWindow ( NCursesWindow & parent,
int lines,
int cols,
int begin_y,
int begin_x,
char absrel = 'a' )

Constructor.

If 'absrel' is 'a', begin_x/y are absolute screen pos, if 'r', they are relative to parent origin.

◆ ~NCursesWindow()

NCursesWindow::~NCursesWindow ( )
virtual

Destructor.

Member Function Documentation

◆ add_attr_char()

int NCursesWindow::add_attr_char ( int y,
int x )

Put attributed character from given position to the window.

◆ add_wch()

int NCursesWindow::add_wch ( const cchar_t * cch)
inline

Put a combined character to the window.

◆ addch() [1/2]

int NCursesWindow::addch ( const char ch)
inline

Put attributed character to the window.

◆ addch() [2/2]

int NCursesWindow::addch ( int y,
int x,
const char ch )
inline

Move cursor to the requested position and then put attributed character to the window.

◆ addstr() [1/2]

int NCursesWindow::addstr ( const char * str,
int n = -1 )
inline

Write the std::string str to the window, stop writing if the terminating NUL or the limit n is reached. If n is negative, it is ignored.

◆ addstr() [2/2]

int NCursesWindow::addstr ( int y,
int x,
const char * str,
int n = -1 )
inline

Move the cursor to the requested position and then perform the addstr as described above.

◆ addwstr() [1/2]

int NCursesWindow::addwstr ( const wchar_t * str,
int n = -1 )

Write the wchar_t str to the window, stop writing if the terminating NUL or the limit n is reached. If n is negative, it is ignored.

◆ addwstr() [2/2]

int NCursesWindow::addwstr ( int y,
int x,
const wchar_t * str,
int n = -1 )

Move the cursor to the requested position and then perform the addwstr as described above.

◆ attroff()

int NCursesWindow::attroff ( chtype at)
inline

Switch off the window attributes;

◆ attron()

int NCursesWindow::attron ( chtype at)
inline

Switch on the window attributes;

◆ attrset()

int NCursesWindow::attrset ( chtype at)
inline

Set the window attributes;

◆ background()

short NCursesWindow::background ( ) const
inline

Actual background color

◆ begx()

int NCursesWindow::begx ( ) const
inline

Column of top left corner relative to stdscr

◆ begy()

int NCursesWindow::begy ( ) const
inline

Line of top left corner relative to stdscr

◆ bkgd()

int NCursesWindow::bkgd ( const chtype ch)
inline

Set the background property and apply it to the window.

◆ bkgdset()

void NCursesWindow::bkgdset ( chtype ch)
inline

Set the background property.

◆ border()

int NCursesWindow::border ( chtype left = 0,
chtype right = 0,
chtype top = 0,
chtype bottom = 0,
chtype top_left = 0,
chtype top_right = 0,
chtype bottom_left = 0,
chtype bottom_right = 0 )
inline

Draw a border around the window with the given characters for the various parts of the border. If you pass zero for a character, curses will try to find "nice" characters.

◆ box()

int NCursesWindow::box ( )
inline

Draw a box around the window with the given vertical and horizontal drawing characters. If you specifiy a zero as character, curses will try to find a "nice" character.

◆ chgat() [1/2]

int NCursesWindow::chgat ( int n,
attr_t attr,
short color,
const void * opts = NULL )
inline

Change the attributes of the next n characters in the current line. If n is negative or greater than the number of remaining characters in the line, the attributes will be changed up to the end of the line.

◆ chgat() [2/2]

int NCursesWindow::chgat ( int y,
int x,
int n,
attr_t attr,
short color,
const void * opts = NULL )
inline

Move the cursor to the requested position and then perform chgat() as described above.

◆ child()

NCursesWindow * NCursesWindow::child ( )
inline

Get the first child window.

◆ clear()

int NCursesWindow::clear ( )
inline

Clear the window.

◆ clearok()

int NCursesWindow::clearok ( bool bf)
inline

Set/Reset the clear flag. If std::set, the next refresh() will clear the screen.

◆ Clone()

NCursesWindow NCursesWindow::Clone ( )

Make an exact copy of the window.

◆ clrtobot()

int NCursesWindow::clrtobot ( )
inline

Clear to the end of the window.

◆ clrtoeol()

int NCursesWindow::clrtoeol ( )
inline

Clear to the end of the line.

◆ colors()

int NCursesWindow::colors ( ) const
inline

Number of available colors

◆ cols()

static int NCursesWindow::cols ( )
inlinestatic

Number of cols on terminal, not window

◆ copywin()

int NCursesWindow::copywin ( NCursesWindow & win,
int sminrow,
int smincol,
int dminrow,
int dmincol,
int dmaxrow,
int dmaxcol,
bool overlay = TRUE )
inline

Overlay or overwrite the rectangle in win given by dminrow,dmincol, dmaxrow,dmaxcol with the rectangle in this window beginning at sminrow,smincol.

◆ cursyncup()

void NCursesWindow::cursyncup ( )
inline

Position the cursor in all ancestor windows corresponding to our setting

◆ delch() [1/2]

int NCursesWindow::delch ( )
inline

Delete character under the cursor.

◆ delch() [2/2]

int NCursesWindow::delch ( int y,
int x )
inline

Move cursor to requested position and delete the character under the cursor.

◆ deleteln()

int NCursesWindow::deleteln ( )
inline

Delete the current line.

◆ doupdate()

int NCursesWindow::doupdate ( )
inline

Do all outputs to make the physical screen looking like the virtual one

◆ echochar()

int NCursesWindow::echochar ( const char ch)
inline

Put attributed character to the window and refresh it immediately.

◆ erase()

int NCursesWindow::erase ( )
inline

Erase the window.

◆ err_handler()

void NCursesWindow::err_handler ( const char * msg) const
protected

Signal an error with the given message text.

◆ foreground()

short NCursesWindow::foreground ( ) const
inline

Actual foreground color

◆ getbkgd()

chtype NCursesWindow::getbkgd ( ) const
inline

Get current background setting.

◆ getch() [1/2]

int NCursesWindow::getch ( )
inline

Get a keystroke from the window.

◆ getch() [2/2]

int NCursesWindow::getch ( int y,
int x )
inline

Move cursor to position and get a keystroke from the window

◆ getcolor()

short NCursesWindow::getcolor ( ) const

Actual color pair

◆ getstr() [1/2]

int NCursesWindow::getstr ( char * str,
int n = -1 )
inline

Read a series of characters into str until a newline or carriage return is received. Read at most n characters. If n is negative, the limit is ignored.

◆ getstr() [2/2]

int NCursesWindow::getstr ( int y,
int x,
char * str,
int n = -1 )
inline

Move the cursor to the requested position and then perform the getstr() as described above.

◆ getyx()

void NCursesWindow::getyx ( int & y,
int & x ) const
inline

Get current position of the cursor

◆ has_mouse()

bool NCursesWindow::has_mouse ( ) const

Return TRUE if terminal supports a mouse, FALSE otherwise

◆ height()

int NCursesWindow::height ( ) const
inline

Number of lines in this window

◆ hline() [1/2]

int NCursesWindow::hline ( int len,
chtype ch = 0 )
inline

Draw a horizontal line of len characters with the given character. If you pass zero for the character, curses will try to find a "nice" one.

◆ hline() [2/2]

int NCursesWindow::hline ( int y,
int x,
int len,
chtype ch = 0 )
inline

Move the cursor to the requested position and then draw a horizontal line.

◆ idcok()

void NCursesWindow::idcok ( bool bf)
inline

If bf is TRUE, use insert/delete character hardware support if possible. Otherwise do it in software.

◆ idlok()

int NCursesWindow::idlok ( bool bf)
inline

If bf is TRUE, use insert/delete line hardware support if possible. Otherwise do it in software.

◆ immedok()

void NCursesWindow::immedok ( bool bf)
inline

If called with bf=TRUE, any change in the window will cause an automatic immediate refresh()

◆ in_wchar()

int NCursesWindow::in_wchar ( cchar_t * cchar)

Retrieve combined character under the current cursor position.

◆ inch() [1/2]

chtype NCursesWindow::inch ( ) const
inline

Retrieve attributed character under the current cursor position.

◆ inch() [2/2]

chtype NCursesWindow::inch ( int y,
int x )
inline

Move cursor to requested position and then retrieve attributed character at this position.

◆ ins_wch()

int NCursesWindow::ins_wch ( int y,
int x,
const cchar_t * cchar )
inline

Move cursor to requested position and then insert the attributed character before that position.

◆ insch() [1/2]

int NCursesWindow::insch ( chtype ch)
inline

Insert attributed character into the window before current cursor position.

◆ insch() [2/2]

int NCursesWindow::insch ( int y,
int x,
chtype ch )
inline

Move cursor to requested position and then insert the attributed character before that position.

◆ insdelln()

int NCursesWindow::insdelln ( int n = 1)
inline

If n>0 insert that many lines above the current line. If n<0 delete that many lines beginning with the current line.

◆ insertln()

int NCursesWindow::insertln ( )
inline

Insert an empty line above the current line.

◆ insstr() [1/2]

int NCursesWindow::insstr ( const char * s,
int n = -1 )
inline

Insert the std::string into the window before the current cursor position. Insert stops at end of std::string or when the limit n is reached. If n is negative, it is ignored.

◆ insstr() [2/2]

int NCursesWindow::insstr ( int y,
int x,
const char * s,
int n = -1 )
inline

Move the cursor to the requested position and then perform the insstr() as described above.

◆ instr() [1/2]

int NCursesWindow::instr ( char * s,
int n = -1 )
inline

Get a std::string of characters from the window into the buffer s. Retrieve at most n characters, if n is negative retrieve all characters up to the end of the current line. Attributes are stripped from the characters.

◆ instr() [2/2]

int NCursesWindow::instr ( int y,
int x,
char * s,
int n = -1 )
inline

Move the cursor to the requested position and then perform the instr() as described above.

◆ is_wintouched()

bool NCursesWindow::is_wintouched ( ) const
inline

Return TRUE if window is marked as changed, FALSE otherwise

◆ isDescendant()

bool NCursesWindow::isDescendant ( NCursesWindow & win)

Return TRUE if win is a descendant of this.

◆ keypad()

int NCursesWindow::keypad ( bool bf)
inline

If called with bf=TRUE, the application will interpret function keys.

◆ kill_subwindows()

void NCursesWindow::kill_subwindows ( )
protected

Destroy all subwindows.

◆ leaveok()

int NCursesWindow::leaveok ( bool bf)
inline

If bf is TRUE, curses will leave the cursor after an update whereever it is after the update.

◆ lines()

static int NCursesWindow::lines ( )
inlinestatic

Number of lines on terminal, not window

◆ maxcoord()

static int NCursesWindow::maxcoord ( )
inlinestatic

Ncurses up to ncurses5 internally uses short.

◆ maxx()

int NCursesWindow::maxx ( ) const
inline

Largest x coord in window

◆ maxy()

int NCursesWindow::maxy ( ) const
inline

Largest y coord in window

◆ meta()

int NCursesWindow::meta ( bool bf)
inline

If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise 7-Bit characters are generated.

◆ move()

int NCursesWindow::move ( int y,
int x )
inline

Move cursor the this position

◆ mvcur()

int NCursesWindow::mvcur ( int oldrow,
int oldcol,
int newrow,
int newcol ) const
inline

Perform lowlevel cursor motion that takes effect immediately.

◆ mvwin()

virtual int NCursesWindow::mvwin ( int begin_y,
int begin_x )
inlinevirtual

Move window to new position with the new position as top left corner. This is virtual because it is redefined in NCursesPanel.

Reimplemented in NCursesPanel.

◆ noutrefresh()

virtual int NCursesWindow::noutrefresh ( )
inlinevirtual

Propagate the changes in this window to the virtual screen. This is redefined in NCursesPanel.

Reimplemented in NCursesPad, and NCursesPanel.

◆ NumberOfColors()

int NCursesWindow::NumberOfColors ( )
static

Number of available colors

◆ overlay()

int NCursesWindow::overlay ( NCursesWindow & win)
inline

Overlay this window over win.

◆ overwrite()

int NCursesWindow::overwrite ( NCursesWindow & win)
inline

Overwrite win with this window.

◆ parent()

NCursesWindow * NCursesWindow::parent ( )
inline

Get my parent.

◆ printw() [1/2]

int NCursesWindow::printw ( const char * fmt,
... )

Do a formatted print to the window.

◆ printw() [2/2]

int NCursesWindow::printw ( int y,
int x,
const char * fmt,
... )

Move the cursor and then do a formatted print to the window.

◆ redrawln()

int NCursesWindow::redrawln ( int from,
int n )
inline

Redraw n lines starting from the requested line

◆ redrawwin()

int NCursesWindow::redrawwin ( )
inline

Redraw the whole window

◆ refresh()

virtual int NCursesWindow::refresh ( )
inlinevirtual

Propagate the changes in this window to the virtual screen and call doupdate(). This is redefined in NCursesPanel.

Reimplemented in NCursesPad, and NCursesPanel.

◆ resize()

int NCursesWindow::resize ( int lines,
int columns )
virtual

Reimplemented in NCursesPanel.

◆ ripoffline()

int NCursesWindow::ripoffline ( int ripoff_lines,
int(* init )(NCursesWindow &win) )
static

This function is used to generate a window of ripped-of lines. If the argument is positive, lines are removed from the top, if it is negative lines are removed from the bottom. This enhances the lowlevel ripoffline() function because it uses the internal implementation that allows to remove more than just a single line. This function must be called before any other ncurses function. The creation of the window is defered until ncurses gets initialized. The initialization function is then called.

◆ scroll()

int NCursesWindow::scroll ( int amount = 1)
inline

Scroll amount lines. If amount is positive, scroll up, otherwise scroll down.

◆ scrollok()

int NCursesWindow::scrollok ( bool bf)
inline

If bf is TRUE, window scrolls if cursor is moved off the bottom edge of the window or a scrolling region, otherwise the cursor is left at the bottom line.

◆ setcolor()

int NCursesWindow::setcolor ( short pair)

Set actually used palette entry

◆ setpalette()

int NCursesWindow::setpalette ( short fore,
short back )

Set color palette entry

◆ setscrreg()

int NCursesWindow::setscrreg ( int from,
int to )
inline

Define a soft scrolling region.

◆ sibling()

NCursesWindow * NCursesWindow::sibling ( )
inline

Get the next child of my parent.

◆ standend()

int NCursesWindow::standend ( )
inline

Disable "standout" attributes

◆ standout()

int NCursesWindow::standout ( )
inline

Enable "standout" attributes

◆ syncdown()

void NCursesWindow::syncdown ( )
inline

Propagate the changes down to all descendant windows

◆ syncok()

int NCursesWindow::syncok ( bool bf)
inline

If called with bf=TRUE, syncup() is called whenever the window is changed

◆ syncup()

void NCursesWindow::syncup ( )
inline

Propagate the changes up in the hierarchy

◆ tabsize()

static int NCursesWindow::tabsize ( )
inlinestatic

Size of a tab on terminal, not window

◆ touchln()

int NCursesWindow::touchln ( int s,
int cnt,
bool changed = TRUE )
inline

Mark cnt lines beginning from line s as changed or unchanged, depending on the value of the changed flag.

◆ touchwin()

int NCursesWindow::touchwin ( )
inline

Mark the whole window as modified.

◆ untouchwin()

int NCursesWindow::untouchwin ( )
inline

Mark the whole window as unmodified.

◆ useColors()

void NCursesWindow::useColors ( void )
static

Call this routine very early if you want to have colors.

◆ vline() [1/2]

int NCursesWindow::vline ( int len,
chtype ch = 0 )
inline

Draw a vertical line of len characters with the given character. If you pass zero for the character, curses will try to find a "nice" one.

◆ vline() [2/2]

int NCursesWindow::vline ( int y,
int x,
int len,
chtype ch = 0 )
inline

Move the cursor to the requested position and then draw a vertical line.

◆ width()

int NCursesWindow::width ( ) const
inline

Number of columns in this window

Member Data Documentation

◆ alloced

bool NCursesWindow::alloced
protected

TRUE if we own the WINDOW

◆ count

long NCursesWindow::count = 0L
staticprotected

count of all active windows

◆ par

NCursesWindow* NCursesWindow::par
protected

parent, if subwindow

◆ sib

NCursesWindow* NCursesWindow::sib
protected

next subwindow of parent

◆ subwins

NCursesWindow* NCursesWindow::subwins
protected

head of subwindows std::list

◆ w

WINDOW* NCursesWindow::w
protected

the curses WINDOW


The documentation for this class was generated from the following files: