IsObjUpdated Macro

Microchip Graphics Library

Microchip Graphics Library
IsObjUpdated Macro
C
#define IsObjUpdated(pObj) (((OBJ_HEADER *)pObj)->state & 0xfc00)
Overview

This macro tests if the object is pending to be redrawn. This is done by testing the 6 MSBits of object�s state to detect if the object must be redrawn.

Input Parameters
Input Parameters 
Description 
pObj 
Pointer to the object of interest. 
Returns

Returns a nonzero value if the object needs to be redrawn. Zero if not.

Preconditions

none

Side Effects

none

Example
int DrawButtonWindowOnly() {
    static OBJ_HEADER *pCurrentObj = NULL;
    SHORT done = 0;

    if (pCurrentObj == NULL)
        pCurrentObj = GOLGetList();         // get current list

    while(pCurrentObj != NULL){
        if(IsObjUpdated(pCurrentObj)){
            done = pCurrentObj->draw(pCurrentObj);              
             
            // reset state of object if done
            if (done)
                GOLDrawComplete(pCurrentObj)
            // Return if not done. This means that BtnDraw()
            // was terminated prematurely by device busy status
            // and must be recalled to finish rendering of
            // objects in the list that have new states.
            else
                return 0;
        }
        // go to the next object in the list
        pCurrentObj = pCurrentObj->pNxtObj;
    }
    return 1;
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved