/********************************************************************* * * _DrawDiagramAt */ static void _DrawDiagramAt(GUI_MEMDEV_Handle hMem, int xPos, int yPos, int * py, int xBlend) { GUI_MEMDEV_Handle hMemOld; GUI_RECT Rect; int IndexBmBar; int ySizeBar; int i; hMemOld = GUI_MEMDEV_Select(hMem); // // Draw blue background // GUI_SetColor(0x4a2210); GUI_FillRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4); // // Draw grid lines // GUI_SetColor(0x774830); for (i = 0; i < 12; i++) { GUI_DrawHLine(yPos + 6 + i * 10, xPos + 2, xPos + GRAPH_WIDTH - 2); } // // Draw bars // for (i = 0; i < 10; i++) { IndexBmBar = (i < 6) ? i / 2 : 4 - (i / 2); ySizeBar = *(py + i); GUI_DrawBitmapMag(_apBmBar[IndexBmBar], xPos + 8 + i * 16, yPos + GRAPH_HEIGHT - ySizeBar - 6, 1, ySizeBar); } // // Draw alpha effect // Rect.x0 = xPos; Rect.x1 = xPos + 3; Rect.y0 = yPos; Rect.y1 = yPos + GRAPH_HEIGHT; GUI_SetClipRect(&Rect); GUI_SetColor(0xd99100); GUI_SetAlpha(168); GUI_FillRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4); GUI_SetClipRect(NULL); GUI_FillRect(xPos + 4, yPos + 1, xPos + xBlend, yPos + GRAPH_HEIGHT - 1); GUI_SetAlpha(0); // // Draw orange frame // GUI_SetColor(0x0094f3); GUI_DrawRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4); // // Label // _DrawLabel(hMem, xPos, yPos); GUI_MEMDEV_CopyToLCD(hMem); GUI_MEMDEV_Select(hMemOld); }
void Draw_button(int x,int y,int w,int h,const char* text,uint32_t color,uint32_t fill_color,uint32_t textcolor){ uint32_t colormemory; uint32_t bkcolormemory; bkcolormemory=GUI_GetBkColor(); colormemory=GUI_GetColor(); GUI_SetColor(color); //if(filled){ GUI_DrawRoundedRect(x,y,x+w,y+h,10); GUI_SetColor(fill_color); GUI_FillRoundedRect(x+2,y+2,x+w-2,y+h-2,8); GUI_SetBkColor(color); //}else{ // GUI_DrawRoundedRect(x,y,x+w,y+h,10); //} GUI_SetFont(&GUI_Font16_1); GUI_SetColor(textcolor); GUI_SetBkColor(fill_color); GUI_DispStringHCenterAt(text,x+(w/2),y+h/2-8); GUI_SetBkColor(bkcolormemory); GUI_SetColor(colormemory); }
static void mytext(WM_MESSAGE *pMsg) { int16_t ID; ID = WM_GetId(pMsg->hWin); switch (pMsg->MsgId) { case WM_PAINT: switch (ID) { case ID_TEXT_0: GUI_SetBkColor(GUI_WHITE); GUI_Clear(); GUI_SetColor(GUI_BLACK); GUI_FillRoundedRect(0,0,80,25,5); GUI_SetTextMode(GUI_TEXTMODE_TRANS); GUI_SetColor(GUI_WHITE); GUI_SetFont (&GUI_Font24); GUI_DispStringAt("518 横",5,2); break; case ID_TEXT_1: GUI_SetBkColor(GUI_WHITE); GUI_Clear(); GUI_SetColor(GUI_BLACK); GUI_FillRoundedRect(0,0,83,25,5); GUI_SetTextMode(GUI_TEXTMODE_TRANS); GUI_SetColor(GUI_WHITE); GUI_SetFont (&GUI_Font24); GUI_DispStringAt(pCannel,5,2); break; } break; default: TEXT_Callback(pMsg); break; } }
/********************************************************************* * * _Paint */ static void _Paint_PopupWin(WM_HWIN hWin) { GUI_RECT WinRect; xIconSelBtn_OBJ *pWidget; xICON *pIcon; xICON_CHECK_XY *pIconChkXY; int i; if(!hWin) return; DEBUGOUT("xIconSelBtn::PopupWin hWin = 0x%08x\r\n", hWin); WM_GetClientRect(&WinRect); DEBUGOUT("xIconSelBtn::PopupWin Paint(%d,%d,%d,%d)\r\n",WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1); WM_GetUserData(hWin, &pWidget, sizeof(xIconSelBtn_OBJ*)); //Draw Window Background area GUI_SetColor(pWidget->PopupWinBkColor[1]); //Base Color GUI_FillRoundedRect(WinRect.x0+1,WinRect.y0+1,WinRect.x1-1,WinRect.y1-1, 2); GUI_SetColor(pWidget->PopupWinBkColor[0]); //OutLine Color GUI_DrawRoundedRect(WinRect.x0,WinRect.y0,WinRect.x1,WinRect.y1, 2); //Draw icons BMP for(i=0; i<pWidget->NumItems; i++) { pIcon= &pWidget->xIconArray[i]; pIconChkXY = &pWidget->xIconCheckXyArray[i]; if(pIcon->pBMP) { if(i == pWidget->MovingIndex) { //Draw Forcus Frame on Icon BMP outside int x0 = pIcon->x0 - pWidget->IconFocusFrameHWidth; int y0 = pIcon->y0 - pWidget->IconFocusFrameVWidth; int x1, y1; x1 = x0 + pIcon->pBMP->XSize + (pWidget->IconFocusFrameHWidth*2); y1 = y0 + pIcon->pBMP->YSize + (pWidget->IconFocusFrameVWidth*2); GUI_SetColor(pWidget->PopupWinIconFocusColor); GUI_FillRect(x0, y0, x1, y1); } GUI_DrawBitmap(pIcon->pBMP, pIcon->x0, pIcon->y0); } if( (pWidget->pCheckedBMP) && (i == pWidget->SelectedIndex) ) { GUI_DrawBitmap(pWidget->pCheckedBMP, pIconChkXY->x0, pIconChkXY->y0); } } }
/********************************************************************* * * _Paint */ static void _Paint(xIconSelBtn_Handle hWin) { GUI_RECT WinRect; xIconSelBtn_OBJ tWidget; GUI_CONST_STORAGE GUI_BITMAP* pBMP; int xSize, ySize; if(!hWin) return; DEBUGOUT("xIconSelBtn hWin = 0x%08x\r\n", hWin); WM_GetWindowRectEx(hWin, &WinRect); GUI_MoveRect(&WinRect, -WinRect.x0, -WinRect.y0); DEBUGOUT("xIconSelBtn Paint(%d,%d,%d,%d)\r\n",WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1); BUTTON_GetUserData(hWin, &tWidget, sizeof(xIconSelBtn_OBJ)); tWidget.hThis = hWin; BUTTON_SetUserData(hWin, &tWidget, sizeof(xIconSelBtn_OBJ)); if(tWidget.pBkBMP) { GUI_DrawBitmap(tWidget.pBkBMP, WinRect.x0, WinRect.y0); } else { //Draw Window Frame Outline, and Background. GUI_SetColor(tWidget.aBkColor[0]); //Draw Window Frame Outline, and Background. GUI_FillRoundedRect(WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1, 1); } xSize = WinRect.x1 - WinRect.x0; ySize = WinRect.y1 - WinRect.y0; pBMP = tWidget.xIconArray[tWidget.SelectedIndex].pBMP; if(pBMP) { //Draw BMP in H & V center GUI_DrawBitmap(pBMP, WinRect.x0 + (xSize - pBMP->XSize)/2 , WinRect.y0 + (ySize - pBMP->YSize)/2 ); } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END GUI_DrawBitmap(&bmlogo,40,10); #if(Gradient_Rectangle) { GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2); } #endif #if(RoundedFrame) GUI_SetColor(GUI_GREEN); GUI_DrawRoundedFrame(218,118,582,382,20,3); #endif #if(FillRoundedRect) GUI_SetColor(RoundedRect); GUI_FillRoundedRect(220,120,580,380,20); #endif switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'inuse' // hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); FRAMEWIN_SetClientColor( hItem, framewin_backcolor); FRAMEWIN_SetFont(hItem, GUI_FONT_8_1); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "返回 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "停止充电 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,9999,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'cddianliang' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用电量 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用时间 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "消费金额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "账户余额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetText(hItem, "安徽绿建科技有限公司 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, &GUI_FontSong_60); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD."); TEXT_SetFont(hItem, GUI_FONT_24_ASCII); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END // op=ensure; // handle_button(); GUI_EndDialog( pMsg->hWin,1); Createensure(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_BUTTON_1: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END GUI_EndDialog( pMsg->hWin,1); Createwindow0(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_1: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_2: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_3: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END GUI_DrawBitmap(&bmlogo,40,10); #if(Gradient_Rectangle) { GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2); } #endif #if(RoundedFrame) GUI_SetColor(GUI_GREEN); GUI_DrawRoundedFrame(218,118,582,382,20,3); #endif #if(FillRoundedRect) GUI_SetColor(RoundedRect); GUI_FillRoundedRect(220,120,580,380,20); #endif switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'ICcard' // hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); FRAMEWIN_SetClientColor( hItem, BACKCOLOR); FRAMEWIN_SetFont(hItem, GUI_FONT_8_1); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); // // Initialization of 'Button' // // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); // BUTTON_SetFont(hItem, &GUI_Fonthz_song30); // BUTTON_SetText(hItem, "返回 "); // #if(Button_3Dskin) // BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); //#endif //#if(!Button_3Dskin) // BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); // BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); //#endif // // Initialization of 'Button' // // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); // BUTTON_SetFont(hItem, GUI_FONT_13_1); // BUTTON_SetText(hItem, "exit"); //#if(Button_3Dskin) // BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); //#endif //#if(!Button_3Dskin) // BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); // BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); //#endif hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetText(hItem, "安徽绿建科技有限公司 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, &GUI_FontSong_60); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD."); TEXT_SetFont(hItem, GUI_FONT_24_ASCII); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem, &GUI_Fonthz_song30); TEXT_SetWrapMode(hItem,GUI_WRAPMODE_WORD); TEXT_SetText(hItem, "您好像没有刷卡,系统将在2S后自动退出 "); TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); TEXT_SetTextColor(hItem, 0x00FFFFFF); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_BUTTON_1: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; } }