API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
- Model Events - ModelEvent - IModel_StepNotify
Widgets which have animation or timing-based events will send step notifications through their ViewModel. The widget will pass the step and repetition values of its animation through this event. For example, nStep:0 and nRepetition:0 would be the first frame of a sequence; nStep:1 and nRepetition:0 would follow. Once the sequence has reached its end, nRepetition will increment and nStep will reset to zero, indicating the start of a new sequence. The ModelListener callback can check the flags set in base's dwParam for information about a particular step. These flags tell the listener if the step was the final one in a sequence, whether or not the sequence was repeating, and so on. See the Comments section for more details about related flags.
Widgets with animating background images support StepEvent. Static Widget and Image Widget support StepEvent as well.
Note -- StepEvent is not sent by default. The user must enable them by sending the AF_ENABLE_EVT_STEP flag using either PROP_ANIMATE_FLAGS (for foreground sequences) or PROP_BGIMAGE_ANIMATE_FLAGS (for background sequences).
  • 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.  Note that the dwParam is used to send StepEvent flags.
                      See Comments for step flag definitions.
  • nStep:         This is a zero-based index of the step in a sequence.
  • nRepetition:   This is a zero-based index of the current repetition of a sequence.
  •    typedef struct StepEvent {
          ModelEvent base;
          uint32     nStep;
          uint32     nRepetition;
       } StepEvent;
Flags passed through the base's dwParam are as follows: EVT_STEP_PRE: Once a model sets its first timer to begin animating, it will send a step event with this flag set. This gives the ModelListener a notification essentially before animation begins. Expect the 0th step of the 0th repetition to be accompanied by this flag. EVT_STEP_FINAL: At the end of a sequence, the widget will set this flag. EVT_STEP_REPEAT: If the sequence is on its final step, this flag will be set to indicate that the sequence will be repeating. This flag is generally accompanied by EVT_STEP_FINAL. EVT_STEP_BG: Indicates that the widget's background is stepping. When this flag is not set, assume the widget's foreground is stepping.