25 #define MIN_DEBUG_LABEL_LEN 20
26 #define MAX_DEBUG_LABEL_LEN 40
29 #define YUILogComponent "ui"
33 #include "YUIException.h"
54 const string & label_1,
55 const string & label_2,
56 const string & label_3,
57 const string & label_4,
58 const string & label_5,
59 const string & label_6,
60 const string & label_7,
61 const string & label_8,
62 const string & label_9 )
79 const string & label_0,
80 const string & label_1,
81 const string & label_2,
82 const string & label_3,
83 const string & label_4,
84 const string & label_5,
85 const string & label_6,
86 const string & label_7,
87 const string & label_8,
88 const string & label_9 )
129 YUI_CHECK_PTR(
cell );
130 _cells.push_back(
cell );
138 const string & iconName,
139 const string & sortKey )
142 YUI_CHECK_NEW(
cell );
150 const std::string & label_1,
151 const std::string & label_2,
152 const std::string & label_3,
153 const std::string & label_4,
154 const std::string & label_5,
155 const std::string & label_6,
156 const std::string & label_7,
157 const std::string & label_8,
158 const std::string & label_9 )
160 std::vector<string> labels;
162 labels.push_back( label_0 );
163 labels.push_back( label_1 );
164 labels.push_back( label_2 );
165 labels.push_back( label_3 );
166 labels.push_back( label_4 );
167 labels.push_back( label_5 );
168 labels.push_back( label_6 );
169 labels.push_back( label_7 );
170 labels.push_back( label_8 );
171 labels.push_back( label_9 );
177 unsigned lastLabel = labels.size() - 1;
179 while ( labels[ lastLabel ].empty() && --lastLabel > 0 )
186 for (
unsigned i = 0; i <= lastLabel; ++i )
196 return index >= 0 && (unsigned)
index < _cells.size();
240 if ( _cells.empty() )
245 for (
unsigned i=0; i < _cells.size(); ++i )
252 if ( txt.size() > MIN_DEBUG_LABEL_LEN )
267 if ( _parent && _parent !=
parent && _column !=
column )
268 YUI_THROW(
YUIException(
string(
"Cannot reparent YTableCell \"" )
270 +
"to different parent." ) );
Item class for tree items.
YTableCellIterator cellsBegin()
Return an iterator that points to the first cell of this item.
int index() const
Return the index of this item (as set with setIndex() ).
std::string iconName(int index) const
Return the icon name of cell no.
YTableItem * parent() const
Return this cell's parent item or 0 if it doesn't have one yet.
virtual std::string debugLabel() const
Return a descriptive label of this item instance for debugging.
std::string label() const
Just for debugging.
int column() const
Return this cell's column no.
void reparent(YTableItem *parent, int column)
Set this cell's parent item and column no.
Item class for YTable items.
void deleteCells()
Delete all cells.
YTableCellIterator cellsEnd()
Return an iterator that points after the last cell of this item.
YTableItem()
Default constructor.
YTableCellCollection::iterator YTableCellIterator
Mutable iterator over YTableCellCollection.
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())
Add up to 10 cells without any icons.
const YTableCell * cell(int index) const
Return the cell at the specified index (counting from 0 on) or 0 if there is none.
std::string limitLength(const std::string &text, int limit) const
Return a string of maximum 'limit' characters.
virtual ~YTableItem()
Destructor.
bool hasIconName(int index) const
Return 'true' if there is a cell with the specified index that has an icon name.
void addCell(YTableCell *cell_disown)
Add a cell.
One cell (one column in one row) of a YTableItem.
bool hasCell(int index) const
Return 'true' if this item has a cell with the specified index (counting from 0 on),...
Base class for UI Exceptions.