libyui
 
Loading...
Searching...
No Matches
YTableItem Class Reference

#include <YTableItem.h>

Inheritance diagram for YTableItem:
Collaboration diagram for YTableItem:

Public Member Functions

 YTableItem ()
 
 YTableItem (YTableItem *parent, bool isOpen=false)
 
 YTableItem (const std::string &label_0, const std::string &label_1=std::string(), const std::string &label_2=std::string(), const std::string &label_3=std::string(), const std::string &label_4=std::string(), const std::string &label_5=std::string(), const std::string &label_6=std::string(), const std::string &label_7=std::string(), const std::string &label_8=std::string(), const std::string &label_9=std::string())
 
 YTableItem (YTableItem *parent, const std::string &label_0, const std::string &label_1=std::string(), const std::string &label_2=std::string(), const std::string &label_3=std::string(), const std::string &label_4=std::string(), const std::string &label_5=std::string(), const std::string &label_6=std::string(), const std::string &label_7=std::string(), const std::string &label_8=std::string(), const std::string &label_9=std::string())
 
virtual ~YTableItem ()
 
virtual const char * itemClass () const
 
void addCell (YTableCell *cell_disown)
 
void addCell (const std::string &label, const std::string &iconName=std::string(), const std::string &sortKey=std::string())
 
void addCells (const std::string &label_0, const std::string &label_1, const std::string &label_2=std::string(), const std::string &label_3=std::string(), const std::string &label_4=std::string(), const std::string &label_5=std::string(), const std::string &label_6=std::string(), const std::string &label_7=std::string(), const std::string &label_8=std::string(), const std::string &label_9=std::string())
 
void deleteCells ()
 
YTableCellIterator cellsBegin ()
 
YTableCellConstIterator cellsBegin () const
 
YTableCellIterator cellsEnd ()
 
YTableCellConstIterator cellsEnd () const
 
const YTableCellcell (int index) const
 
YTableCellcell (int index)
 
int cellCount () const
 
bool hasCell (int index) const
 
std::string label (int index) const
 
std::string iconName (int index) const
 
bool hasIconName (int index) const
 
std::string label () const
 
virtual std::string debugLabel () const
 
- Public Member Functions inherited from YTreeItem
 YTreeItem (const std::string &label, bool isOpen=false)
 
 YTreeItem (const std::string &label, const std::string &iconName, bool isOpen=false)
 
 YTreeItem (YTreeItem *parent, const std::string &label, bool isOpen=false)
 
 YTreeItem (YTreeItem *parent, const std::string &label, const std::string &iconName, bool isOpen=false)
 
virtual ~YTreeItem ()
 
virtual bool hasChildren () const
 
virtual YItemIterator childrenBegin ()
 
virtual YItemConstIterator childrenBegin () const
 
virtual YItemIterator childrenEnd ()
 
virtual YItemConstIterator childrenEnd () const
 
virtual void addChild (YItem *item_disown)
 
virtual void deleteChildren ()
 
bool isOpen () const
 
void setOpen (bool open=true)
 
void setClosed ()
 
virtual YTreeItemparent () const
 
- Public Member Functions inherited from YItem
 YItem (const std::string &label, bool selected=false)
 
 YItem (const std::string &label, const std::string &iconName, bool selected=false)
 
virtual ~YItem ()
 
std::string label () const
 
void setLabel (const std::string &newLabel)
 
std::string iconName () const
 
bool hasIconName () const
 
void setIconName (const std::string &newIconName)
 
bool selected () const
 
void setSelected (bool sel=true)
 
int status () const
 
void setStatus (int newStatus)
 
void setIndex (int index)
 
int index () const
 
void setData (void *newData)
 
void * data () const
 
std::string limitLength (const std::string &text, int limit) const
 

Detailed Description

Item class for YTable items. Each YTableItem corresponds to one row in a YTable.

A YTableItem might have any number of cells (columns within this row), including none. The YTable widget is free to ignore any excess cells if there are more than the YTable widget has columns. The YTable widget is to treat nonexistent cells like empty ones.

Note that while YTable items and their cells can be manipulated through pointers, their visual representation on screen might be updated only upon calling certain methods of the YTable widget. See the YTable reference for details.

Constructor & Destructor Documentation

◆ YTableItem() [1/4]

YTableItem::YTableItem ( )

Default constructor. Use addCell() to give it any content.

◆ YTableItem() [2/4]

YTableItem::YTableItem ( YTableItem * parent,
bool isOpen = false )

Constructor for a nested table item, i.e. one with a parent item.

◆ YTableItem() [3/4]

YTableItem::YTableItem ( const std::string & label_0,
const std::string & label_1 = std::string(),
const std::string & label_2 = std::string(),
const std::string & label_3 = std::string(),
const std::string & label_4 = std::string(),
const std::string & label_5 = std::string(),
const std::string & label_6 = std::string(),
const std::string & label_7 = std::string(),
const std::string & label_8 = std::string(),
const std::string & label_9 = std::string() )

Convenience constructor for a (toplevel) table item without any icons.

This will create up to 10 (0..9) cells. Empty cells for empty labels at the end of the labels are not created, but empty cells in between are.

new YTableItem( "one", "two", "", "", "five" );

will create an item with 5 cells:

cell[0] ==> "one"
cell[1] ==> "two"
cell[2] ==> ""
cell[3] ==> ""
cell[4] ==> "five"

◆ YTableItem() [4/4]

YTableItem::YTableItem ( YTableItem * parent,
const std::string & label_0,
const std::string & label_1 = std::string(),
const std::string & label_2 = std::string(),
const std::string & label_3 = std::string(),
const std::string & label_4 = std::string(),
const std::string & label_5 = std::string(),
const std::string & label_6 = std::string(),
const std::string & label_7 = std::string(),
const std::string & label_8 = std::string(),
const std::string & label_9 = std::string() )

Convenience constructor for a nested table item without any icons.

◆ ~YTableItem()

YTableItem::~YTableItem ( )
virtual

Destructor.

This will delete all cells.

Member Function Documentation

◆ addCell() [1/2]

void YTableItem::addCell ( const std::string & label,
const std::string & iconName = std::string(),
const std::string & sortKey = std::string() )

Create a new cell and add it (even if all 'label', 'iconName' and 'sortKey' are empty).

◆ addCell() [2/2]

void YTableItem::addCell ( YTableCell * cell_disown)

Add a cell. This item will assume ownership over the cell and delete it when appropriate (when the table is destroyed or when table items are replaced), at which time the pointer will become invalid.

Cells can still be changed after they (and the item they belong to) are added, but in that case, YTable::cellChanged() needs to be called to update the table display accordingly.

◆ addCells()

void YTableItem::addCells ( const std::string & label_0,
const std::string & label_1,
const std::string & label_2 = std::string(),
const std::string & label_3 = std::string(),
const std::string & label_4 = std::string(),
const std::string & label_5 = std::string(),
const std::string & label_6 = std::string(),
const std::string & label_7 = std::string(),
const std::string & label_8 = std::string(),
const std::string & label_9 = std::string() )

Add up to 10 cells without any icons.

◆ cell()

const YTableCell * YTableItem::cell ( int index) const

Return the cell at the specified index (counting from 0 on) or 0 if there is none.

◆ cellCount()

int YTableItem::cellCount ( ) const
inline

Return the number of cells this item has.

◆ cellsBegin()

YTableCellIterator YTableItem::cellsBegin ( )
inline

Return an iterator that points to the first cell of this item.

◆ cellsEnd()

YTableCellIterator YTableItem::cellsEnd ( )
inline

Return an iterator that points after the last cell of this item.

◆ debugLabel()

string YTableItem::debugLabel ( ) const
virtual

Return a descriptive label of this item instance for debugging. This might be truncated if the original label is too long.

Reimplemented from YItem.

◆ deleteCells()

void YTableItem::deleteCells ( )

Delete all cells.

◆ hasCell()

bool YTableItem::hasCell ( int index) const

Return 'true' if this item has a cell with the specified index (counting from 0 on), 'false' otherwise.

◆ hasIconName()

bool YTableItem::hasIconName ( int index) const

Return 'true' if there is a cell with the specified index that has an icon name.

◆ iconName()

string YTableItem::iconName ( int index) const

Return the icon name of cell no. 'index' (counting from 0 on) or an empty string if there is no cell with that index.

◆ itemClass()

virtual const char * YTableItem::itemClass ( ) const
inlinevirtual

Returns a descriptive name of this widget class for logging, debugging etc.

Reimplemented from YTreeItem.

◆ label() [1/2]

std::string YTableItem::label ( ) const
inline

Just for debugging.

◆ label() [2/2]

string YTableItem::label ( int index) const

Return the label of cell no. 'index' (counting from 0 on) or an empty string if there is no cell with that index.


The documentation for this class was generated from the following files: