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

#include <YTableItem.h>

Public Member Functions

 YTableCell (const std::string &label, const std::string &iconName="", const std::string &sortKey="")
 
 YTableCell (YTableItem *parent, int column, const std::string &label, const std::string &iconName="", const std::string &sortKey="")
 
virtual ~YTableCell ()
 
std::string label () const
 
void setLabel (const std::string &newLabel)
 
std::string iconName () const
 
bool hasIconName () const
 
void setIconName (const std::string &newIconName)
 
std::string sortKey () const
 
bool hasSortKey () const
 
void setSortKey (const std::string &newSortKey)
 
YTableItemparent () const
 
int column () const
 
int itemIndex () const
 
void reparent (YTableItem *parent, int column)
 

Detailed Description

One cell (one column in one row) of a YTableItem. Each cell has a label (a user visible text), optionally an icon (*) and also optionally a sort-key.

Note that cells don't have individual IDs; they have just an index. The first cell in an item is cell(0). In an ideal world, each YTableItem would have exactly as many cells as there are columns in the YTable, but these classes make no such assumptions. A YTableItem might have any number of cells, including none.

The YTable widget is free to ignore any excess cells if there are more than the YTable widget has columns. If there are less cells than the table has columns, the nonexistent cells will be treated as empty.

(*) Not all UIs can handle icons. UIs that can't handle them will simply ignore any icons specified for YTableCells. Thus, applications should either check the UI capabilities if it can handle icons or use icons only as an additional visual cue that still has a text counterpart (so the user can still make sense of the table content when no icons are visible).

Constructor & Destructor Documentation

◆ YTableCell() [1/2]

YTableCell::YTableCell ( const std::string & label,
const std::string & iconName = "",
const std::string & sortKey = "" )
inline

Constructor with label and optional icon name and optional sort key for cells that don't have a parent item yet (that will be added to a parent later with setParent()).

◆ YTableCell() [2/2]

YTableCell::YTableCell ( YTableItem * parent,
int column,
const std::string & label,
const std::string & iconName = "",
const std::string & sortKey = "" )
inline

Constructor with parent, column no., label and optional icon name for cells that are created with a parent.

◆ ~YTableCell()

virtual YTableCell::~YTableCell ( )
inlinevirtual

Destructor. Not strictly needed inside this class, but useful for derived classes. Since this is the only virtual method of this class, the cost of this is a vtable for this class and a pointer to the vtable in each instance.

Member Function Documentation

◆ column()

int YTableCell::column ( ) const
inline

Return this cell's column no. (counting from 0on) or -1 if it doesn't have a parent yet.

◆ hasIconName()

bool YTableCell::hasIconName ( ) const
inline

Return 'true' if this cell has an icon name.

◆ hasSortKey()

bool YTableCell::hasSortKey ( ) const
inline

Return 'true' if this cell has a sort key.

◆ iconName()

std::string YTableCell::iconName ( ) const
inline

Return this cell's icon name.

◆ itemIndex()

int YTableCell::itemIndex ( ) const
inline

Convenience function: Return this cell's parent item's index within its table widget or -1 if there is no parent item or no parent table.

◆ label()

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

Return this cells's label. This is what the user sees in a dialog, so this will usually be a translated text.

◆ parent()

YTableItem * YTableCell::parent ( ) const
inline

Return this cell's parent item or 0 if it doesn't have one yet.

◆ reparent()

void YTableCell::reparent ( YTableItem * parent,
int column )

Set this cell's parent item and column no. if it doesn't have a parent yet.

This method will throw an exception if the cell already has a parent.

◆ setIconName()

void YTableCell::setIconName ( const std::string & newIconName)
inline

Set this cell's icon name.

If this is called after the corresponding table item (table row) is added to the table widget, call YTable::cellChanged() to notify the table widget about the fact. Only then will the display be updated.

◆ setLabel()

void YTableCell::setLabel ( const std::string & newLabel)
inline

Set this cell's label.

If this is called after the corresponding table item (table row) is added to the table widget, call YTable::cellChanged() to notify the table widget about the fact. Only then will the display be updated.

◆ setSortKey()

void YTableCell::setSortKey ( const std::string & newSortKey)
inline

Set this cell's sort key.

If this is called after the corresponding table item (table row) is added to the table widget, call YTable::cellChanged() to notify the table widget about the fact. Only then will the display be updated.

◆ sortKey()

std::string YTableCell::sortKey ( ) const
inline

Return this cell's sort key.


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