Developer

API Reference

ListModelEvent

Brew Release
Brew MP 1.0.2
See Also
Description
This data type extends the base model event to include fields used by models that organize data as a list (or a collection). For example, a widget that allows the user to page through a list of full screen photographs might choose to model the organization of the data as a list. As items are added and removed from the list, the model would send events to listening objects in a ListModelEvent, identifying the specific event code in the 'base' ModelEvent, while information pertaining to the structure of the list would be stored in the remaining fields of the ListModelEvent data structure. Events sent to objects registered with the list model describe the list in purely structural terms -- changes to the number of items, and where a particular change has occurred. The contents of the items stored in a list are managed separately, depending on the unique needs of the information to be modeled.
Members
  • base:     The base model event, which identifies the event code and provides the object
                 with the listener it had previously registered with the model framework.
  • pos:      Indicates a relative position within the list, as defined by the  specific
                 event.  For example, when inserting items into a list model, this field
                 would indicate the position where the new items have been added.
  • oldSize:  Indicates the number of items stored in the list prior to the change in the
                 list value.
  • newSize:  Indicates the number if items now stored in the list.  The ListModelEvent
                 provides both the old and new list sizes so that the object receiving the
                 event may adjust its display, or otherwise respond in a manner appropriate to
                 that object.
    
Definition
   typedef struct ListModelEvent {
      ModelEvent  base;
      int         pos;
      int         oldSize;
      int         newSize;
   } ListModelEvent;
Comment
The 'oldSize' and 'newSize' fields are one based values indicating "number of items", with 0 indicating that the list is empty. The 'pos' field is zero based, with 0 indicating the first item in the list, 1 the second, and so on...
The following model events will be passed to listening objects in a ListModelEvent data structure:
       EVT_MDL_LIST_CHANGE
  • Follow