26 #ifndef NCTablePadBase_h
27 #define NCTablePadBase_h
31 #include "NCTableItem.h"
60 friend std::ostream & operator<<( std::ostream & str,
const NCTablePadBase & obj );
78 virtual void wRecoded();
91 bool SetHeadline(
const std::vector<NCstring> & head );
93 virtual void SendHead()
95 SetHead( _headpad,
srect.Pos.C );
99 void SetSepChar(
const chtype colSepchar )
101 _itemStyle.SetSepChar( colSepchar );
104 void SetSepWidth(
const unsigned sepwidth )
109 void SetHotCol(
int hcol )
111 _itemStyle.SetHotCol( hcol );
117 unsigned Cols()
const {
return _itemStyle.Cols(); }
124 bool empty()
const {
return _items.empty(); }
126 unsigned HotCol()
const {
return _itemStyle.HotCol(); }
133 void SetLines( std::vector<NCTableLine*> & newItems );
152 void Append( std::vector<NCTableCol*> & cells,
int index )
200 NCTableLine * getLineWithIndex(
unsigned idx )
const;
205 virtual wsze UpdateFormat();
299 #endif // NCTablePadBase_h
static int lines()
Number of lines on terminal, not window.
Screen dimension (screen size) in the order height, width: (H, W)
void ClearTable()
Clear all content.
One cell in an NCTableLine with a label and a cell-specific style.
int findIndex(unsigned idx) const
Find the item with index 'idx' in the items and return its position.
NCTableLine * GetCurrentLine() const
Return the current line (the line at the cursor position) or 0 if there is none.
void SetLines(unsigned count)
Expand or shrink to have exactly count logical lines.
void updateVisibleItems()
Update the internal _visibleItems vector with the items that are currently visible: Clear the old con...
int currentColNo() const
Return the current column number (the cursor position).
unsigned Lines() const
Return the number of table lines (logical, not screen)
void Append(NCTableLine *item)
Add one item to the end of _items.
static int cols()
Number of cols on terminal, not window.
virtual wpos CurPos() const
CurPos().L is the index of the selected item.
virtual void prepareRedraw()
Prepare a redraw: Update the format if needed, set the background, clear the old content.
virtual void drawHeader()
Redraw the table header.
bool _dirtyFormat
does table format (size) need recalculating?
NCTableLine * ModifyLine(unsigned idx)
Return line at idx for read-write operations and mark it as modified.
unsigned visibleLines() const
Return the number of lines that are currently visible.
virtual int setpos(const wpos &newPos)
Base function for scrolling: Move the cursor position to 'newPos' and redraw the old and the new curr...
void assertLine(unsigned index)
Ensure that a line with the specified index exists.
const NCTableLine * GetLine(unsigned idx) const
Return the line at idx for read-only operations.
int currentLineNo() const
Return the current line number (the cursor position).
wpos _citem
current/cursor position
void setCurrentColNo(int newVal)
Set the current column number (the cursor position).
std::vector< NCTableLine * > _visibleItems
not owned
A virtual window with a real viewport (which is NCursesWindow) and a scrolling mechanism.
virtual void drawContentLines()
Redraw the (visible) content lines one by one.
Screen position pair in the order line, column: (L, C)
virtual bool currentItemHandleInput(wint_t key)
Call the current item's handleInput() method and return 'true' if the event is now handled,...
virtual bool handleInput(wint_t key)
Handle a keyboard input event.
std::vector< NCTableLine * > _items
(owned)
One line in a NCTable with multiple cells and an optional tree hierarchy.
void SetSepWidth(const unsigned sepWidth)
total width of space between adjacent columns, including the separator character
Styling for a NCTable: column widths, alignment and colors.
static long count
count of all active windows
virtual int DoRedraw()
Redraw the pad.
NCTablePadBase(int lines, int cols, const NCWidget &p)
Constructor.
An NCPad for an NCTable or an NCTree.
unsigned Cols() const
Return the number of table columns (logical, not screen)
void setCurrentLineNo(int newVal)
Set the current line number (the cursor position).
void Append(std::vector< NCTableCol * > &cells, int index)
Create a new item from 'cells' and add it to the end of _items.
wrect srect
Source rectangle: the visible part of this pad.
void AddLine(unsigned idx, NCTableLine *item)
Add item at position idx, expanding if needed.