/********************************************************************* * Function: uint16_t GFX_GOL_PictureDraw(void *pObj) * * Output: returns the status of the drawing * 0 - not completed * 1 - done * * Overview: draws picture * ********************************************************************/ GFX_STATUS GFX_GOL_PictureControlDraw(void *pObj) { typedef enum { REMOVE, DRAW_IMAGE, DRAW_BACKGROUND1, DRAW_BACKGROUND2, DRAW_BACKGROUND3, DRAW_BACKGROUND4, DRAW_FRAME, } GFX_GOL_PICTURE_DRAW_STATES; static GFX_GOL_PICTURE_DRAW_STATES state = REMOVE; static uint16_t posleft; static uint16_t postop; static uint16_t posright; static uint16_t posbottom; static GFX_STATUS index = GFX_STATUS_FAILURE; GFX_GOL_PICTURECONTROL *pPict; pPict = (GFX_GOL_PICTURECONTROL *)pObj; switch(state) { case REMOVE: if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_HIDE_STATE)) { GFX_ColorSet(pPict->hdr.pGolScheme->CommonBkColor); if(GFX_RectangleFillDraw(pPict->hdr.left, pPict->hdr.top, pPict->hdr.right, pPict->hdr.bottom) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); return (GFX_STATUS_SUCCESS); } posleft = (pPict->hdr.left + 1 + pPict->hdr.right - pPict->scaleFactor * GFX_ImageWidthGet(pPict->pImage)) >> 1; postop = (pPict->hdr.top + 1 + pPict->hdr.bottom - pPict->scaleFactor * GFX_ImageHeightGet(pPict->pImage)) >> 1; posright = (pPict->hdr.right + pPict->hdr.left + pPict->scaleFactor * GFX_ImageWidthGet(pPict->pImage)) >> 1; posbottom = (pPict->hdr.bottom + pPict->hdr.top + pPict->scaleFactor * GFX_ImageHeightGet(pPict->pImage)) >> 1; GFX_ImageStretchSet(pPict->scaleFactor); state = DRAW_IMAGE; case DRAW_IMAGE: if(pPict->pImage != NULL) { if(GFX_ImagePartialDraw(posleft, postop, pPict->partial.xoffset,pPict->partial.yoffset,pPict->partial.width,pPict->partial.height, pPict->pImage)==GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); } if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_STREAM_STATE)) { if(pPict->count > 0) { SYS_TMR_DelayMS(pPict->delay); pPict->count -= 1; pPict->pImage = (GFX_RESOURCE_HDR*)*pPict->stream++; //Index to next bitmap in stream return(GFX_STATUS_FAILURE); } } state = DRAW_BACKGROUND1; case DRAW_BACKGROUND1: GFX_ColorSet(pPict->hdr.pGolScheme->CommonBkColor); if(GFX_RectangleFillDraw(pPict->hdr.left + 1, pPict->hdr.top + 1, pPict->hdr.right - 1, postop - 1) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); state = DRAW_BACKGROUND2; case DRAW_BACKGROUND2: if(GFX_RectangleFillDraw(pPict->hdr.left + 1, posbottom, pPict->hdr.right - 1, pPict->hdr.bottom - 1) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); state = DRAW_BACKGROUND3; case DRAW_BACKGROUND3: if(GFX_RectangleFillDraw(pPict->hdr.left + 1, postop, posleft - 1, posbottom) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); state = DRAW_BACKGROUND4; case DRAW_BACKGROUND4: index = GFX_RectangleFillDraw(posright, postop, pPict->hdr.right - 1, posbottom); if(index == GFX_STATUS_FAILURE) { return (GFX_STATUS_FAILURE); } state = DRAW_FRAME; case DRAW_FRAME: if(GFX_GOL_ObjectStateGet(pPict, GFX_GOL_PICTURECONTROL_FRAME_STATE)) { GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); GFX_ColorSet(pPict->hdr.pGolScheme->TextColor0); index = GFX_RectangleDraw(pPict->hdr.left, pPict->hdr.top, pPict->hdr.right, pPict->hdr.bottom); if(index == GFX_STATUS_FAILURE) { return (GFX_STATUS_FAILURE); } } state = REMOVE; return (GFX_STATUS_SUCCESS); } return (GFX_STATUS_SUCCESS); }
/********************************************************************* * Function: uint16_t GFX_GOL_StaticTextDraw(void *pObj) * * Notes: This is the state machine to draw the static text. * ********************************************************************/ GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject) { typedef enum { GFX_GOL_STATICTEXT_STATE_IDLE, GFX_GOL_STATICTEXT_STATE_CLEANAREA, GFX_GOL_STATICTEXT_STATE_INIT, WAIT } GFX_GOL_STATICTEXT_DRAW_STATES; static GFX_GOL_STATICTEXT_DRAW_STATES state = GFX_GOL_STATICTEXT_STATE_IDLE; static GFX_STATUS index; GFX_GOL_STATICTEXT *pSt; pSt = (GFX_GOL_STATICTEXT *) pObject; while (1) { switch (state) { case GFX_GOL_STATICTEXT_STATE_IDLE: if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE)) { GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor); if (GFX_RectangleFillDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); // State is still IDLE STATE so no need to set state return (GFX_STATUS_SUCCESS); } if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE)) { if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE)) { // show frame if specified to be shown GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if (!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { // show enabled color GFX_ColorSet(pSt->hdr.pGolScheme->Color1); } else { // show disabled color GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled); } if (GFX_RectangleDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); } } state = GFX_GOL_STATICTEXT_STATE_CLEANAREA; case GFX_GOL_STATICTEXT_STATE_CLEANAREA: #ifdef USE_ALPHABLEND //Draw the background image if (pSt->hdr.pGolScheme->AlphaValue != 100) { GFX_AlphaParamsSet(GFX_Primitive_instance.backgroundPage,pSt->hdr.left, pSt->hdr.top, GFX_Primitive_instance.backgroundPage,pSt->hdr.left, pSt->hdr.top, GFX_Primitive_instance.activePage,pSt->hdr.left, pSt->hdr.top); if(CopyPageWindow( &GFX_Primitive_instance.alphaArea, pSt->hdr.right - pSt->hdr.left, pSt->hdr.bottom - pSt->hdr.top) == GFX_STATUS_FAILURE) return(GFX_STATUS_FAILURE); } else #endif { // clean area where text will be placed. GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor); if (GFX_RectangleFillDraw(pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) == GFX_STATUS_FAILURE) return (GFX_STATUS_FAILURE); } state = GFX_GOL_STATICTEXT_STATE_INIT; case GFX_GOL_STATICTEXT_STATE_INIT: // set the text color if (!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0); } else { GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled); } // use the font specified in the object GFX_FontSet(pSt->hdr.pGolScheme->pFont); index = GFX_TextStringBoxDraw( pSt->hdr.left, pSt->hdr.top, pSt->hdr.right - pSt->hdr.left, pSt->hdr.bottom - pSt->hdr.top, pSt->pText, pSt->alignment); if(index == GFX_STATUS_FAILURE) { return (GFX_STATUS_FAILURE); } state = WAIT; case WAIT: state = GFX_GOL_STATICTEXT_STATE_IDLE; // go back to IDLE state return (GFX_STATUS_SUCCESS); } } // end of switch() } // end of while(1)
// ***************************************************************************** GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject) { typedef enum { DRAW_STATIC_TEXT_IDLE, DRAW_STATIC_TEXT_CLEANAREA, DRAW_STATIC_TEXT_INIT, DRAW_STATIC_TEXT_DRAWTEXT, } ST_DRAW_STATES; static ST_DRAW_STATES state = DRAW_STATIC_TEXT_IDLE; GFX_GOL_STATICTEXT *pSt; static uint16_t adjustBackground = 0; #ifdef GFX_CONFIG_ALPHABLEND_DISABLE #ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE uint16_t transparentColorStatus; GFX_COLOR transparentColorSet = 0; #endif #endif pSt = (GFX_GOL_STATICTEXT *)pObject; while(1) { if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT) return (GFX_STATUS_FAILURE); switch(state) { case DRAW_STATIC_TEXT_IDLE: #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_SetupDrawUpdate( \ pSt->hdr.left, \ pSt->hdr.top, \ pSt->hdr.right, \ pSt->hdr.bottom); #endif if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE)) { // Hide the GFX_GOL_STATICTEXT (remove from screen) if (GFX_GOL_ObjectHideDraw(&(pSt->hdr)) != GFX_STATUS_SUCCESS) return (GFX_STATUS_FAILURE); // State is still IDLE STATE so no need to set state #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_CompleteDrawUpdate( \ pSt->hdr.left, \ pSt->hdr.top, \ pSt->hdr.right, \ pSt->hdr.bottom); #endif return (GFX_STATUS_SUCCESS); } if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE)) { // show frame if specified to be shown GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE)) { adjustBackground = 1; // set the line style to solid thin line GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { // show enabled color GFX_ColorSet(pSt->hdr.pGolScheme->Color1); if(GFX_RectangleDraw( pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } else { // show disabled color GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled); if(GFX_RectangleDraw( pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } } else { adjustBackground = 0; } } // check if there is no background if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_NOBACKGROUNDCOLORFILL_STATE)) { state = DRAW_STATIC_TEXT_INIT; break; } else { state = DRAW_STATIC_TEXT_CLEANAREA; } case DRAW_STATIC_TEXT_CLEANAREA: /* The refreshing of the static area is dependent on the features set. Case 1: When fill style is GFX_FILL_STYLE_NONE, text cannot be changed and refreshed. If text changes then use one of the following fill styles: GFX_FILL_STYLE_COLOR GFX_FILL_STYLE_ALPHA_COLOR GFX_FILL_STYLE_GRADIENT_DOWN, GFX_FILL_STYLE_GRADIENT_UP, GFX_FILL_STYLE_GRADIENT_RIGHT, GFX_FILL_STYLE_GRADIENT_LEFT, GFX_FILL_STYLE_GRADIENT_DOUBLE_VER, GFX_FILL_STYLE_GRADIENT_DOUBLE_HOR, or use (or enable) the common background image if available in the application (see case 2). Case 2: When common background image is set, then GFX_FILL_STYLE_NONE can be used. Redrawing the static text will redraw the background which in turn refreshes the text. Therefore, in this case the text can be modified. Case 3: Alpha blending cannot be used with gradient fills. Therefore, do use gradient fills when alpha blending of panels are enabled. */ // check if fill style is GFX_FILL_STYLE_NONE and common // background is present if ((pSt->hdr.pGolScheme->pCommonBkImage != NULL) && (pSt->hdr.pGolScheme->fillStyle == GFX_FILL_STYLE_NONE)) { #ifdef GFX_CONFIG_ALPHABLEND_DISABLE #ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE if (GFX_TransparentColorStatusGet() == GFX_FEATURE_ENABLED) { // disable the transparent color since we want the // background to refresh with all pixels being drawn GFX_TransparentColorDisable(); transparentColorStatus = 1; transparentColorSet = GFX_TransparentColorGet(); } #endif #endif if (GFX_ImagePartialDraw( pSt->hdr.left + adjustBackground, pSt->hdr.top + adjustBackground, pSt->hdr.left - pSt->hdr.pGolScheme->CommonBkLeft + adjustBackground, pSt->hdr.top - pSt->hdr.pGolScheme->CommonBkTop + adjustBackground, pSt->hdr.right - pSt->hdr.left + 1 - (adjustBackground << 1), pSt->hdr.bottom - pSt->hdr.top + 1 - (adjustBackground << 1), pSt->hdr.pGolScheme->pCommonBkImage ) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } #ifdef GFX_CONFIG_ALPHABLEND_DISABLE #ifndef GFX_CONFIG_TRANSPARENT_COLOR_DISABLE // after rendering the background, we need to restore the // transparent color if previously enabled. if (transparentColorStatus) { GFX_TransparentColorEnable(transparentColorSet); } #endif #endif } else { if (pSt->hdr.pGolScheme->fillStyle != GFX_FILL_STYLE_NONE) { // clean area where text will be placed. GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor); GFX_GOL_ObjectBackGroundSet(&pSt->hdr); if(GFX_RectangleFillDraw( pSt->hdr.left + 1, pSt->hdr.top + 1, pSt->hdr.right - 1, pSt->hdr.bottom - 1) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } } state = DRAW_STATIC_TEXT_INIT; case DRAW_STATIC_TEXT_INIT: if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT) return (GFX_STATUS_FAILURE); // set the text color if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0); } else { GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled); } // use the font specified in the object GFX_FontSet(pSt->hdr.pGolScheme->pFont); state = DRAW_STATIC_TEXT_DRAWTEXT; case DRAW_STATIC_TEXT_DRAWTEXT: if (GFX_TextStringBoxDraw( \ pSt->hdr.left + 1, \ pSt->hdr.top + 1, \ pSt->hdr.right - pSt->hdr.left - 1, \ pSt->hdr.bottom - pSt->hdr.top - 1, \ pSt->pText, \ 0, \ pSt->alignment) != GFX_STATUS_SUCCESS) return (GFX_STATUS_FAILURE); state = DRAW_STATIC_TEXT_IDLE; // go back to IDLE state #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_CompleteDrawUpdate( \ pSt->hdr.left, \ pSt->hdr.top, \ pSt->hdr.right, \ pSt->hdr.bottom); #endif return (GFX_STATUS_SUCCESS); } // end of switch() } // end of while(1) }
// ***************************************************************************** GFX_STATUS GFX_GOL_StaticTextDraw(void *pObject) { typedef enum { DRAW_STATIC_TEXT_IDLE, DRAW_STATIC_TEXT_CLEANAREA, DRAW_STATIC_TEXT_INIT, DRAW_STATIC_TEXT_DRAWTEXT, } ST_DRAW_STATES; static ST_DRAW_STATES state = DRAW_STATIC_TEXT_IDLE; GFX_GOL_STATICTEXT *pSt; pSt = (GFX_GOL_STATICTEXT *)pObject; while(1) { if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT) return (GFX_STATUS_FAILURE); switch(state) { case DRAW_STATIC_TEXT_IDLE: if (GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_HIDE_STATE)) { // Hide the GFX_GOL_STATICTEXT (remove from screen) if (GFX_GOL_ObjectHideDraw(&(pSt->hdr)) != GFX_STATUS_SUCCESS) return (GFX_STATUS_FAILURE); // State is still IDLE STATE so no need to set state return (GFX_STATUS_SUCCESS); } if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DRAW_STATE)) { // show frame if specified to be shown GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_FRAME_STATE)) { // set the line style to solid thin line GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { // show enabled color GFX_ColorSet(pSt->hdr.pGolScheme->Color1); if(GFX_RectangleDraw( pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } else { // show disabled color GFX_ColorSet(pSt->hdr.pGolScheme->ColorDisabled); if(GFX_RectangleDraw( pSt->hdr.left, pSt->hdr.top, pSt->hdr.right, pSt->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } } } // check if there is no background if(GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_NOBACKGROUNDCOLORFILL_STATE)) { state = DRAW_STATIC_TEXT_INIT; break; } else { state = DRAW_STATIC_TEXT_CLEANAREA; } case DRAW_STATIC_TEXT_CLEANAREA: // clean area where text will be placed. GFX_ColorSet(pSt->hdr.pGolScheme->CommonBkColor); GFX_GOL_ObjectBackGroundSet(&pSt->hdr); if(GFX_RectangleFillDraw( pSt->hdr.left + 1, pSt->hdr.top + 1, pSt->hdr.right - 1, pSt->hdr.bottom - 1) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } state = DRAW_STATIC_TEXT_INIT; case DRAW_STATIC_TEXT_INIT: if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT) return (GFX_STATUS_FAILURE); // set the text color if(!GFX_GOL_ObjectStateGet(pSt, GFX_GOL_STATICTEXT_DISABLED_STATE)) { GFX_ColorSet(pSt->hdr.pGolScheme->TextColor0); } else { GFX_ColorSet(pSt->hdr.pGolScheme->TextColorDisabled); } // use the font specified in the object GFX_FontSet(pSt->hdr.pGolScheme->pFont); state = DRAW_STATIC_TEXT_DRAWTEXT; case DRAW_STATIC_TEXT_DRAWTEXT: if (GFX_TextStringBoxDraw( \ pSt->hdr.left + 1, \ pSt->hdr.top + 1, \ pSt->hdr.right - pSt->hdr.left - 1, \ pSt->hdr.bottom - pSt->hdr.top - 1, \ pSt->pText, \ 0, \ pSt->alignment) != GFX_STATUS_SUCCESS) return (GFX_STATUS_FAILURE); state = DRAW_STATIC_TEXT_IDLE; // go back to IDLE state return (GFX_STATUS_SUCCESS); } // end of switch() } // end of while(1) }
// ***************************************************************************** GFX_STATUS GFX_GOL_CheckBoxDraw(void *pObject) { typedef enum { DRAW_CHECKBOX_START, DRAW_CHECKBOX_BOX_DRAW, DRAW_CHECKBOX_RUN_DRAW, DRAW_CHECKBOX_TEXT_DRAW, DRAW_CHECKBOX_TEXT_DRAW_RUN, DRAW_CHECKBOX_CHECK_SET_DRAW, DRAW_CHECKBOX_CHECK_DRAW, DRAW_CHECKBOX_FOCUS_DRAW } CB_DRAW_STATES; static CB_DRAW_STATES state = DRAW_CHECKBOX_START; static int16_t checkIndent; static uint16_t width; GFX_GOL_CHECKBOX *pCb; pCb = (GFX_GOL_CHECKBOX *)pObject; while(1) { if (GFX_RenderStatusGet() == GFX_STATUS_BUSY_BIT) return (GFX_STATUS_FAILURE); switch(state) { case DRAW_CHECKBOX_RUN_DRAW: if(GFX_GOL_PanelDraw() != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } state = DRAW_CHECKBOX_TEXT_DRAW; case DRAW_CHECKBOX_TEXT_DRAW: if(pCb->pText != NULL) { GFX_FontSet(pCb->hdr.pGolScheme->pFont); if(!GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_DISABLED_STATE)) { GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0); } else { GFX_ColorSet(pCb->hdr.pGolScheme->TextColorDisabled); } width = pCb->hdr.bottom - pCb->hdr.top; state = DRAW_CHECKBOX_TEXT_DRAW_RUN; } else { state = DRAW_CHECKBOX_CHECK_SET_DRAW; break; } case DRAW_CHECKBOX_TEXT_DRAW_RUN: if (GFX_TextStringBoxDraw( pCb->hdr.left + width + CB_INDENT, pCb->hdr.top + pCb->hdr.pGolScheme->EmbossSize, pCb->hdr.right - pCb->hdr.left - (pCb->hdr.pGolScheme->EmbossSize << 1) - width, width - (pCb->hdr.pGolScheme->EmbossSize << 1), pCb->pText, 0, pCb->alignment) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } state = DRAW_CHECKBOX_CHECK_SET_DRAW; break; case DRAW_CHECKBOX_START: #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_SetupDrawUpdate( pCb->hdr.left, pCb->hdr.top, pCb->hdr.right, pCb->hdr.bottom); #endif if(GFX_GOL_ObjectStateGet(pCb, GFX_GOL_CHECKBOX_HIDE_STATE)) { if (GFX_GOL_ObjectHideDraw(&(pCb->hdr)) != GFX_STATUS_SUCCESS) return (GFX_STATUS_FAILURE); #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_CompleteDrawUpdate( pCb->hdr.left, pCb->hdr.top, pCb->hdr.right, pCb->hdr.bottom); #endif return (GFX_STATUS_SUCCESS); } else if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_DRAW_STATE)) { GFX_ColorSet(pCb->hdr.pGolScheme->CommonBkColor); GFX_GOL_ObjectBackGroundSet(&pCb->hdr); if(GFX_RectangleFillDraw( pCb->hdr.left, pCb->hdr.top, pCb->hdr.right, pCb->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } } state = DRAW_CHECKBOX_BOX_DRAW; case DRAW_CHECKBOX_BOX_DRAW: GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_DRAW_STATE)) { if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_DISABLED_STATE)) { GFX_GOL_PanelParameterSet( pCb->hdr.left + CB_INDENT, pCb->hdr.top + CB_INDENT, pCb->hdr.left + \ (pCb->hdr.bottom - pCb->hdr.top) - CB_INDENT, pCb->hdr.bottom - CB_INDENT, 0, pCb->hdr.pGolScheme->ColorDisabled, pCb->hdr.pGolScheme->EmbossDkColor, pCb->hdr.pGolScheme->EmbossLtColor, NULL, pCb->hdr.pGolScheme->fillStyle, pCb->hdr.pGolScheme->EmbossSize); } else { GFX_GOL_PanelParameterSet( pCb->hdr.left + CB_INDENT, pCb->hdr.top + CB_INDENT, pCb->hdr.left + \ (pCb->hdr.bottom - pCb->hdr.top) - CB_INDENT, pCb->hdr.bottom - CB_INDENT, 0, pCb->hdr.pGolScheme->Color0, pCb->hdr.pGolScheme->EmbossDkColor, pCb->hdr.pGolScheme->EmbossLtColor, NULL, pCb->hdr.pGolScheme->fillStyle, pCb->hdr.pGolScheme->EmbossSize); } // set the background information GFX_GOL_PanelBackgroundSet(&pCb->hdr); state = DRAW_CHECKBOX_RUN_DRAW; break; } else { state = DRAW_CHECKBOX_CHECK_SET_DRAW; } case DRAW_CHECKBOX_CHECK_SET_DRAW: if(GFX_GOL_ObjectStateGet( pCb, (GFX_GOL_CHECKBOX_DRAW_STATE | GFX_GOL_CHECKBOX_DRAW_CHECK_STATE))) { if(!GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_DISABLED_STATE)) { if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_CHECKED_STATE)) { GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0); GFX_FillStyleSet(GFX_FILL_STYLE_COLOR); } else { GFX_GOL_ObjectBackGroundSet(&pCb->hdr); GFX_ColorSet(pCb->hdr.pGolScheme->Color0); } } else { if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_CHECKED_STATE)) { GFX_ColorSet(pCb->hdr.pGolScheme->TextColorDisabled); GFX_FillStyleSet(GFX_FILL_STYLE_COLOR); } else { GFX_GOL_ObjectBackGroundSet(&pCb->hdr); GFX_ColorSet(pCb->hdr.pGolScheme->ColorDisabled); } } checkIndent = (pCb->hdr.bottom - pCb->hdr.top) >> 2; state = DRAW_CHECKBOX_CHECK_DRAW; } else { state = DRAW_CHECKBOX_FOCUS_DRAW; break; } case DRAW_CHECKBOX_CHECK_DRAW: if ( GFX_RectangleFillDraw( pCb->hdr.left + checkIndent + pCb->hdr.pGolScheme->EmbossSize, pCb->hdr.top + checkIndent + pCb->hdr.pGolScheme->EmbossSize, pCb->hdr.left + (pCb->hdr.bottom - pCb->hdr.top) - checkIndent - pCb->hdr.pGolScheme->EmbossSize, pCb->hdr.bottom - checkIndent - pCb->hdr.pGolScheme->EmbossSize) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } state = DRAW_CHECKBOX_FOCUS_DRAW; case DRAW_CHECKBOX_FOCUS_DRAW: if(GFX_GOL_ObjectStateGet( pCb, (GFX_GOL_CHECKBOX_DRAW_STATE | GFX_GOL_CHECKBOX_DRAW_FOCUS_STATE))) { if(GFX_GOL_ObjectStateGet( pCb, GFX_GOL_CHECKBOX_FOCUSED_STATE)) { GFX_ColorSet(pCb->hdr.pGolScheme->TextColor0); } else { GFX_ColorSet(pCb->hdr.pGolScheme->CommonBkColor); } GFX_LineStyleSet(GFX_LINE_STYLE_THIN_DASHED); if(GFX_RectangleDraw( pCb->hdr.left, pCb->hdr.top, pCb->hdr.right, pCb->hdr.bottom) != GFX_STATUS_SUCCESS) { return (GFX_STATUS_FAILURE); } GFX_LineStyleSet(GFX_LINE_STYLE_THIN_SOLID); } state = DRAW_CHECKBOX_START; #ifdef GFX_CONFIG_BISTABLE_DISPLAY_AUTO_REFRESH_ENABLE GFX_DRIVER_CompleteDrawUpdate( pCb->hdr.left, pCb->hdr.top, pCb->hdr.right, pCb->hdr.bottom); #endif return (GFX_STATUS_SUCCESS); } // end of switch() } // end of while(1)