Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

NCursesWindow Class Reference

C++ class for windows. More...

#include <ncursesw.h>

Inheritance diagram for NCursesWindow:

NCursesColorWindow NCursesPad NCursesPanel NCPad NCursesUserPanel< T > NCTablePad NCTextPad NCTreePad List of all members.

Public Member Functions

 NCursesWindow (WINDOW *&window)
 NCursesWindow (int lines, int cols, int begin_y, int begin_x)
 NCursesWindow (NCursesWindow &par, 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_linetouched (int line) const
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

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

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

long count = 0L

Private Member Functions

void init ()
short getcolor (int getback) const
 NCursesWindow (WINDOW *win, int cols)

Static Private Member Functions

void initialize ()
int ripoff_init (WINDOW *, int)
int setpalette (short fore, short back, short pair)

Static Private Attributes

bool b_initialized = FALSE
int colorInitialized = COLORS_NOT_INITIALIZED

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::NCursesWindow WINDOW *  win,
int  cols
[private]
 

This private constructor is only used during the initialization of windows generated by ripoffline() calls.

NCursesWindow::NCursesWindow  )  [protected]
 

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

NCursesWindow::NCursesWindow WINDOW *&  window  ) 
 

Constructor. Useful only for stdscr

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

Constructor.

Parameters:
lines number of lines
cols number of columns
begin_y line origin
begin_x col origin

NCursesWindow::NCursesWindow NCursesWindow par,
int  lines,
int  cols,
int  begin_y,
int  begin_x,
char  absrel = 'a'
 

Constructor.

Parameters:
par parent window
lines number of lines
cols number of columns
begin_y line origin
begin_x col origin
absrel='a' If `a', begin_x/y are absolute screen pos, else if `r', they are relative to par origin

NCursesWindow::~NCursesWindow  )  [virtual]
 

Destructor.


Member Function Documentation

int NCursesWindow::add_attr_char  ) 
 

int NCursesWindow::add_attr_char int  y,
int  x
 

Put attributed character from given position to the window.

int NCursesWindow::add_wch int  y,
int  x,
const cchar_t *  cch
[inline]
 

int NCursesWindow::add_wch const cchar_t *  cch  )  [inline]
 

Put a combined character to the window.

int NCursesWindow::addch int  y,
int  x,
const chtype  ch
[inline]
 

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.

int NCursesWindow::addch const chtype  ch  )  [inline]
 

int NCursesWindow::addch const char  ch  )  [inline]
 

Put attributed character to the window.

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.

int NCursesWindow::addstr const char *  str,
int  n = -1
[inline]
 

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

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.

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.

wrect NCursesWindow::area  )  const [inline]
 

int NCursesWindow::attroff chtype  at  )  [inline]
 

Switch off the window attributes;

int NCursesWindow::attron chtype  at  )  [inline]
 

Switch on the window attributes;

int NCursesWindow::attrset chtype  at  )  [inline]
 

Set the window attributes;

short NCursesWindow::background  )  const [inline]
 

Actual background color

wpos NCursesWindow::begpos  )  const [inline]
 

int NCursesWindow::begx  )  const [inline]
 

Column of top left corner relative to stdscr

int NCursesWindow::begy  )  const [inline]
 

Line of top left corner relative to stdscr

int NCursesWindow::bkgd const chtype  ch  )  [inline]
 

Set the background property and apply it to the window.

void NCursesWindow::bkgdset chtype  ch  )  [inline]
 

Set the background property.

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.

int NCursesWindow::box const wrect dim  ) 
 

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.

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.

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.

const NCursesWindow* NCursesWindow::child  )  const [inline]
 

NCursesWindow* NCursesWindow::child  )  [inline]
 

Get the first child window.

int NCursesWindow::clear  )  [inline]
 

Clear the window.

int NCursesWindow::clearok bool  bf  )  [inline]
 

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

NCursesWindow NCursesWindow::Clone  ) 
 

Make an exact copy of the window.

int NCursesWindow::clrtobot  )  [inline]
 

Clear to the end of the window.

int NCursesWindow::clrtoeol  )  [inline]
 

Clear to the end of the line.

int NCursesWindow::colors  )  const [inline]
 

Number of available colors

int NCursesWindow::cols  )  [inline, static]
 

Number of cols on terminal, *not* window

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.

void NCursesWindow::cursyncup  )  [inline]
 

Position the cursor in all ancestor windows corresponding to our setting

int NCursesWindow::delch int  y,
int  x
[inline]
 

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

int NCursesWindow::delch  )  [inline]
 

Delete character under the cursor.

int NCursesWindow::deleteln  )  [inline]
 

Delete the current line.

int NCursesWindow::doupdate  )  [inline]
 

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

int NCursesWindow::echochar const chtype  ch  )  [inline]
 

Reimplemented in NCursesPad.

int NCursesWindow::echochar const char  ch  )  [inline]
 

Put attributed character to the window and refresh it immediately.

int NCursesWindow::erase  )  [inline]
 

Erase the window.

void NCursesWindow::err_handler const char *   )  const [protected]
 

Signal an error with the given message text.

short NCursesWindow::foreground  )  const [inline]
 

Actual foreground color

chtype NCursesWindow::getbkgd  )  const [inline]
 

Get current background setting.

int NCursesWindow::getch int  y,
int  x
[inline]
 

Move cursor to position and get a keystroke from the window

int NCursesWindow::getch  )  [inline]
 

Get a keystroke from the window.

short NCursesWindow::getcolor  )  const
 

Actual color pair

short NCursesWindow::getcolor int  getback  )  const [private]
 

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.

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.

void NCursesWindow::getyx int &  y,
int &  x
const [inline]
 

Get current position of the cursor

bool NCursesWindow::has_mouse  )  const
 

Return TRUE if terminal supports a mouse, FALSE otherwise

int NCursesWindow::height  )  const [inline]
 

Number of lines in this window

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.

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.

void NCursesWindow::idcok bool  bf  )  [inline]
 

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

int NCursesWindow::idlok bool  bf  )  [inline]
 

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

void NCursesWindow::immedok bool  bf  )  [inline]
 

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

int NCursesWindow::in_wchar int  y,
int  x,
cchar_t *  cchar
 

int NCursesWindow::in_wchar cchar_t *  cchar  ) 
 

Retrieve combined character under the current cursor position.

chtype NCursesWindow::inch int  y,
int  x
[inline]
 

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

chtype NCursesWindow::inch  )  const [inline]
 

Retrieve attributed character under the current cursor position.

chtype NCursesWindow::inchar int  y,
int  x
[inline]
 

chtype NCursesWindow::inchar  )  const [inline]
 

void NCursesWindow::init  )  [private]
 

Reimplemented in NCursesPanel.

void NCursesWindow::initialize  )  [static, private]
 

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.

int NCursesWindow::insch int  y,
int  x,
chtype  ch
[inline]
 

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

int NCursesWindow::insch chtype  ch  )  [inline]
 

Insert attributed character into the window before current cursor position.

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.

int NCursesWindow::insertln  )  [inline]
 

Insert an empty line above the current line.

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.

int NCursesWindow::insstr const char *  s,
int  n = -1
[inline]
 

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

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.

int NCursesWindow::instr char *  s,
int  n = -1
[inline]
 

Get a 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.

bool NCursesWindow::is_linetouched int  line  )  const [inline]
 

Return TRUE if line is marked as changed, FALSE otherwise

bool NCursesWindow::is_wintouched  )  const [inline]
 

Return TRUE if window is marked as changed, FALSE otherwise

bool NCursesWindow::isDescendant NCursesWindow win  ) 
 

Return TRUE if win is a descendant of this.

int NCursesWindow::keypad bool  bf  )  [inline]
 

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

void NCursesWindow::kill_subwindows  )  [protected]
 

Destroy all subwindows.

int NCursesWindow::leaveok bool  bf  )  [inline]
 

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

int NCursesWindow::lines  )  [inline, static]
 

Number of lines on terminal, *not* window

wpos NCursesWindow::maxpos  )  const [inline]
 

int NCursesWindow::maxx  )  const [inline]
 

Largest x coord in window

int NCursesWindow::maxy  )  const [inline]
 

Largest y coord in window

int NCursesWindow::meta bool  bf  )  [inline]
 

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

int NCursesWindow::move int  y,
int  x
[inline]
 

Move cursor the this position

int NCursesWindow::mvcur int  oldrow,
int  oldcol,
int  newrow,
int  newcol
const [inline]
 

Perform lowlevel cursor motion that takes effect immediately.

int NCursesWindow::mvsubwin NCursesWindow sub,
int  begin_y,
int  begin_x
 

virtual int NCursesWindow::mvwin int  begin_y,
int  begin_x
[inline, virtual]
 

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.

int NCursesWindow::nodelay bool  bf  )  [inline]
 

virtual int NCursesWindow::noutrefresh  )  [inline, virtual]
 

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

Reimplemented in NCursesPanel, and NCursesPad.

int NCursesWindow::NumberOfColors  )  [static]
 

Number of available colors

int NCursesWindow::overlay NCursesWindow win  )  [inline]
 

Overlay this window over win.

int NCursesWindow::overwrite NCursesWindow win  )  [inline]
 

Overwrite win with this window.

const NCursesWindow* NCursesWindow::parent  )  const [inline]
 

NCursesWindow* NCursesWindow::parent  )  [inline]
 

Get my parent.

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

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

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

Do a formatted print to the window.

int NCursesWindow::redrawln int  from,
int  n
[inline]
 

Redraw n lines starting from the requested line

int NCursesWindow::redrawwin  )  [inline]
 

Redraw the whole window

virtual int NCursesWindow::refresh  )  [inline, virtual]
 

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

Reimplemented in NCursesPanel, and NCursesPad.

int NCursesWindow::resize int  lines,
int  columns
[virtual]
 

Reimplemented in NCursesPanel.

int NCursesWindow::ripoff_init WINDOW *  ,
int 
[static, private]
 

int NCursesWindow::ripoffline int  ripoff_lines,
int(*)(NCursesWindow &win)  init
[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.

int NCursesWindow::scroll int  amount = 1  )  [inline]
 

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

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.

int NCursesWindow::setcolor short  pair  ) 
 

Set actually used palette entry

int NCursesWindow::setpalette short  fore,
short  back
 

Set color palette entry

int NCursesWindow::setpalette short  fore,
short  back,
short  pair
[static, private]
 

int NCursesWindow::setscrreg int  from,
int  to
[inline]
 

Define a soft scrolling region.

const NCursesWindow* NCursesWindow::sibling  )  const [inline]
 

NCursesWindow* NCursesWindow::sibling  )  [inline]
 

Get the next child of my parent.

wsze NCursesWindow::size  )  const [inline]
 

int NCursesWindow::standend  )  [inline]
 

Disable "standout" attributes

int NCursesWindow::standout  )  [inline]
 

Enable "standout" attributes

void NCursesWindow::syncdown  )  [inline]
 

Propagate the changes down to all descendant windows

int NCursesWindow::syncok bool  bf  )  [inline]
 

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

void NCursesWindow::syncup  )  [inline]
 

Propagate the changes up in the hierarchy

int NCursesWindow::tabsize  )  [inline, static]
 

Size of a tab on terminal, *not* window

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.

int NCursesWindow::touchwin  )  [inline]
 

Mark the whole window as modified.

int NCursesWindow::untouchwin  )  [inline]
 

Mark the whole window as unmodified.

void NCursesWindow::useColors void   )  [static]
 

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

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.

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.

int NCursesWindow::width  )  const [inline]
 

Number of columns in this window


Friends And Related Function Documentation

friend class NCursesForm [friend]
 

friend class NCursesMenu [friend]
 

std::ostream& operator<< std::ostream &  Stream,
const NCursesWindow Obj_Cv
[friend]
 

std::ostream& operator<< std::ostream &  Stream,
const NCursesWindow Obj_Cv
[friend]
 


Member Data Documentation

bool NCursesWindow::alloced [protected]
 

TRUE if we own the WINDOW

bool NCursesWindow::b_initialized = FALSE [static, private]
 

int NCursesWindow::colorInitialized = COLORS_NOT_INITIALIZED [static, private]
 

long NCursesWindow::count = 0L [static, protected]
 

count of all active windows

NCursesWindow* NCursesWindow::par [protected]
 

parent, if subwindow

NCursesWindow* NCursesWindow::sib [protected]
 

next subwindow of parent

NCursesWindow* NCursesWindow::subwins [protected]
 

head of subwindows list

WINDOW* NCursesWindow::w [protected]
 

the curses WINDOW


The documentation for this class was generated from the following files:
Generated on Wed Nov 12 04:52:34 2008 for yast2-ncurses by  doxygen 1.3.9.1