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,
61 YUI_CHECK_PTR ( header );
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;
190 static YPropertySet propSet;
192 if ( propSet.isEmpty() )
207 propSet.add ( YProperty ( YUIProperty_Value, YOtherProperty ) );
208 propSet.add ( YProperty ( YUIProperty_CurrentItem, YOtherProperty ) );
209 propSet.add ( YProperty ( YUIProperty_SelectedItems, YOtherProperty ) );
210 propSet.add ( YProperty ( YUIProperty_Items, YOtherProperty ) );
211 propSet.add ( YProperty ( YUIProperty_Cell, YOtherProperty ) );
212 propSet.add ( YProperty ( YUIProperty_Item, YOtherProperty ) );
213 propSet.add ( YProperty ( YUIProperty_IconPath, YStringProperty ) );
214 propSet.add ( YProperty ( YUIProperty_MultiSelection, YBoolProperty,
true ) );
215 propSet.add ( YWidget::propertySet() );
226 if ( propertyName == YUIProperty_Value )
228 else if ( propertyName == YUIProperty_CurrentItem )
230 else if ( propertyName == YUIProperty_SelectedItems )
232 else if ( propertyName == YUIProperty_Items )
234 else if ( propertyName == YUIProperty_Cell )
236 else if ( propertyName == YUIProperty_Item )
238 else if ( propertyName == YUIProperty_IconPath )
239 setIconBasePath ( val.stringVal() );
242 return YWidget::setProperty ( propertyName, val );
253 if ( propertyName == YUIProperty_Value )
254 return YPropertyValue ( YOtherProperty );
255 else if ( propertyName == YUIProperty_CurrentItem )
256 return YPropertyValue ( YOtherProperty );
257 else if ( propertyName == YUIProperty_SelectedItems )
258 return YPropertyValue ( YOtherProperty );
259 else if ( propertyName == YUIProperty_Items )
260 return YPropertyValue ( YOtherProperty );
261 else if ( propertyName == YUIProperty_Cell )
262 return YPropertyValue ( YOtherProperty );
263 else if ( propertyName == YUIProperty_Item )
264 return YPropertyValue ( YOtherProperty );
265 else if ( propertyName == YUIProperty_IconPath )
266 return YPropertyValue ( iconBasePath() );
268 return YWidget::getProperty ( propertyName );
virtual void setKeepSorting(bool keepSorting)
Switch between sorting by item insertion order (keepSorting: true) or allowing the user to sort by an...
virtual const YPropertySet & propertySet()
Return this class's property set.
YCBTableItem * toCBYTableItem(YItem *item)
useful cast for bindings.
YMGA_CBTable(YWidget *parent, YTableHeader *header, YCBTableMode mode)
Constructor.
YCBTableMode tableMode()
returns the YCBTable checkbox position mode
virtual void setChangedItem(YCBTableItem *pItem)
When derived classes emit YWidgetEvent with reason ValueChanged they have to set which item is change...
int columns() const
Return the number of columns of this table.
YAlignmentType alignment(int column) const
Return the alignment for the specified column.
std::string header(int column) const
Return the header text for the specified column.
virtual void addItem(YItem *item_disown)
Add one item.
bool immediateMode() const
Deliver even more events than with notify() set.
YItem * YItemIteratorToYItem(YItemIterator iter)
useful cast for bindings.
virtual YItem * item(int index) const
From YSelectionWidget returns the item at index 'index' (from 0) or 0 if there is no such item...
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-...
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.
bool keepSorting() const
Return 'true' if the sort order is to be kept in item insertion order, i.e.
virtual ~YMGA_CBTable()
Destructor.
YItemIterator nextItem(YItemIterator currentIterator)
YSelectionWidget does not implement the increment of iterator and bindings seem not to work with iter...
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
virtual YCBTableItem * changedItem()
Return the item which value is changed (e.g.