30 #include <yui/YTable.h>
31 #include "NCPadWidget.h"
32 #include "NCTablePad.h"
33 #include "NCTableSort.h"
44 friend std::ostream & operator<<( std::ostream & str,
const NCTable & obj );
49 YTableHeader * tableHeader,
50 bool multiSelection =
false );
57 void setHeader(
const std::vector<std::string>& head );
63 std::vector<std::string>
getHeader()
const;
70 virtual void addItems(
const YItemCollection & itemCollection );
78 {
addItem( yitem, NCTableLine::S_NORMAL ); }
89 virtual void addItem( YItem * yitem,
90 NCTableLine::STATE state );
140 virtual void selectItem( YItem *yitem,
bool selected );
186 virtual void setSize(
int newWidth,
int newHeight );
194 virtual void setLabel(
const std::string & nlabel );
211 return YWidget::setKeyboardFocus();
227 {
myPad()->SetSepChar( colSepchar ); }
234 {
myPad()->SetSepWidth( sepwidth ); }
241 {
myPad()->SetHotCol( hcol ); }
276 virtual const char *
location()
const {
return "NCTable"; }
302 virtual void addItem( YItem * yitem,
304 NCTableLine::STATE state = NCTableLine::S_NORMAL );
324 NCTableLine::STATE state = NCTableLine::S_NORMAL );
351 bool hasNestedItems(
const YItemCollection & itemCollection )
const;
354 YItemConstIterator end )
const;
386 void setCell(
int index,
int col,
const std::string & newText );
404 YItemConstIterator end );
425 void sortItems(
int sortCol,
bool reverse =
false );
460 std::ostream & operator<<( std::ostream & stream,
const YItem * item );
A string with an optional hot key.
virtual NCTablePad * myPad() const
Return the TreePad that belongs to this widget.
void stripHotkeys()
Remove all hotkeys from the pad.
void selectCurrentItem()
Select the current item (the item under the cursor).
void sortItems(int sortCol, bool reverse=false)
Sort the items by column no.
virtual const char * location() const
Code location for logging.
void setSortStrategy(NCTableSortStrategyBase *newStrategy)
Set a sorting strategy.
virtual NCPad * CreatePad()
Create an empty pad and set its background.
virtual void scrollToFirstItem()
Scroll to the first item.
virtual void addPadLine(NCTableLine *parentLine, YItem *yitem, bool preventRedraw, NCTableLine::STATE state=NCTableLine::S_NORMAL)
Add a pad line (an NCTableLine) for 'yitem' and recurse into any of its children (and grandchildren e...
virtual void addItems(const YItemCollection &itemCollection)
Add items.
virtual int getCurrentIndex() const
Get the index of the current item (the item under the cursor) or -1 if there is none.
void assignIndex(YItemConstIterator begin, YItemConstIterator end)
Recursively iterate over items and assign each one a unique item index.
std::vector< std::string > getHeader() const
Get the table headers (the first line inside the table) as strings.
Support classes for sorting by column in a table for use in an NCTablePad.
virtual void selectItem(YItem *yitem, bool selected)
Select or deselect an item.
virtual void startMultipleChanges()
Optimization for NCurses from libyui: Notification that multiple changes are about to come.
virtual int preferredHeight()
libyui geometry management: Return the preferred height for this widget.
NCstring alignmentStr(int col)
Return the NCurses alignment string for the alignment of the specified column: One of "L",...
virtual void deleteAllItems()
Delete all items and clear the pad.
A table with rows and columns.
void SetSepWidth(const unsigned sepwidth)
Set the separator width.
YItem * getCurrentItemPointer()
Return a pointer to the current item (the item under the cursor) or 0 if there is none,...
void setHeader(const std::vector< std::string > &head)
Set the table header (the first line inside the table) as strings.
void interactiveSort()
Interactive sorting by a user-selected column:
virtual int getCurrentItem() const
Get the index of the current item (the item under the cursor) or -1 if there is none,...
virtual void setSize(int newWidth, int newHeight)
libyui geometry management: Apply the width and height assigned from the parent layout widget.
bool bigList() const
Flag: Is this a big list?
A virtual window with a real viewport (which is NCursesWindow) and a scrolling mechanism.
virtual void setEnabled(bool do_bv)
Enable or disable this widget.
void rebuildPadLines()
Build or rebuild the pad lines: Clear the pad, iterate over all YItems and add a corresponding NCTabl...
void toggleCurrentItem()
Toggle the current item between selected and not selected.
void rebuildHeaderLine()
Rebuild the table header line.
void SetHotCol(int hcol)
Set the hotkey column (?).
void SetSepChar(const chtype colSepchar)
Set the column separator character.
virtual void setLabel(const std::string &nlabel)
Set the label (the caption) above the table.
void cellChanged(const YTableCell *cell)
Notification that a cell has now changed content: Set that cell's content also in the corresponding t...
void setBigList(bool big)
Set the "big list" flag.
virtual bool setKeyboardFocus()
Set the keyboard focus to this widget.
One line in a NCTable with multiple cells and an optional tree hierarchy.
virtual void setCurrentItem(int index)
Set the current item to the specified index.
NCTableSortStrategyBase * sortStrategy() const
Return the current sorting strategy.
void sortYItems(YItemIterator begin, YItemIterator end)
Sort the YItems between 'begin' and 'end' using the current sort strategy.
bool hasNestedItems(const YItemCollection &itemCollection) const
Return 'true' if any item in the item collection has any children, 'false' otherwise.
void assignIndex(YItem *item)
Assign an item a unique index.
void setCell(int index, int col, const std::string &newText)
Change the cell with item index 'index' and column no.
virtual void addItem(YItem *yitem)
Add one item.
bool setItemByKey(int key)
Select an item by its hotkey.
virtual void deselectAllItems()
Deselect all items.
virtual void doneMultipleChanges()
Optimization for NCurses from libyui: Notification that multiple changes are now finished.
virtual int preferredWidth()
libyui geometry management: Return the preferred width for this widget.
virtual NCursesEvent wHandleInput(wint_t key)
Keyboard input handler.