libyui-ncurses
2.55.0
|
C++ class for windows. More...
#include <ncursesw.h>
Public Member Functions | |
NCursesWindow (WINDOW *window) | |
Constructor. More... | |
NCursesWindow (int lines, int cols, int begin_y, int begin_x) | |
Constructor. | |
NCursesWindow (NCursesWindow &parent, int lines, int cols, int begin_y, int begin_x, char absrel='a') | |
Constructor. More... | |
virtual | ~NCursesWindow () |
Destructor. | |
NCursesWindow | Clone () |
Make an exact copy of the window. | |
int | colors () const |
Number of available colors. | |
int | height () const |
Number of lines in this window. | |
int | width () const |
Number of columns in this window. | |
int | begx () const |
Column of top left corner relative to stdscr. | |
int | begy () const |
Line of top left corner relative to stdscr. | |
int | maxx () const |
Largest x coord in window. | |
int | maxy () const |
Largest y coord in window. | |
wsze | size () const |
wpos | begpos () const |
wpos | maxpos () const |
wrect | area () const |
short | getcolor () const |
Actual color pair. | |
short | foreground () const |
Actual foreground color. | |
short | background () const |
Actual background color. | |
int | setpalette (short fore, short back) |
Set color palette entry. | |
int | setcolor (short pair) |
Set actually used palette entry. | |
virtual int | mvwin (int begin_y, int begin_x) |
Move window to new position with the new position as top left corner. More... | |
int | mvsubwin (NCursesWindow *sub, int begin_y, int begin_x) |
virtual int | resize (int lines, int columns) |
int | move (int y, int x) |
Move cursor the this position. | |
void | getyx (int &y, int &x) const |
Get current position of the cursor. | |
int | mvcur (int oldrow, int oldcol, int newrow, int newcol) const |
Perform lowlevel cursor motion that takes effect immediately. | |
int | nodelay (bool bf) |
int | getch () |
Get a keystroke from the window. | |
int | getch (int y, int x) |
Move cursor to position and get a keystroke from the window. | |
int | getstr (char *str, int n=-1) |
Read a series of characters into str until a newline or carriage return is received. More... | |
int | getstr (int y, int x, char *str, int n=-1) |
Move the cursor to the requested position and then perform the getstr() as described above. | |
int | instr (char *s, int n=-1) |
Get a std::string of characters from the window into the buffer s. More... | |
int | instr (int y, int x, char *s, int n=-1) |
Move the cursor to the requested position and then perform the instr() as described above. | |
int | addch (const char ch) |
Put attributed character to the window. | |
int | addch (const chtype ch) |
int | add_attr_char (int y, int x) |
Put attributed character from given position to the window. | |
int | add_attr_char () |
int | add_wch (const cchar_t *cch) |
Put a combined character to the window. | |
int | add_wch (int y, int x, const cchar_t *cch) |
int | addch (int y, int x, const char ch) |
Move cursor to the requested position and then put attributed character to the window. | |
int | addch (int y, int x, const chtype ch) |
int | echochar (const char ch) |
Put attributed character to the window and refresh it immediately. | |
int | echochar (const chtype ch) |
int | addstr (const char *str, int n=-1) |
Write the std::string str to the window, stop writing if the terminating NUL or the limit n is reached. More... | |
int | addstr (int y, int x, const char *str, int n=-1) |
Move the cursor to the requested position and then perform the addstr as described above. | |
int | 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. More... | |
int | 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 | printw (const char *fmt,...) |
Do a formatted print to the window. | |
int | printw (int y, int x, const char *fmt,...) |
Move the cursor and then do a formatted print to the window. | |
chtype | inch () const |
Retrieve attributed character under the current cursor position. | |
chtype | inchar () const |
chtype | inch (int y, int x) |
Move cursor to requested position and then retrieve attributed character at this position. | |
chtype | inchar (int y, int x) |
int | in_wchar (cchar_t *cchar) |
Retrieve combined character under the current cursor position. | |
int | in_wchar (int y, int x, cchar_t *cchar) |
int | insch (chtype ch) |
Insert attributed character into the window before current cursor position. | |
int | insch (int y, int x, chtype ch) |
Move cursor to requested position and then insert the attributed character before that position. | |
int | ins_wch (int y, int x, const cchar_t *cchar) |
Move cursor to requested position and then insert the attributed character before that position. | |
int | insertln () |
Insert an empty line above the current line. | |
int | insdelln (int n=1) |
If n>0 insert that many lines above the current line. More... | |
int | insstr (const char *s, int n=-1) |
Insert the std::string into the window before the current cursor position. More... | |
int | insstr (int y, int x, const char *s, int n=-1) |
Move the cursor to the requested position and then perform the insstr() as described above. | |
int | attron (chtype at) |
Switch on the window attributes;. | |
int | attroff (chtype at) |
Switch off the window attributes;. | |
int | attrset (chtype at) |
Set the window attributes;. | |
int | chgat (int n, attr_t attr, short color, const void *opts=NULL) |
Change the attributes of the next n characters in the current line. More... | |
int | chgat (int y, int x, int n, attr_t attr, short color, const void *opts=NULL) |
Move the cursor to the requested position and then perform chgat() as described above. | |
chtype | getbkgd () const |
Get current background setting. | |
int | bkgd (const chtype ch) |
Set the background property and apply it to the window. | |
void | bkgdset (chtype ch) |
Set the background property. | |
int | box () |
Draw a box around the window with the given vertical and horizontal drawing characters. More... | |
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) |
Draw a border around the window with the given characters for the various parts of the border. More... | |
int | hline (int len, chtype ch=0) |
Draw a horizontal line of len characters with the given character. More... | |
int | hline (int y, int x, int len, chtype ch=0) |
Move the cursor to the requested position and then draw a horizontal line. | |
int | vline (int len, chtype ch=0) |
Draw a vertical line of len characters with the given character. More... | |
int | vline (int y, int x, int len, chtype ch=0) |
Move the cursor to the requested position and then draw a vertical line. | |
int | box (const wrect &dim) |
int | erase () |
Erase the window. | |
int | clear () |
Clear the window. | |
int | clearok (bool bf) |
Set/Reset the clear flag. More... | |
int | clrtobot () |
Clear to the end of the window. | |
int | clrtoeol () |
Clear to the end of the line. | |
int | delch () |
Delete character under the cursor. | |
int | delch (int y, int x) |
Move cursor to requested position and delete the character under the cursor. | |
int | deleteln () |
Delete the current line. | |
int | scroll (int amount=1) |
Scroll amount lines. More... | |
int | scrollok (bool bf) |
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 | setscrreg (int from, int to) |
Define a soft scrolling region. | |
int | idlok (bool bf) |
If bf is TRUE, use insert/delete line hardware support if possible. More... | |
void | idcok (bool bf) |
If bf is TRUE, use insert/delete character hardware support if possible. More... | |
int | touchwin () |
Mark the whole window as modified. | |
int | untouchwin () |
Mark the whole window as unmodified. | |
int | touchln (int s, int cnt, bool changed=TRUE) |
Mark cnt lines beginning from line s as changed or unchanged, depending on the value of the changed flag. | |
bool | is_wintouched () const |
Return TRUE if window is marked as changed, FALSE otherwise. | |
int | leaveok (bool bf) |
If bf is TRUE, curses will leave the cursor after an update whereever it is after the update. | |
int | redrawln (int from, int n) |
Redraw n lines starting from the requested line. | |
int | redrawwin () |
Redraw the whole window. | |
int | doupdate () |
Do all outputs to make the physical screen looking like the virtual one. | |
void | syncdown () |
Propagate the changes down to all descendant windows. | |
void | syncup () |
Propagate the changes up in the hierarchy. | |
void | cursyncup () |
Position the cursor in all ancestor windows corresponding to our setting. | |
int | syncok (bool bf) |
If called with bf=TRUE, syncup() is called whenever the window is changed. | |
void | immedok (bool bf) |
If called with bf=TRUE, any change in the window will cause an automatic immediate refresh() | |
int | keypad (bool bf) |
If called with bf=TRUE, the application will interpret function keys. | |
int | meta (bool bf) |
If called with bf=TRUE, keys may generate 8-Bit characters. More... | |
int | standout () |
Enable "standout" attributes. | |
int | standend () |
Disable "standout" attributes. | |
virtual int | refresh () |
Propagate the changes in this window to the virtual screen and call doupdate(). More... | |
virtual int | noutrefresh () |
Propagate the changes in this window to the virtual screen. More... | |
int | overlay (NCursesWindow &win) |
Overlay this window over win. | |
int | overwrite (NCursesWindow &win) |
Overwrite win with this window. | |
int | copywin (NCursesWindow &win, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, bool overlay=TRUE) |
Overlay or overwrite the rectangle in win given by dminrow,dmincol, dmaxrow,dmaxcol with the rectangle in this window beginning at sminrow,smincol. | |
bool | has_mouse () const |
Return TRUE if terminal supports a mouse, FALSE otherwise. | |
NCursesWindow * | child () |
Get the first child window. | |
const NCursesWindow * | child () const |
NCursesWindow * | sibling () |
Get the next child of my parent. | |
const NCursesWindow * | sibling () const |
NCursesWindow * | parent () |
Get my parent. | |
const NCursesWindow * | parent () const |
bool | isDescendant (NCursesWindow &win) |
Return TRUE if win is a descendant of this. | |
Static Public Member Functions | |
static void | useColors (void) |
Call this routine very early if you want to have colors. | |
static int | ripoffline (int ripoff_lines, int(*init)(NCursesWindow &win)) |
This function is used to generate a window of ripped-of lines. More... | |
static int | lines () |
Number of lines on terminal, not window. | |
static int | cols () |
Number of cols on terminal, not window. | |
static int | tabsize () |
Size of a tab on terminal, not window. | |
static int | NumberOfColors () |
Number of available colors. | |
static int | maxcoord () |
Ncurses up to ncurses5 internally uses short . | |
Protected Member Functions | |
void | err_handler (const char *) const THROWS(NCursesException) |
Signal an error with the given message text. | |
void | kill_subwindows () |
Destroy all subwindows. | |
NCursesWindow () | |
Only for use by derived classes. More... | |
Protected Attributes | |
WINDOW * | w |
the curses WINDOW | |
bool | alloced |
TRUE if we own the WINDOW. | |
NCursesWindow * | par |
parent, if subwindow | |
NCursesWindow * | subwins |
head of subwindows std::list | |
NCursesWindow * | sib |
next subwindow of parent | |
Static Protected Attributes | |
static long | count = 0L |
count of all active windows | |
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) |
C++ class for windows.
Definition at line 903 of file ncursesw.h.
|
protected |
Only for use by derived classes.
They are then in charge to fill the member variables correctly.
Definition at line 255 of file ncursesw.cc.
NCursesWindow::NCursesWindow | ( | WINDOW * | window | ) |
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.
Definition at line 313 of file ncursesw.cc.
|
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.
Definition at line 1275 of file ncursesw.h.
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.
Definition at line 123 of file ncursesw.cc.
|
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.
Definition at line 1468 of file ncursesw.h.
|
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.
Definition at line 1461 of file ncursesw.h.
|
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.
Definition at line 1416 of file ncursesw.h.
|
inline |
Set/Reset the clear flag.
If std::set, the next refresh() will clear the screen.
Definition at line 1527 of file ncursesw.h.
|
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.
Definition at line 1190 of file ncursesw.h.
|
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.
Definition at line 1484 of file ncursesw.h.
|
inline |
If bf is TRUE, use insert/delete character hardware support if possible.
Otherwise do it in software.
Definition at line 1589 of file ncursesw.h.
|
inline |
If bf is TRUE, use insert/delete line hardware support if possible.
Otherwise do it in software.
Definition at line 1583 of file ncursesw.h.
|
inline |
If n>0 insert that many lines above the current line.
If n<0 delete that many lines beginning with the current line.
Definition at line 1375 of file ncursesw.h.
|
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.
Definition at line 1382 of file ncursesw.h.
|
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.
Definition at line 1209 of file ncursesw.h.
|
inline |
If called with bf=TRUE, keys may generate 8-Bit characters.
Otherwise 7-Bit characters are generated.
Definition at line 1679 of file ncursesw.h.
|
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.
Definition at line 1139 of file ncursesw.h.
|
inlinevirtual |
Propagate the changes in this window to the virtual screen.
This is redefined in NCursesPanel.
Reimplemented in NCursesPad, and NCursesPanel.
Definition at line 1705 of file ncursesw.h.
|
inlinevirtual |
Propagate the changes in this window to the virtual screen and call doupdate().
This is redefined in NCursesPanel.
Reimplemented in NCursesPad, and NCursesPanel.
Definition at line 1699 of file ncursesw.h.
|
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.
Definition at line 404 of file ncursesw.cc.
|
inline |
Scroll amount lines.
If amount is positive, scroll up, otherwise scroll down.
Definition at line 1562 of file ncursesw.h.
|
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.
Definition at line 1498 of file ncursesw.h.