27 #define YUILogComponent "mga-ui"
30 #include "YUISymbols.h"
31 #include "YMGA_CBTable.h"
37 , keepSorting (
false )
38 , immediateMode (
false )
39 , mode ( YCBTableCheckBoxOnFirstColumn )
56 :YSelectionWidget ( parent,
62 YUI_CHECK_NEW ( priv );
66 setDefaultStretchable ( YD_HORIZ,
true );
67 setDefaultStretchable ( YD_VERT,
true );
94 YUI_CHECK_PTR (
item );
96 YSelectionWidget::addItem (
item );
101 YUI_CHECK_PTR ( newHeader );
103 if ( priv->header->columns() != newHeader->columns() )
107 priv->header = newHeader;
113 return priv->header->columns();
119 return priv->header->hasColumn ( column );
125 return priv->header->header ( column );
131 return priv->header->alignment ( column );
137 return priv->immediateMode;
152 return priv->keepSorting;
164 return ! YSelectionWidget::enforceSingleSelection();
170 return YSelectionWidget::itemAt ( index );
175 return ++currentIterator;
181 YSelectionWidget::deleteAllItems();
197 static YPropertySet propSet;
199 if ( propSet.isEmpty() )
214 propSet.add ( YProperty ( YUIProperty_Value, YOtherProperty ) );
215 propSet.add ( YProperty ( YUIProperty_CurrentItem, YOtherProperty ) );
216 propSet.add ( YProperty ( YUIProperty_SelectedItems, YOtherProperty ) );
217 propSet.add ( YProperty ( YUIProperty_Items, YOtherProperty ) );
218 propSet.add ( YProperty ( YUIProperty_Cell, YOtherProperty ) );
219 propSet.add ( YProperty ( YUIProperty_Item, YOtherProperty ) );
220 propSet.add ( YProperty ( YUIProperty_IconPath, YStringProperty ) );
221 propSet.add ( YProperty ( YUIProperty_MultiSelection, YBoolProperty,
true ) );
222 propSet.add ( YWidget::propertySet() );
233 if ( propertyName == YUIProperty_Value )
235 else if ( propertyName == YUIProperty_CurrentItem )
237 else if ( propertyName == YUIProperty_SelectedItems )
239 else if ( propertyName == YUIProperty_Items )
241 else if ( propertyName == YUIProperty_Cell )
243 else if ( propertyName == YUIProperty_Item )
245 else if ( propertyName == YUIProperty_IconPath )
246 setIconBasePath ( val.stringVal() );
249 return YWidget::setProperty ( propertyName, val );
260 if ( propertyName == YUIProperty_Value )
261 return YPropertyValue ( YOtherProperty );
262 else if ( propertyName == YUIProperty_CurrentItem )
263 return YPropertyValue ( YOtherProperty );
264 else if ( propertyName == YUIProperty_SelectedItems )
265 return YPropertyValue ( YOtherProperty );
266 else if ( propertyName == YUIProperty_Items )
267 return YPropertyValue ( YOtherProperty );
268 else if ( propertyName == YUIProperty_Cell )
269 return YPropertyValue ( YOtherProperty );
270 else if ( propertyName == YUIProperty_Item )
271 return YPropertyValue ( YOtherProperty );
272 else if ( propertyName == YUIProperty_IconPath )
273 return YPropertyValue ( iconBasePath() );
275 return YWidget::getProperty ( propertyName );
virtual ~YMGA_CBTable()
Destructor.
YCBTableMode tableMode()
returns the YCBTable checkbox position mode
YItem * YItemIteratorToYItem(YItemIterator iter)
useful cast for bindings.
YItemIterator nextItem(YItemIterator currentIterator)
YSelectionWidget does not implement the increment of iterator and bindings seem not to work with iter...
YCBTableItem * toCBYTableItem(YItem *item)
useful cast for bindings.
virtual const YPropertySet & propertySet()
Return this class's property set.
virtual void setChangedItem(YCBTableItem *pItem)
When derived classes emit YWidgetEvent with reason ValueChanged they have to set which item is change...
YMGA_CBTable(YWidget *parent, YTableHeader *header, YCBTableMode mode)
Constructor.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
virtual void addItem(YItem *item_disown)
Add one item.
int columns() const
Return the number of columns of this table.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
void setImmediateMode(bool immediateMode=true)
Set immediateMode() on or off.
bool hasMultiSelection() const
Return 'true' if the user can select multiple items at the same time (e.g., with shift-click or ctrl-...
YAlignmentType alignment(int column) const
Return the alignment for the specified column.
virtual void deleteAllItems()
Delete all items.
void setTableHeader(YTableHeader *newHeader)
Exchange the previous table header with a new one.
bool hasColumn(int column) const
Return 'true' if this table has a column no.
virtual YCBTableItem * changedItem()
Return the item which value is changed (e.g.
virtual void setKeepSorting(bool keepSorting)
Switch between sorting by item insertion order (keepSorting: true) or allowing the user to sort by an...
virtual YItem * item(int index) const
From YSelectionWidget returns the item at index 'index' (from 0) or 0 if there is no such item.
bool immediateMode() const
Deliver even more events than with notify() set.
std::string header(int column) const
Return the header text for the specified column.
bool keepSorting() const
Return 'true' if the sort order is to be kept in item insertion order, i.e.