MeVisLabToolboxReference
|
Abstract module class ListContainerBase implementing basic functionality for a list container module. More...
#include <mlListContainer.h>
Public Types | |
enum | OverflowModes { OvwNone = 0, OvwRemoveFirst, OvwRemoveLast, OvwRemoveAll, OvwRemoveNew, OvwNumModes } |
Mode constants for cases of list size overflow. More... | |
Public Member Functions | |
ListContainerBase () | |
Constructor. | |
ListContainerBase (ListBase *listBasePtr, int inputNum, int outputNum) | |
Constructor In listBasePtr pass a pointer to the list object, which has to be a member of the derived class. | |
void | setHandleNotificationCB (ListContainerHandleNotificationCB *cb=NULL, void *userData=NULL) |
Set the callback for handleNotification. | |
BaseField * | getOutputField () |
Returns a pointer to the output field. | |
MLint | maxNumItems () const |
int | overflowMode () const |
Returns the overflow mode. | |
Host communication | |
virtual void | handleNotification (Field *field) |
Handle field notifications. | |
virtual void | activateAttachments () |
Update fields after an initialization without handleNotification() called. | |
virtual void | beginSaveFields () |
Prepare for persistence. | |
virtual void | endSaveFields () |
Clean up after persistence. | |
Execute list operations | |
These methods are called to perform an operation on the list object, e.g. as a consequence of one of the action fields being pressed. They handle the necessary field updates as well as touching the output list and call deleteItems(), insertItem() and modifyItem() in order to carry out the list modifications themselves. A derived editor module may call these methods in order to perform a list operation. | |
virtual void | doDeleteAll () |
Delete all list items. | |
virtual void | doDeleteItem (MLssize_t index) |
Delete single item at position index. | |
virtual void | doInsertItem (MLssize_t index, bool fromCurrentItem) |
Insert an item at position index. | |
virtual void | doModifyItem (MLssize_t index, Field *field, bool fromCurrentItem) |
Modify item at position index. | |
virtual void | doCopyItemToTemplate (MLssize_t index) |
Copy values from item at position index to the template fields. | |
virtual void | doClearItem (MLssize_t index) |
Init item at position index. | |
virtual void | doSelectItem (MLssize_t index) |
Select item at position index, or deselect if item == -1. | |
virtual void | doUpdate () |
Update all fields and touch output list field. | |
Protected Member Functions | |
List object access | |
Most of these methods are overloaded by ListContainerTemplate, but do not have to be overloaded by further derived classes. | |
virtual ListBase * | getInternalList ()=0 |
Return address of internal list object. | |
virtual bool | setActiveList (Base *basePtr)=0 |
Set the active list (i.e. | |
virtual bool | ownsList () |
Return true if the active list is the internal list. | |
virtual MLssize_t | getId (MLssize_t index)=0 |
Return the item id of the item index. | |
Handle item property fields | |
Overload these methods for derived container modules with additional list item property fields. | |
virtual bool | isPropertyField (Field *field) |
Return true if field points to an item property field. | |
virtual void | resetPropertyFields () |
Reset all property fields. | |
virtual void | updatePropertyFields ()=0 |
Update property fields from the current list item. | |
List modifications | |
These methods are called when a list operation is performed. They are overloaded in ListContainerTemplate. The modifyItem() method has to be further overloaded for derived container modules with additional list item properties. | |
virtual void | deleteItems (MLssize_t index, MLssize_t num)=0 |
Remove num items, starting at item index. | |
virtual void | insertItem (MLssize_t index, bool fromCurrentItem)=0 |
Insert an item at position index. | |
virtual bool | modifyItem (MLssize_t index, Field *field, bool fromCurrentItem)=0 |
Modify item at position index. | |
virtual void | copyItemToTemplate (MLssize_t index)=0 |
Copy values from item at position index to the template fields. | |
virtual void | copyTemplateToCurrent ()=0 |
Copy the values of the templates fields to _currentItem. | |
virtual void | initItem (MLssize_t index)=0 |
Initialize the list item at position index. | |
Handle field updates | |
virtual void | updateListString (bool forceEnable=false) |
Update the list string representing the list content. | |
virtual void | updateDisplay () |
Update display of list size, current item index and item properties. | |
virtual void | updateActionFields () |
Update last action fields. | |
virtual void | touchList (ListBase::ActionClass actionClass, MLssize_t id, MLssize_t index) |
Set last list action and touch output list field. | |
Protected Attributes | |
int | _lockNotification |
Suppress handleNotification() if non-zero. | |
Field members | |
BaseField * | _fldOutputList |
Output list field, initialized by derived class. | |
BaseField * | _fldInputList |
Input list field, initialized by derived class. | |
StringField * | _fldListString |
String representation of list. | |
IntField * | _fldNumItems |
List size. | |
IntField * | _fldIndex |
Current list index. | |
BoolField * | _fldPersistent |
Activate internal list persistence. | |
BoolField * | _fldListStringEnable |
Enable list string field. | |
BoolField * | _fldOwnsList |
Reflect owner state (true if internal list is active) | |
BoolField * | _fldApplySelect |
Perform a Select-action when index is changed. | |
IntField * | _fldId |
List item id. | |
StringField * | _fldName |
List item name. | |
StringField * | _fldNewName |
List item name. | |
StringField * | _fldActionClass |
Action class of last action on list. | |
IntField * | _fldActionIndex |
Index of last action on list. | |
IntField * | _fldActionId |
Item id of last action on list. | |
IntField * | _fldCurrentIndex |
Index of currently selected item. | |
EnumField * | _fldOverflowMode |
Overflow mode, specifies which item(s) to delete on overflow. | |
IntField * | _fldMaxSize |
Maximum list size. | |
NotifyField * | _fldDelete |
Delete button. | |
NotifyField * | _fldDeleteAll |
Delete All button. | |
NotifyField * | _fldInsert |
Insert button. | |
NotifyField * | _fldAdd |
Add (= Append) button. | |
NotifyField * | _fldUpdate |
Update button. | |
BoolField * | _fldUseInsertTemplate |
If true the container should use the template fields for initializing the inserted item. | |
NotifyField * | _fldCopyItemToTemplate |
Copy values from current item to template fields. | |
NotifyField * | _fldCopyTemplateToItem |
Copy values from template fields to current item. | |
NotifyField * | _fldClearItem |
Clear the current item (i.e. init it again). | |
BoolField * | _fldUpToDate |
Indicates that the property values are up to date. |
Abstract module class ListContainerBase implementing basic functionality for a list container module.
Abstract ML module class implementing basic functionality for a list container module. List container modules for a specific list class are derived from this class using the class template ListContainerTemplate. This construct can only be used for list classes derived from BaseListTemplate.
ListContainerBase supports the following functionality:
Definition at line 76 of file mlListContainer.h.
Mode constants for cases of list size overflow.
Definition at line 159 of file mlListContainer.h.
ml::ListContainerBase::ListContainerBase | ( | ) | [inline] |
Constructor.
Definition at line 82 of file mlListContainer.h.
ml::ListContainerBase::ListContainerBase | ( | ListBase * | listBasePtr, |
int | inputNum, | ||
int | outputNum | ||
) |
Constructor In listBasePtr pass a pointer to the list object, which has to be a member of the derived class.
The values inputNum and outputNum specify the number of input and output image fields, resp.
virtual void ml::ListContainerBase::activateAttachments | ( | ) | [virtual] |
Update fields after an initialization without handleNotification() called.
Reimplemented from ml::FieldContainer.
virtual void ml::ListContainerBase::beginSaveFields | ( | ) | [virtual] |
Prepare for persistence.
Reimplemented from ml::Module.
virtual void ml::ListContainerBase::copyItemToTemplate | ( | MLssize_t | index | ) | [protected, pure virtual] |
Copy values from item at position index to the template fields.
Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual void ml::ListContainerBase::copyTemplateToCurrent | ( | ) | [protected, pure virtual] |
Copy the values of the templates fields to _currentItem.
Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual void ml::ListContainerBase::deleteItems | ( | MLssize_t | index, |
MLssize_t | num | ||
) | [protected, pure virtual] |
Remove num items, starting at item index.
Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual void ml::ListContainerBase::doClearItem | ( | MLssize_t | index | ) | [virtual] |
Init item at position index.
virtual void ml::ListContainerBase::doCopyItemToTemplate | ( | MLssize_t | index | ) | [virtual] |
Copy values from item at position index to the template fields.
virtual void ml::ListContainerBase::doDeleteAll | ( | ) | [virtual] |
Delete all list items.
virtual void ml::ListContainerBase::doDeleteItem | ( | MLssize_t | index | ) | [virtual] |
Delete single item at position index.
virtual void ml::ListContainerBase::doInsertItem | ( | MLssize_t | index, |
bool | fromCurrentItem | ||
) | [virtual] |
Insert an item at position index.
If fromCurrentItem is true, the new item is initialized from the _currentItem member of the derived ListContainerTemplate class.
virtual void ml::ListContainerBase::doModifyItem | ( | MLssize_t | index, |
Field * | field, | ||
bool | fromCurrentItem | ||
) | [virtual] |
Modify item at position index.
If fromCurrentItem is true, the item is copied from the _currentItem member of the derived ListContainerTemplate class, otherwise the item property corresponding to the property field field is modified.
virtual void ml::ListContainerBase::doSelectItem | ( | MLssize_t | index | ) | [virtual] |
Select item at position index, or deselect if item == -1.
virtual void ml::ListContainerBase::doUpdate | ( | ) | [virtual] |
Update all fields and touch output list field.
virtual void ml::ListContainerBase::endSaveFields | ( | ) | [virtual] |
Clean up after persistence.
Reimplemented from ml::Module.
Return the item id of the item index.
Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual ListBase* ml::ListContainerBase::getInternalList | ( | ) | [protected, pure virtual] |
Return address of internal list object.
Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
BaseField* ml::ListContainerBase::getOutputField | ( | ) | [inline] |
Returns a pointer to the output field.
Definition at line 153 of file mlListContainer.h.
virtual void ml::ListContainerBase::handleNotification | ( | Field * | field | ) | [virtual] |
Handle field notifications.
Reimplemented from ml::Module.
virtual void ml::ListContainerBase::initItem | ( | MLssize_t | index | ) | [protected, pure virtual] |
Initialize the list item at position index.
This method is called by insertItem() if the fromCurrentItem argument is false.
Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual void ml::ListContainerBase::insertItem | ( | MLssize_t | index, |
bool | fromCurrentItem | ||
) | [protected, pure virtual] |
Insert an item at position index.
If fromCurrentItem is true, the new item is initialized from the _currentItem member of the derived ListContainerTemplate class.
Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
virtual bool ml::ListContainerBase::isPropertyField | ( | Field * | field | ) | [protected, virtual] |
Return true if field points to an item property field.
Reimplemented in ml::XMarkerListContainer.
MLint ml::ListContainerBase::maxNumItems | ( | ) | const [inline] |
Definition at line 156 of file mlListContainer.h.
virtual bool ml::ListContainerBase::modifyItem | ( | MLssize_t | index, |
Field * | field, | ||
bool | fromCurrentItem | ||
) | [protected, pure virtual] |
Modify item at position index.
If fromCurrentItem is true, the item is copied from the _currentItem member of the derived ListContainerTemplate class, otherwise the item property corresponding to the property field field is modified. Return true if item has been modified.
Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
int ml::ListContainerBase::overflowMode | ( | ) | const [inline] |
Returns the overflow mode.
Definition at line 170 of file mlListContainer.h.
virtual bool ml::ListContainerBase::ownsList | ( | ) | [inline, protected, virtual] |
Return true if the active list is the internal list.
Definition at line 190 of file mlListContainer.h.
virtual void ml::ListContainerBase::resetPropertyFields | ( | ) | [protected, virtual] |
Reset all property fields.
Reimplemented in ml::XMarkerListContainer.
virtual bool ml::ListContainerBase::setActiveList | ( | Base * | basePtr | ) | [protected, pure virtual] |
Set the active list (i.e.
the list controlled by the container) to the object *basePtr, provided that it is of the correct type. If not, the active list pointer should be set to zero, which disables the container. Returns true if object is of correct type.
Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
void ml::ListContainerBase::setHandleNotificationCB | ( | ListContainerHandleNotificationCB * | cb = NULL , |
void * | userData = NULL |
||
) |
Set the callback for handleNotification.
virtual void ml::ListContainerBase::touchList | ( | ListBase::ActionClass | actionClass, |
MLssize_t | id, | ||
MLssize_t | index | ||
) | [protected, virtual] |
Set last list action and touch output list field.
Arguments id and index are ignored for all actions except those inducing a delete (ActDelete and ActInsertOvw). A derived viewer or editor module may overload this method in order to be notified of changes to the active list. In the overloaded method, first call ListContainerBase::touchList() and then use the list's getAction() method to obtain details on the action performed.
virtual void ml::ListContainerBase::updateActionFields | ( | ) | [protected, virtual] |
Update last action fields.
virtual void ml::ListContainerBase::updateDisplay | ( | ) | [protected, virtual] |
Update display of list size, current item index and item properties.
virtual void ml::ListContainerBase::updateListString | ( | bool | forceEnable = false | ) | [protected, virtual] |
Update the list string representing the list content.
If forceEnable is true, the string is generated regardless of the _fldListStringEnable field.
virtual void ml::ListContainerBase::updatePropertyFields | ( | ) | [protected, pure virtual] |
Update property fields from the current list item.
Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.
StringField* ml::ListContainerBase::_fldActionClass [protected] |
Action class of last action on list.
Definition at line 293 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldActionId [protected] |
Item id of last action on list.
Definition at line 295 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldActionIndex [protected] |
Index of last action on list.
Definition at line 294 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldAdd [protected] |
Add (= Append) button.
Definition at line 304 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldApplySelect [protected] |
Perform a Select-action when index is changed.
Definition at line 287 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldClearItem [protected] |
Clear the current item (i.e. init it again).
Definition at line 310 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldCopyItemToTemplate [protected] |
Copy values from current item to template fields.
Definition at line 308 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldCopyTemplateToItem [protected] |
Copy values from template fields to current item.
Definition at line 309 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldCurrentIndex [protected] |
Index of currently selected item.
Definition at line 296 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldDelete [protected] |
Delete button.
Definition at line 301 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldDeleteAll [protected] |
Delete All button.
Definition at line 302 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldId [protected] |
List item id.
Definition at line 289 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldIndex [protected] |
Current list index.
Definition at line 282 of file mlListContainer.h.
BaseField* ml::ListContainerBase::_fldInputList [protected] |
Input list field, initialized by derived class.
Definition at line 278 of file mlListContainer.h.
Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().
NotifyField* ml::ListContainerBase::_fldInsert [protected] |
Insert button.
Definition at line 303 of file mlListContainer.h.
StringField* ml::ListContainerBase::_fldListString [protected] |
String representation of list.
Definition at line 280 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldListStringEnable [protected] |
Enable list string field.
Definition at line 285 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldMaxSize [protected] |
Maximum list size.
Definition at line 299 of file mlListContainer.h.
StringField* ml::ListContainerBase::_fldName [protected] |
List item name.
Definition at line 290 of file mlListContainer.h.
StringField* ml::ListContainerBase::_fldNewName [protected] |
List item name.
Definition at line 291 of file mlListContainer.h.
IntField* ml::ListContainerBase::_fldNumItems [protected] |
List size.
Definition at line 281 of file mlListContainer.h.
BaseField* ml::ListContainerBase::_fldOutputList [protected] |
Output list field, initialized by derived class.
Definition at line 277 of file mlListContainer.h.
Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().
EnumField* ml::ListContainerBase::_fldOverflowMode [protected] |
Overflow mode, specifies which item(s) to delete on overflow.
Definition at line 298 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldOwnsList [protected] |
Reflect owner state (true if internal list is active)
Definition at line 286 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldPersistent [protected] |
Activate internal list persistence.
Definition at line 284 of file mlListContainer.h.
NotifyField* ml::ListContainerBase::_fldUpdate [protected] |
Update button.
Definition at line 305 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldUpToDate [protected] |
Indicates that the property values are up to date.
Definition at line 312 of file mlListContainer.h.
BoolField* ml::ListContainerBase::_fldUseInsertTemplate [protected] |
If true the container should use the template fields for initializing the inserted item.
Definition at line 307 of file mlListContainer.h.
int ml::ListContainerBase::_lockNotification [protected] |
Suppress handleNotification() if non-zero.
Definition at line 317 of file mlListContainer.h.
Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().