|
libyui-ncurses
2.57.2
|
An NCPad for an NCTable or an NCTree. More...
#include <NCTablePadBase.h>


Public Member Functions | |
| void | ClearTable () |
| Clear all content. | |
| virtual void | wRecoded () |
| virtual wpos | CurPos () const |
| CurPos().L is the index of the selected item. | |
| wsze | tableSize () |
| unsigned | visibleLines () const |
| Return the number of lines that are currently visible. More... | |
| bool | SetHeadline (const std::vector< NCstring > &head) |
| virtual void | SendHead () |
| void | SetSepChar (const chtype colSepchar) |
| void | SetSepWidth (const unsigned sepwidth) |
| void | SetHotCol (int hcol) |
| unsigned | Cols () const |
| Return the number of table columns (logical, not screen) | |
| unsigned | Lines () const |
| Return the number of table lines (logical, not screen) | |
| bool | empty () const |
| unsigned | HotCol () const |
| void | SetLines (unsigned count) |
| Expand or shrink to have exactly count logical lines. | |
| void | SetLines (std::vector< NCTableLine * > &newItems) |
| void | AddLine (unsigned idx, NCTableLine *item) |
| Add item at position idx, expanding if needed. More... | |
| void | Append (NCTableLine *item) |
| Add one item to the end of _items. | |
| void | Append (std::vector< NCTableCol * > &cells, int index) |
| Create a new item from 'cells' and add it to the end of _items. | |
| const NCTableLine * | GetLine (unsigned idx) const |
| Return the line at idx for read-only operations. | |
| NCTableLine * | ModifyLine (unsigned idx) |
| Return line at idx for read-write operations and mark it as modified. | |
| int | findIndex (unsigned idx) const |
| Find the item with index 'idx' in the items and return its position. More... | |
| NCTableLine * | GetCurrentLine () const |
| Return the current line (the line at the cursor position) or 0 if there is none. | |
| virtual bool | handleInput (wint_t key) |
| Handle a keyboard input event. More... | |
Public Member Functions inherited from NCPad | |
| NCPad (int lines, int cols, const NCWidget &p) | |
| NCursesWindow * | Destwin () |
| virtual void | Destwin (NCursesWindow *dwin) |
| virtual void | resize (wsze nsze) |
| virtual int | resize (int lines, int columns) |
| virtual void | setDirty () |
| int | update () |
| virtual int | setpos () |
| int | ScrlTo (const wpos &newpos) |
| int | ScrlLine (int line) |
| Scroll to a line, keeping the column. | |
| int | ScrlCol (int col) |
| Scroll to a column, keeping the line. | |
| int | ScrlDown (int lines=1) |
| int | ScrlUp (int lines=1) |
| int | ScrlRight (int cols=1) |
| int | ScrlLeft (int cols=1) |
| int | ScrlToLastLine () |
Public Member Functions inherited from NCursesPad | |
| NCursesPad (int lines, int cols) | |
| int | echochar (const chtype ch) |
| Put the attributed character onto the pad and immediately do a prefresh(). | |
| int | refresh () |
| For Pad's we reimplement refresh() and noutrefresh() to do nothing. More... | |
| int | noutrefresh () |
| Propagate the changes in this window to the virtual screen. More... | |
| int | refresh (int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol) |
| The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle on the screen. More... | |
| int | noutrefresh (int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol) |
| Does the same like refresh() but without calling doupdate(). | |
Public Member Functions inherited from NCursesWindow | |
| 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) |
| 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. | |
| 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. | |
Public Member Functions inherited from NCScrollHint | |
| void | SendSchrollCB (NCSchrollCB *dest) |
| Set the receiver of callbacks to dest | |
Protected Member Functions | |
| NCTablePadBase (int lines, int cols, const NCWidget &p) | |
| Constructor. More... | |
| virtual wsze | UpdateFormat () |
| virtual bool | currentItemHandleInput (wint_t key) |
| Call the current item's handleInput() method and return 'true' if the event is now handled, 'false' if not. | |
| void | updateVisibleItems () |
| Update the internal _visibleItems vector with the items that are currently visible: Clear the old contents of the vector, iterate over all lines and check which ones are currently visible. More... | |
| void | setFormatDirty () |
| virtual int | dirtyPad () |
| virtual int | DoRedraw () |
| Redraw the pad. More... | |
| virtual void | prepareRedraw () |
| Prepare a redraw: Update the format if needed, set the background, clear the old content. | |
| virtual void | drawContentLines () |
| Redraw the (visible) content lines one by one. | |
| virtual void | drawHeader () |
| Redraw the table header. | |
| virtual int | setpos (const wpos &newPos) |
| Base function for scrolling: Move the cursor position to 'newPos' and redraw the old and the new current item with suitable attributes: The new current item is highlighted, the old one is not. More... | |
| int | currentLineNo () const |
| Return the current line number (the cursor position). | |
| void | setCurrentLineNo (int newVal) |
| Set the current line number (the cursor position). | |
| int | currentColNo () const |
| Return the current column number (the cursor position). | |
| void | setCurrentColNo (int newVal) |
| Set the current column number (the cursor position). | |
| void | assertLine (unsigned index) |
| Ensure that a line with the specified index exists. More... | |
Protected Member Functions inherited from NCPad | |
| int | vheight () const |
| The (virtual) height of the Pad (even if truncated). | |
| bool | paging () const |
| Whether the Pad is truncated (we're paging). | |
| int | adjpos (const wpos &offset) |
| Adjust CurPos relatively by offset | |
| virtual void | updateScrollHint () |
| virtual void | directDraw (NCursesWindow &w, const wrect at, unsigned lineno) |
| Directly draw a table item at a specific location. More... | |
Protected Member Functions inherited from NCursesWindow | |
| 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 Member Functions inherited from NCScrollHint | |
| virtual void | SetHead (NCursesWindow &w, unsigned ccol) |
| void | VSet (unsigned total, unsigned visible, unsigned start) |
| void | HSet (unsigned total, unsigned visible, unsigned start) |
| virtual void | SetPadSize (wsze &minsze) |
Protected Member Functions inherited from NCSchrollCB | |
| virtual void | HScroll (unsigned total, unsigned visible, unsigned start) |
| virtual void | VScroll (unsigned total, unsigned visible, unsigned start) |
| virtual void | ScrollHead (NCursesWindow &w, unsigned ccol) |
| virtual void | AdjustPadSize (wsze &minsze) |
Protected Attributes | |
| std::vector< NCTableLine * > | _items |
| (owned) | |
| std::vector< NCTableLine * > | _visibleItems |
| not owned | |
| NCursesPad | _headpad |
| bool | _dirtyHead |
| bool | _dirtyFormat |
| does table format (size) need recalculating? | |
| NCTableStyle | _itemStyle |
| wpos | _citem |
| current/cursor position | |
Protected Attributes inherited from NCPad | |
| const NCWidget & | parw |
| NCursesWindow * | destwin |
| Where to draw us (may be nullptr, not owned) More... | |
| wrect | drect |
| wrect | srect |
| Source rectangle: the visible part of this pad. | |
| wpos | maxdpos |
| wpos | maxspos |
| bool | dclear |
| should destwin be cleared before contents is copied there | |
| bool | dirty |
Protected Attributes inherited from NCursesWindow | |
| 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 | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const NCTablePadBase &obj) |
Additional Inherited Members | |
Static Public Member Functions inherited from NCursesWindow | |
| 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. | |
Static Protected Attributes inherited from NCursesWindow | |
| static long | count = 0L |
| count of all active windows | |
An NCPad for an NCTable or an NCTree.
This is an abstract base class for NCTablePad and NCTreePad.
See also https://github.com/libyui/libyui-ncurses/blob/master/doc/nctable-and-nctree.md
Notice that this class is heavily used in other selection widgets like
And the table classes from libyui-ncurses-pkg:
So if you change anything here, make sure to test all those classes.
Definition at line 58 of file NCTablePadBase.h.
|
protected |
Constructor.
This is protected because this is an abstract base class, not meant to be instantiated on this level.
Definition at line 33 of file NCTablePadBase.cc.
| void NCTablePadBase::AddLine | ( | unsigned | idx, |
| NCTableLine * | item | ||
| ) |
Add item at position idx, expanding if needed.
| item | we take ownership |
Definition at line 154 of file NCTablePadBase.cc.

|
protected |
Ensure that a line with the specified index exists.
Enlarge or shrink if necessary.
Definition at line 164 of file NCTablePadBase.cc.

|
protectedvirtual |
Redraw the pad.
Reimplemented from NCPad.
Reimplemented in NCTreePad, and NCTablePad.
Definition at line 239 of file NCTablePadBase.cc.

| int NCTablePadBase::findIndex | ( | unsigned | idx | ) | const |
Find the item with index 'idx' in the items and return its position.
Return -1 if not found.
Definition at line 100 of file NCTablePadBase.cc.

|
virtual |
Handle a keyboard input event.
Return 'true' if the event is now handled, 'false' if it should be propagated to the parent widget.
Most of the keys are now handled in the individual items' handlers (NCTreeLine, NCTableLine). This method is mostly here as a stub for future extensions.
Reimplemented from NCPad.
Reimplemented from NCPad.
Reimplemented in NCTreePad, and NCTablePad.
Definition at line 386 of file NCTablePadBase.cc.

|
protectedvirtual |
Base function for scrolling: Move the cursor position to 'newPos' and redraw the old and the new current item with suitable attributes: The new current item is highlighted, the old one is not.
Reimplemented from NCPad.
Reimplemented from NCPad.
Definition at line 301 of file NCTablePadBase.cc.

|
protected |
Update the internal _visibleItems vector with the items that are currently visible: Clear the old contents of the vector, iterate over all lines and check which ones are currently visible.
This does NOT do a screen update of the visible items!
Definition at line 227 of file NCTablePadBase.cc.

|
inline |
Return the number of lines that are currently visible.
This is updated in UpdateFormat().
Definition at line 89 of file NCTablePadBase.h.