|
libyui-ncurses
2.57.2
|
One line in a NCTable with multiple cells and an optional tree hierarchy. More...
#include <NCTableItem.h>


Public Types | |
| enum | STATE { S_NORMAL = 0x00, S_ACTIVE = 0x01, S_DISABLED = 0x10, S_HIDDEN = 0x20, S_HEADLINE = 0x40 } |
Public Member Functions | |
| NCTableLine (std::vector< NCTableCol * > &cells, int index=-1, bool nested=false, unsigned state=S_NORMAL) | |
| Constructor: Create an NCTableLine and fill it with 'cells'. More... | |
| NCTableLine (NCTableLine *parentLine, YItem *yitem, std::vector< NCTableCol * > &cells, int index=-1, bool nested=false, unsigned state=S_NORMAL) | |
| NCTableLine (unsigned colCount, int index=-1, bool nested=false, unsigned state=S_NORMAL) | |
| Constructor with a number of empty cells. | |
| NCTableLine (NCTableLine *parentLine, YItem *yitem, unsigned colCount, int index=-1, bool nested=false, unsigned state=S_NORMAL) | |
| virtual | ~NCTableLine () |
| Destructor. | |
| YTableItem * | origItem () const |
| Return the YItem this line corresponds to. | |
| void | setOrigItem (YTableItem *yitem) |
| Set the YItem this line corresponds to. | |
| int | index () const |
| Return the unique index by which this line can be identified. | |
| unsigned | Cols () const |
| Return the number of columns (cells) in this line. | |
| void | SetCols (unsigned idx) |
| Set a number of (empty) columns (cells). | |
| void | SetCols (std::vector< NCTableCol * > &newCells) |
| Set the columns (cells). | |
| void | ClearLine () |
| Delete all content. | |
| std::vector< NCTableCol * > | GetItems () const |
| Return all columns (cells). More... | |
| void | Append (NCTableCol *cell) |
| Append one cell. More... | |
| void | AddCol (unsigned idx, NCTableCol *item) |
| void | DelCol (unsigned idx) |
| NCTableCol * | GetCol (unsigned idx) |
| Return a non-const pointer for read/write operations to the column (the cell) with the specified index or 0 if there is no such cell. More... | |
| const NCTableCol * | GetCol (unsigned idx) const |
| Return a const pointer for read-only operatoins to the column (the cell) with the specified index or 0 if there is no such cell. More... | |
| void | SetState (const STATE s) |
| void | ClearState (const STATE s) |
| bool | isHidden () const |
| bool | isDisabled () const |
| bool | isSpecial () const |
| bool | isActive () const |
| virtual bool | isVisible () const |
| virtual bool | isEnabled () const |
| virtual bool | isNested () const |
| Return 'true' if this should be displayed as nested items, i.e. More... | |
| virtual void | setNested (bool val) |
| Set the 'nested' status. | |
| void | openBranch () |
| Open this tree branch. | |
| void | closeBranch () |
| Close this tree branch. | |
| void | toggleOpenClosedState () |
| Toggle the open/closed state of this branch. | |
| virtual bool | handleInput (wint_t key) |
| Handle keyboard input. More... | |
| virtual bool | ChangeToVisible () |
| Change a line that may have been invisible until now to be visible. More... | |
| virtual unsigned | Hotspot (unsigned &at) const |
| virtual void | UpdateFormat (NCTableStyle &tableStyle) |
| Update TableStyle so that this line fits in. | |
| virtual void | updatePrefix () |
| Create the real tree hierarchy line graphics prefix and store it in _prefix. | |
| virtual void | DrawAt (NCursesWindow &w, const wrect at, NCTableStyle &tableStyle, bool active) const |
| void | stripHotkeys () |
| virtual NCTableLine * | parent () const |
| virtual NCTableLine * | firstChild () const |
| virtual NCTableLine * | nextSibling () const |
| void | setParent (NCTableLine *newVal) |
| void | setFirstChild (NCTableLine *newVal) |
| void | setNextSibling (NCTableLine *newVal) |
| int | treeLevel () const |
| Return the nesting level in the tree (toplevel is 0). | |
| void | setTreeLevel (int newVal) |
| Set the tree nesting level. | |
| int | prefixLen () const |
| Return the length of the prefix for tree hierarchy line graphics. | |
| NCTableTag * | tagCell () const |
| Return the tag cell or 0 if there is none. | |
| std::string | indentationStr () const |
| Return a string of a number of blanks suitable for the indentation of this tree level. | |
Protected Member Functions | |
| void | treeInit (NCTableLine *parentLine, YItem *yitem) |
| Common init for tree-related things in the constructors that have a 'parentLine' and a 'yitem' parameter. | |
| void | initPrefixPlaceholder () |
| Initialize _prefixPlaceholder, the placeholder for tree hierarchy line graphics. | |
| void | addToTree (NCTableLine *parent) |
| Add this line to the parent's tree hierarchy. | |
| bool | isOpen (YItem *yitem) const |
| Return 'true' if yitem inherits YTreeItem or YTableItem and has its 'open' flag set to 'true'. | |
| YItem * | yitem () const |
| Return the YItem this line corresponds to as its base class. | |
| void | setYItem (YItem *yitem) |
| Set the YItem this line corresponds to. | |
| virtual void | DrawItems (NCursesWindow &w, const wrect at, NCTableStyle &tableStyle, bool active) const |
| void | assertCol (unsigned idx) |
| const std::string & | prefixPlaceholder () const |
| Return a placeholder for the prefix string for this line consisting of enough blanks for the tree hierarchy line graphics. More... | |
| void | drawPrefix (NCursesWindow &w, const wrect at, NCTableStyle &tableStyle) const |
| Draw the tree hierarchy line graphics prefix in _prefix in window 'w' into rectangle 'at' with style 'tableStyle'. | |
Protected Attributes | |
| std::vector< NCTableCol * > | _cells |
| owned | |
| unsigned | _state |
| Or'ed STATE flags. | |
| int | _index |
| unique index to identify this line | |
| YItem * | _yitem |
| not owned | |
| bool | _nested |
| using nested (tree-like) items? | |
| int | _treeLevel |
| NCTableLine * | _parent |
| NCTableLine * | _nextSibling |
| NCTableLine * | _firstChild |
| STATE | _vstate |
| chtype * | _prefix |
| std::string | _prefixPlaceholder |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const NCTableLine &obj) |
One line in a NCTable with multiple cells and an optional tree hierarchy.
Each line corresponds to a YItem subclass (YTableItem or YTreeItem).
This class is also the base class for NCTreeLine; it provides most its functionlity.
Notice that on the libyui level, the inheritance hierarchy is
YTableItem < YTreeItem < YItem
whereas on the libyui-ncurses level, it is
NCTreeLine < NCTableLine
i.e. it's just the other way round. This is why it is safer to do dynamic casts of the internal _yitem to YTreeItem rather than to YTableItem: If used from an NCTree (i.e. YTree) widget, the items will all be YTreeItems; a dynamic cast to YTableItem will fail.
NOTE: "col", "column", here refer to only one cell, not the entire table column.
See also https://github.com/libyui/libyui-ncurses/blob/master/doc/nctable-and-nctree.md
Definition at line 67 of file NCTableItem.h.
| NCTableLine::NCTableLine | ( | std::vector< NCTableCol * > & | cells, |
| int | index = -1, |
||
| bool | nested = false, |
||
| unsigned | state = S_NORMAL |
||
| ) |
Constructor: Create an NCTableLine and fill it with 'cells'.
This object takes over ownership of those cells and will delete it when appropriate.
'index' is a unique number with which to identify this line.
'nested' specifies whether any item in the table has any child items, i.e. whether line graphics to visualize the tree structure should be drawn.
'state' is an OR'ed combination of the STATE enum.
Definition at line 40 of file NCTableItem.cc.

|
inline |
Append one cell.
Ownership is transferred to this line.
Definition at line 168 of file NCTableItem.h.

|
inlinevirtual |
Change a line that may have been invisible until now to be visible.
Return 'true' if there was a status change, i.e. if it was invisible before, 'false' otherwise.
This default implementation does nothing and always returns 'false'. Derived classes that can handle invisible items may want to overwrite this.
Reimplemented in NCTreeLine.
Definition at line 248 of file NCTableItem.h.
|
virtual |
| active | is the table cursor here |
Reimplemented in NCTableHead.
Definition at line 319 of file NCTableItem.cc.

| NCTableCol * NCTableLine::GetCol | ( | unsigned | idx | ) |
Return a non-const pointer for read/write operations to the column (the cell) with the specified index or 0 if there is no such cell.
This is the table cell counterpart to NCTablePad::ModifyLine(). This does not set any 'dirty' flag.
Definition at line 293 of file NCTableItem.cc.

|
inline |
Return a const pointer for read-only operatoins to the column (the cell) with the specified index or 0 if there is no such cell.
This is the table cell counterpart to NCTablePad::GetLine().
Definition at line 188 of file NCTableItem.h.

|
inline |
Return all columns (cells).
Ownership of the cells remains with this line; do not delete them!
Definition at line 163 of file NCTableItem.h.
|
virtual |
Handle keyboard input.
Return 'true' if the key event is handled, 'false' to propagate it up to the pad.
Reimplemented in NCTreeLine.
Definition at line 472 of file NCTableItem.cc.

|
inlinevirtual |
Return 'true' if this should be displayed as nested items, i.e.
with line graphics connecting tree items and their children. This needs to be set from the outside.
Definition at line 210 of file NCTableItem.h.
|
inlineprotected |
Return a placeholder for the prefix string for this line consisting of enough blanks for the tree hierarchy line graphics.
The real line graphics will be drawn over this in DrawAt().
Definition at line 357 of file NCTableItem.h.