static void winListen() { HWND hwndMain = CreateWindow( getClassName(), getWinTitle(), WS_OVERLAPPEDWINDOW & (~(WS_MAXIMIZEBOX | WS_SIZEBOX)), 0, 0, getWinWidth(), getWinHeight(), NULL, NULL, getMainInstance(), NULL); ShowWindow(hwndMain, SW_SHOWNORMAL); UpdateWindow(hwndMain); gHwnd = hwndMain; // paintInit(hwndMain); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } paintClean(hwndMain); }
void button::triggerControl(mainWin* mw) { //被触发 白色覆盖按钮 表示被按下 LCD_SetTextColor(WHITE); LCD_DrawFullRect(getWinXpos()+mw->getWinXpos(),getWinYpos()+mw->getWinYpos(),getWinWidth(),getWinHigh()); while(TouchUp != 1); TouchUp = 0; }
//是否在区域内 绝对地址 bool rootWin::isInArea(uint16_t wXpos,uint16_t wYpos) { if(wXpos >= getAbsoluteX() && wXpos <=(getAbsoluteX()+ getWinWidth()) && \ wYpos >= getAbsoluteY() && wYpos <=(getAbsoluteY()+ getWinHigh())) { return true; } return false; }
bool button::isInArea(uint16_t bXpos,uint16_t bYpos) { if(bXpos >= getWinXpos() && bXpos <=(getWinXpos()+ getWinWidth()) && \ bYpos >= getWinYpos() && bYpos <=(getWinYpos()+ getWinHigh())) { return true; } return false; }
void button::layoutControl(mainWin* mw) { //如果由控件图标,就用图标 /*if(icon){ }else{ LCD_SetTextColor(getBackColor()); LCD_DrawFullRect(getWinXpos()+mw->getWinXpos(),getWinYpos()+mw->getWinYpos(),getWinWidth(),getWinHigh()); }*/ //先这么用 LCD_SetTextColor(getBackColor()); LCD_DrawFullRect(getWinXpos()+mw->getWinXpos(),getWinYpos()+mw->getWinYpos(),getWinWidth(),getWinHigh()); }
void mainWin::styleInit() { switch(wsStyle) { case WS_DEFAULT: { setRwNum(3); comboBoxInit(); getRwList()[0] = new staticFrameWin(0,0,getWinWidth(),STAT_BAR,getWinName(),this,getQueue()); ((controlWin*)getRwList()[0])->setTextColor(WHITE); ((controlWin*)getRwList()[0])->setBackColor(BLACK); getRwList()[1] = new staticFrameWin(0,STAT_BAR,getWinWidth(),(getWinHigh()-STAT_BAR),NULL,this,getQueue()); ((controlWin* )getRwList()[1])->setBackColor(GREY); getRwList()[2] = new buttonWin(0,0,SYS_BTN_W,STAT_BAR,"x", getRwList()[0],getQueue()); ((controlWin* )getRwList()[2])->setTextColor(BLACK); ((controlWin* )getRwList()[2])->setBackColor(RED); getRwList()[2]->setWinProc(buttonWeakProc); backWin = getRwList()[1]; int i = 0; for(i=0;i < getRwNum();i++) { getRwList()[i]->registerWin(); } }break; case WS_BORDER: { }break; case WS_VSCROLL: { }break; case WS_HSCROLL: { }break; default:break; } }
void progressBarWin::paintWin() { //背景 LCD_SetTextColor(GREY1); LCD_DrawFullRect(getAbsoluteX(),getAbsoluteY(),getWinWidth(),getWinHigh()); //进度条 if(pBarWidth) { LCD_SetTextColor(BLUE); LCD_DrawFullRect(getAbsoluteX(),getAbsoluteY(),pBarWidth,getWinHigh()); } }
void virKeyboardWin::keyBoardInit() { char* keyb[] ={"`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+","delete", "tab" ,"q","w","e","r","t","y","u","i","o","p","[{","]}","\\|", "caps lock" ,"a","s","d","f","g","h","j","k","l",";:","'\"", "return" , "shift" ,"z","x","c","v","b","n","m",",<",".>","/?","shift", "ctrl" , "alt" ,"space", "alt" ,"ctrl" }; int i,j,temp; setRwNum(60); comboBoxInit(); uint16_t w = (getWinWidth()- getWinWidth()/29)/14; uint16_t h = getWinHigh()/6; uint8_t n ;//中间按键数量 uint16_t x;//x的位置 uint16_t wt; for(i=0;i<4;i++) //1-3 line { wt = w ; switch(i) { case 0:{n = 12;temp = 0;}break; case 1:{ wt += w/2; n = 12; } ;break; case 2:{ wt += w*3/4; n = 11; }break; case 3:{ wt += w+w/4; n = 10; }break; default:break; } getRwList()[temp] = new buttonWin(0,i*h,wt,h,keyb[temp],this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp])->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); for(j=0;j<n;j++) { temp ++; getRwList()[temp] = new buttonWin(wt,i*h,w,h,keyb[temp],this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp])->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); wt += w; } x = wt; temp ++;//每一行最后一个 wt = w; switch(i) { case 0:{wt += w/2;}break; case 1:{wt = w;}break; case 2:{wt += w*3/4;}break; case 3:{wt += w+w/4;}break; default:break; } getRwList()[temp] = new buttonWin(x,i*h,wt,h,keyb[temp],this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp])->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); temp ++; } //line 4 x = 2*w; for(i=0;i<5;i++) { if(i==2) { getRwList()[temp] = new buttonWin(x,4*h,w*5,h,keyb[temp],this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); x+=w*5; }else{ getRwList()[temp] = new buttonWin(x,4*h,w,h,keyb[temp],this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); x += w; } temp++; } getRwList()[temp] = new buttonWin(0,4*h,2*w,h,"V",this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); temp++; getRwList()[temp] = new buttonWin(x,4*h,3*w+w/2,h,"V",this,getQueue()); ((controlWin*)getRwList()[temp])->setTextColor(getTextColor()); ((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor()); getRwList()[temp]->setWinProc(keyboardProc); getRwList()[temp]->registerWin(); temp++; }
void progressBarWin::setProgressValue(uint8_t pv) { progressValue = pv; pBarWidth = pv*getWinWidth()/100;//设置相应的进度条宽度 paintBarWin(); }