Developer

API Reference

IArrayModel_SetItems()

Brew Release
Brew MP 1.0.2
See Also
Model Events ListModelEvent IArrayModel Interface IArrayModel_GetAt()
Description
This function sets an array model to point to a new set of items. The caller is expected to manage the memory occupied by the referenced items, with the array model only having visibility to the number of items, the fixed size of each item, and a count of the number of items stored in the array.
Parameters
  • po
    []:
    Pointer to the IArrayModel interface object.
  • pItems
    []:
    Pointer to the items to be represented by the array model, or NULL if there are no items stored in the array. The memory occupied by the array of item pointers is managed by the array model, while the memory occupied by the items themselves would be managed by a customized memory freeing callback.
  • nItems
    []:
    Indicates the number if items stored in the array, or zero if the array is empty.
  • nItemSize
    []:
    The size, in bytes, of each array item. Each item in an array model occupies a fixed and equal amount of memory.
Interface
Prototype
   void IArrayModel_SetItems(IArrayModel *po, void *pItems, uint32 nItems, uint16 nItemSize); 
Return
None
Side Effect
Changing the items stored in an array model by calling IArrayModel_SetItems() will cause BREW to send an EVT_MDL_LIST_CHANGE ListModelEvent to any object that has registered as a listener with the model.
The fields of the ListModelEvent will contain the following information:
       pos:      0 
       oldSize:  The number of items in the array model before calling IArrayModel_SetItems().
       newSize:  The number of items in the array model after calling IArrayModel_SetItems().
Comment
IArrayModel_SetItems() operates on a full array of items; it cannot be used to set the contents of individual array items.
  • Follow