bool MsgOptionsCallback(GFX_GOL_TRANSLATED_ACTION objMsg, GFX_GOL_OBJ_HEADER *pObject, GFX_GOL_MESSAGE *pMessage) { uint16_t objectID; GFX_GOL_CHECKBOX* PC; objectID = GFX_GOL_ObjectIDGet(pObject); /* KWP FAST */ if (objectID == ID_RADIOBUTTON1) { CONNECT_TYPE = ISO_9141_SLOW; } else /*KWP SLOW */ if (objectID == ID_RADIOBUTTON2) { CONNECT_TYPE = KWP_SLOW; } else /* ISO 9141 SLOW */ if (objectID == ID_RADIOBUTTON3) { CONNECT_TYPE = KWP_FAST; } else if (objectID == ID_AUTO_CHECKBOX) { if (objMsg == GFX_GOL_CHECKBOX_ACTION_CHECKED) { TRYING_CONN = 1; } else if (objMsg == GFX_GOL_CHECKBOX_ACTION_UNCHECKED) { TRYING_CONN = 0; } }else if (objectID == ID_TESTKLINE_BUT) { if (objMsg == GFX_GOL_CHECKBOX_ACTION_CHECKED) { TXLAT = 1; SetInputString(); } else if (objMsg == GFX_GOL_CHECKBOX_ACTION_UNCHECKED) { TXLAT = 0; SetInputString(); } } }
///////////////////////////////////////////////////////////////////////////// // Function: WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg) // Input: objMsg - translated message for the object, // pObj - pointer to the object, // pMsg - pointer to the non-translated, raw GOL message // Output: if the function returns non-zero the message will be processed by default // Overview: it's a user defined function. GOLMsg() function calls it each // time the valid message for the object received ///////////////////////////////////////////////////////////////////////////// bool GFX_GOL_MessageCallback(GFX_GOL_TRANSLATED_ACTION objMsg, GFX_GOL_OBJ_HEADER *pObj, GFX_GOL_MESSAGE *pMsg) { uint16_t objID; // check first if we need to exit the selected demo (if applicable) if ((objMsg == GFX_GOL_BUTTON_ACTION_RELEASED) && (pObj->ID == ID_BACK)) { // check if the button is indeed pressed if (GFX_GOL_ObjectStateGet(pObj, GFX_GOL_BUTTON_PRESSED_STATE)) { screenState = CREATE_MAINMENU; return 1; } } // process messages for demo screens switch(screenState) { case DISPLAY_MAINMENU: // In this portion, all management of the Button states are // done here. This portion will always return 0 to inhibit // the button default message processing to take place. objID = GFX_GOL_ObjectIDGet(pObj); if ((objID == ID_ICON1) || (objID == ID_ICON2) || (objID == ID_ICON3) || (objID == ID_ICON4)) { if(objMsg == GFX_GOL_BUTTON_ACTION_PRESSED) { // check if button is pressed and show pressed icon GFX_GOL_ObjectStateSet(pObj, GFX_GOL_BUTTON_PRESSED_STATE); } else if(objMsg == GFX_GOL_BUTTON_ACTION_RELEASED) { // check if button is released and show release icon GFX_GOL_ObjectStateClear(pObj, GFX_GOL_BUTTON_PRESSED_STATE); if (objID == ID_ICON1) { while(GFX_DoubleBufferDisable() == GFX_STATUS_FAILURE); PIPDemo(); screenState = CREATE_MAINMENU; } else if (objID == ID_ICON2) { while(GFX_DoubleBufferDisable() == GFX_STATUS_FAILURE); SpeedDemo(); screenState = CREATE_MAINMENU; } else if (objID == ID_ICON3) { screenState = CREATE_ALPHABLEND; } else if (objID == ID_ICON4) { while(GFX_DoubleBufferDisable() == GFX_STATUS_FAILURE); PagingDemo(); screenState = CREATE_MAINMENU; } else // this should not happen screenState = DISPLAY_MAINMENU; } else if(objMsg == GFX_GOL_BUTTON_ACTION_STILLPRESSED) { // do not do anything since it is already pressed return 0; } else { // check if button is released and show release icon GFX_GOL_ObjectStateClear(pObj, GFX_GOL_BUTTON_PRESSED_STATE); // reset pressed } GFX_GOL_ObjectStateSet(pObj, GFX_GOL_BUTTON_DRAW_STATE); return 0; } if ((objID == ID_SCROLL1) || (objID == ID_SCROLL2) || (objID == ID_SCROLL3) || (objID == ID_SCROLL4)) { if(objMsg == GFX_GOL_BUTTON_ACTION_RELEASED) { switch(objID) //Up = 1, Down = 2, Left = 3, Right = 4 { case ID_SCROLL1: ScrollScreen(3,10); break; case ID_SCROLL2: ScrollScreen(1,10); break; case ID_SCROLL3: ScrollScreen(4,10); break; case ID_SCROLL4: ScrollScreen(2,10); break; } } } break; case DISPLAY_ALPHABLEND: return (MsgAlphaBlendScreenCallback(objMsg, pObj, pMsg)); default: break; } return (1); }