26 #include "YUIException.h" 37 const std::string & label_1,
38 const std::string & label_2,
39 const std::string & label_3,
40 const std::string & label_4,
41 const std::string & label_5,
42 const std::string & label_6,
43 const std::string & label_7,
44 const std::string & label_8,
45 const std::string & label_9 )
48 std::vector<std::string> labels;
50 labels.push_back( label_0 );
51 labels.push_back( label_1 );
52 labels.push_back( label_2 );
53 labels.push_back( label_3 );
54 labels.push_back( label_4 );
55 labels.push_back( label_5 );
56 labels.push_back( label_6 );
57 labels.push_back( label_7 );
58 labels.push_back( label_8 );
59 labels.push_back( label_9 );
65 unsigned lastLabel = labels.size() - 1;
67 while ( labels[ lastLabel ].empty() && --lastLabel > 0 )
74 for (
unsigned i = 0; i <= lastLabel; ++i )
107 YUI_CHECK_PTR( cell );
108 _cells.push_back( cell );
110 cell->
reparent(
this, _cells.size() - 1 );
118 YUI_CHECK_NEW( cell );
127 return index >= 0 && (unsigned) index < _cells.size();
150 return hasCell( index ) ? _cells[
index ]->label() :
"";
157 return hasCell( index ) ? _cells[
index ]->iconName() :
"";
164 return hasCell( index ) ? _cells[
index ]->hasIconName() :
false;
173 YUI_CHECK_PTR( parent );
175 if ( _parent && _parent != parent && _column != column )
176 YUI_THROW(
YUIException( std::string(
"Cannot reparent YTableCell \"" )
178 +
"to different parent." ) );
std::string label() const
Just for debugging.
void deleteCells()
Delete all cells.
std::string iconName(int index) const
Return the icon name of cell no.
void addCell(YTableCell *cell_disown)
Add a cell.
bool hasCell(int index) const
Return 'true' if this item has a cell with the specified index (counting from 0 on), 'false' otherwise.
const YTableCell * cell(int index) const
Return the cell at the specified index (counting from 0 on) or 0 if there is none.
virtual ~YTableItem()
Destructor.
One cell (one column in one row) of a YTableItem.
int index() const
Return the index of this item (as set with setIndex() ).
YTableCellCollection::iterator YTableCellIterator
Mutable iterator over YTableCellCollection.
virtual YItem * parent() const
Returns this item's parent item or 0 if it is a toplevel item.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
bool hasIconName(int index) const
Return 'true' if there is a cell with the specified index that has an icon name.
YTableCellIterator cellsEnd()
Return an iterator that points after the last cell of this item.
void reparent(YTableItem *parent, int column)
Set this cell's parent item and column no.
Item class for YTable items.
YTableItem()
Default constructor.
Base class for UI Exceptions.
YTableCellIterator cellsBegin()
Return an iterator that points to the first cell of this item.