Developer

API Reference

ScrollEvent

Brew Release
Brew MP 1.0.2
See Also
- Model Events
- ModelEvent
Description
This data type extends the base model event to include fields used by models that provide data specific to scrollable information. For example, a widget that provides a scrolling collection of items to the user could register as a client of the view model, which would track the relative scroll position of the list. As the data in the list changes, the model would sent events to listening objects in a ScrollEvent, identifying the specific event code in the 'base' ModelEvent, while information specific to the event will be stored in the remaining fields of the ScrollEvent data structure.
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.
  • bVertical:  Identifies the event as having affected the horizontal or vertical
                   orientation of the scroll area, as follows.
                         FALSE = horizontal scroll event
                         TRUE  = vertical scroll event
  • range:      Defines the total value range for all the data to be scrolled in the
                   direction identified by 'bVertical'.  For example, if a 640 x 480
                   bitmapped image is to be scrolled, 640 would be reported as the
                   horizontal 'range', while 480 would be reported for a vertical scroll
                   event.  A value of 0 indicates that there is nothing to scroll.
  • visible:    Defines the range for only the visible portion of the data to be
                   scrolled -- essentially, a subset of the total 'range'.  For example,
                   when text is being scrolled the 'range' field represents _all_ of the
                   text, while the 'visible' field indicates only the portion of the text
                   the user will be able to see on screen -- generally, one page worth of
                   text.  So, for example, the overall 'range' of a large body of text may
                   be 84 lines of text, while the 'visible' rage of text is 6 lines.
  • position:   Identifies the current relative position of the visible portion of the
                   data being scrolled -- i.e. the first visible piece of data.  For example,
                   when scrolling text, when at the top of the text to be scrolled, 'position'
                   would be set to 1.  After scrolling down one line, 'position' would be 2,
                   and so forth until the text can no longer be scrolled.
    
Definition
   typedef struct ScrollEvent {
      ModelEvent  base;
      boolean     bVertical;
      uint16      range;
      uint16      visible;
      uint16      position;
   } ScrollEvent;
Comment
The units for the 'range', 'visible' and 'position' fields depend on the contents of the scrollable area. For example, a bitmapped image would likely define these fields in units of pixels, while scrollable text may use lines of text as the units of measure.
Though a scrollable area of a screen is inherently thought of as an element of the user interface (and, therefore a view or controller in the MVC paradigm), the ScrollEvent has been defined to manage the data associated with such UI elements.
The following model events will be passed to listening objects in a ScrollEvent data structure.
       EVT_MDL_SCROLL_CHANGE
  • Follow