コード例 #1
0
ファイル: clock.c プロジェクト: shuntianxia/86Box
H_WIN DrawClockCreate(char * name, SCR_ScrollingWndInfo_ForHeader * inherit)
{
    SCR_ScrollingWndInfo_ForHeader * wndInfo;
    H_WIN hWnd;

    hWnd = ScrollingAppendManage(name, inherit);
    if (hWnd) {
        wndInfo = (SCR_ScrollingWndInfo_ForHeader *)GUI_WinGetAttr(hWnd);
        ScrollingAppendPage("clock_page", wndInfo, 0, GG_NULL, inherit->ewii.lyrLow,NULL);//clockWndProc
        ScrollingAppendButton("clock_button", wndInfo, NULL, clockWndProc);
    }
    return hWnd;
}
コード例 #2
0
ファイル: txtbox.c プロジェクト: silview/C100A
__txtbox_data_t *GUI_TxtboxPrivCreate(H_WIN htxtbox)
{
    __u32                                   num;
    txtitem_t                              *txtitem;
    __rect_t                                rect;
    __txtbox_data_t                         *ptxtbox;
    __txtbox_para_t                         *txtbox_priv;
    __u32                                   item_w;
    __u32                                   size;

    ptxtbox = (__txtbox_data_t *)orange_malloc(sizeof(__txtbox_data_t));
    if(!ptxtbox)
    {
        return NULL;
    }

    orange_memset(ptxtbox,0,sizeof(__txtbox_data_t));

    txtbox_priv                         = (__txtbox_para_t *)GUI_WinGetAttr(htxtbox);
    ptxtbox->handle                     = htxtbox;
    /*item width equal font_size add four*/
    item_w                              = txtbox_priv->font_size + 2 *txtbox_priv->dist;
	ptxtbox->item_w					    = item_w;
    if(txtbox_priv->nitem == 0)
    {
        __HERE__
        ptxtbox->txtlayer               = (txtlayer_man_t*)TxtLayer_Create(GUI_WinGetLyrWin(htxtbox),(__hdle)ptxtbox,0);
    }
    else
    {
        __HERE__
        ptxtbox->txtlayer               = (txtlayer_man_t*)TxtLayer_Create(GUI_WinGetLyrWin(htxtbox),(__hdle)ptxtbox,item_w *txtbox_priv->nitem);
    }    
	ptxtbox->txtlayer->mode				= txtbox_priv->mode;
	ptxtbox->txtlayer->lastmode			= txtbox_priv->mode;
    ptxtbox->txtlayer->font_size 		= txtbox_priv->font_size;
    ptxtbox->txtlayer->bk_color         = txtbox_priv->bk_color;
    if(!ptxtbox->txtlayer)
    {
        __msg("txtlayer create failed!\n");
        goto  error;
    }

    for(num = 0;num < txtbox_priv->nitem;num++)
    {
        rect.width                     = ptxtbox->txtlayer->txtbuffer->rectsz.width;
        rect.height                    = item_w;
        /*TxtItem Create*/
        txtitem                       = txtitem_Create(&rect,&txtbox_priv->items[num]);
        /*TxtItem Add to txtbox*/
        TxtList_AddTail(ptxtbox->txtlayer->txtlist, txtitem);
    } 
    ptxtbox->txtlayer->txtlist->PrevItem = ptxtbox->txtlayer->txtlist->head;
    ptxtbox->txtlayer->scnnum            = ptxtbox->txtlayer->scnrect.height/item_w;
    
    size = (ptxtbox->txtlayer->txtlist->head->rect.height * 
            ptxtbox->txtlayer->txtlist->head->rect.width * 
            ptxtbox->txtlayer->txtlist->bpp + 7)>>3;

	ptxtbox->txtlayer->txtlist->ItemSize = size;
    
    ptxtbox->txtlayer->chg_fb = orange_pmalloc(size);
    if(!ptxtbox->txtlayer->chg_fb)
    {
        goto error;
    }

    ptxtbox->txtlayer->draw_font = txtbox_priv->txtfont; 
    ptxtbox->txtlayer->draw_code = txtbox_priv->txt_charen;
    
    return ptxtbox;

error:
    if(ptxtbox->txtlayer)
    {
    	if(ptxtbox->txtlayer->chg_fb)
		{
			orange_pfree(ptxtbox->txtlayer->chg_fb,ptxtbox->txtlayer->txtlist->ItemSize);
			ptxtbox->txtlayer->chg_fb = NULL;
		}
        TxtLayer_Destroy(ptxtbox->txtlayer);
    }

    if(ptxtbox)
    {
        orange_mfree(ptxtbox);
    }

    return NULL;
}      
コード例 #3
0
ファイル: home.c プロジェクト: shuntianxia/86Box
static HomeDescriptor * homeWndInit(__gui_msg_t * msg)
{
    HomeDescriptor * hdp;
    gg_handler domUIConfig;
    gg_handler node;
    char ** attr;
    int i;
	gg_handler toiteNode;
	gg_char * langid;
	int langid_int;

    hdp = esMEMS_Malloc(0, sizeof(HomeDescriptor));
    if (NULL == hdp) {
        LogE("Malloc failed");
        return NULL;
    }
    eLIBs_memset(hdp, 0, sizeof(HomeDescriptor));
    media_player_main("e:\\liu.mp3");
    /* UI config */
    domUIConfig = (gg_handler)GUI_WinGetAttr(msg->h_deswin);
    node = GG_DOMGetRoot(domUIConfig);
    if (0 == eLIBs_strcmp(GG_DOMGetNodeName(node), "config")) {
        LogE("UI config XML root node ok");
    } else {
        LogE("UI config XML root node error");
        return NULL;
    }
	toiteNode = GG_DOMGetRoot(domUIConfig);
	toiteNode = GG_DOMGetFirstChild(toiteNode);
	toiteNode = GG_DOMGetBrotherElementByTagName(toiteNode, "langid");
	langid = GG_DOMGetNodeValue(toiteNode);

    // Set the volume
    dsk_volume_set(100);
    homeSysTimeInit();
    GUI_SetScnDir(GUI_SCNDIR_NORMAL);
    dsk_display_set_lcd_bright(LION_BRIGHT_LEVEL15);

    hdp->ewii.magic = EWIN_INFO_MAGIC;
    hdp->ewii.desktop = msg->h_deswin;
    hdp->ewii.hWnd = hdp->ewii.desktop;
    GUI_GetScreenSize((__s32 *)&hdp->ewii.desktopSize.width, (__s32 *)&hdp->ewii.desktopSize.height);
    GG_FillRect(&hdp->ewii.wndRect, 0, 0,
                    hdp->ewii.desktopSize.width, hdp->ewii.desktopSize.height);
    // Initiate the font module
    hdp->ewii.gdi.font = GUI_SFT_CreateFont(CP_SYS_FONT_SIZE, CP_SYS_FONT_PATH);
    hdp->ewii.gdi.fontSize = CP_SYS_FONT_SIZE;
    hdp->ewii.gestureArgs.htimer = hdp->ewii.desktop;
    hdp->ewii.gestureArgs.timerid = HOME_GESTURE_TIMER;
    hdp->inertia = GG_GestureOpen();
    /* UI config */
    node = GG_DOMGetFirstChild(node);
    //node = GG_DOMGetBrotherElementByTagName(node, "window");
    if (node) {
		hdp->ewii.langid = SLIB_atoi(langid);
		//LogMI("hdp->ewii.langid %d",hdp->ewii.langid);
        hdp->hFocusWin = SCR_ScrollingHostBuilder(&hdp->ewii, ScrollingCreate_V0001, node);
		esDEV_Plugin("\\drv\\touchpanel.drv", 0, 0, 1);
    } else {
        LogE("No window node in XML file");
        return NULL;
    }
	Uart_inf_ini();
	slider_thread();
	return hdp;
}
コード例 #4
0
ファイル: home.c プロジェクト: shuntianxia/86Box
static __s32 homeWndProc(__gui_msg_t * msg)
{
    HomeDescriptor * hdp;
    H_WIN wndGesture;
    EWin_InheritInfo_ForHeader * extWinIfno;
	H_WIN hwnd;
    char name[20];
	
    hdp = (HomeDescriptor *)GUI_WinGetAddData(msg->h_deswin);
    if (NULL == hdp) {
        if (GUI_MSG_CREATE != msg->id) {
            LogE("Failed to get home window private date, message ID (%d)", msg->id);
            return GUI_ManWinDefaultProc(msg);
        }
    }
   
    switch (msg->id) {
    case GUI_MSG_CREATE:
        hdp = homeWndInit(msg);
        if (!hdp) {
            GUI_PostQuitMessage(msg->h_deswin);
            LogE("Create Home window failed");
            return -1;
        }
		if(hdp->ewii.suspend){
           GUI_SetTimer(msg->h_deswin,SUSPEND_TIMER,6000,NULL);
		}else{
           __msg("suspend is null");
		}
        GUI_WinSetAddData(msg->h_deswin, (__u32)hdp);
        GUI_WinSetFocusChild(hdp->hFocusWin);
        break;
    case GUI_MSG_DESTROY:
        GG_GestureClose(hdp->inertia);
        if (hdp->ewii.gdi.font) {
            GUI_SFT_ReleaseFont(hdp->ewii.gdi.font);
        }
        esMEMS_Mfree(0, hdp);
        break;
    case GUI_MSG_TOUCH:
#ifdef THIS_DEBUG
        //LogMI("Touch:%x,%d,%d", msg->dwAddData1, LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2));
#endif  
         if(standy_en){
	        if(hdp->ewii.suspend == 1){
		           dsk_display_lcd_on();
	        }else if(hdp->ewii.suspend == 2){
	            
			}else if(hdp->ewii.suspend == 3){
				GUI_LyrWinDelete(hdp->StandyWindow);
			}
			standy_en = 0;
			break;
         }
		 if(LOSWORD(msg->dwAddData2) > 320 || HISWORD(msg->dwAddData2) > 240){
		 	break;
		 }
		GUI_ResetTimer(msg->h_deswin,SUSPEND_TIMER,6000,NULL);
        if (GUI_MSG_TOUCH_DOWN == msg->dwAddData1) {
            wndGesture = EWin_GestureAttrCollect(GUI_WinGetFocusChild(msg->h_deswin), LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2));
            if (wndGesture) {
                extWinIfno = GUI_WinGetAttr(wndGesture);
                GG_GestureOnDown(hdp->inertia, msg, LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2), &extWinIfno->gestureArgs);
            }
        } else if (GUI_MSG_TOUCH_MOVE == msg->dwAddData1) {
            GG_GestureOnMove(hdp->inertia, msg, LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2));
        } else if (GUI_MSG_TOUCH_UP == msg->dwAddData1) {
            GG_GestureOnUp(hdp->inertia, msg, LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2));
        }else if(GUI_MSG_TOUCH_LONGDOWN == msg->dwAddData1){
            GG_GestureOnLpress(hdp->inertia, msg, LOSWORD(msg->dwAddData2), HISWORD(msg->dwAddData2));
		}
        break;
    case GUI_MSG_TIMER:
        if (HOME_GESTURE_TIMER == msg->dwAddData1) {
            GG_GestureOnTimer(hdp->inertia, msg);
        }else if(SUSPEND_TIMER == msg->dwAddData1){
         	if(!standy_en){
	            if(hdp->ewii.suspend==1){
	                 dsk_display_lcd_off();
					 //standy_en = 1;
				}else if(hdp->ewii.suspend==2){
	                 msg->h_deswin = GUI_WinGetFocusChild(msg->h_deswin);
					 msg->id = GUI_MSG_USER_GESTURE_DONE;
					 msg->dwAddData2 = MAKELONG(320,0);
					 GUI_PostMessage(msg);
					 //standy_en = 1;
				}else if(hdp->ewii.suspend==3){
					 hdp->StandyWindow = StandyWndCreate("d:\\res\\boot_ui\\logo.bmp");
				}else{
	                
				}
				standy_en = 1;
         	}
		}
        break;
    case GUI_MSG_USER_WIN_CHANGE:
        if (HOME_SUBWIN_UPDATE == msg->dwAddData2) {
			GUI_LyrWinSetSta(hdp->ewii.lyrLow,GUI_LYRWIN_STA_SLEEP);
			GUI_LyrWinSetSta(hdp->ewii.lyrHigher,GUI_LYRWIN_STA_SLEEP);
			GUI_LyrWinSetSta(hdp->ewii.inilyrHigher,GUI_LYRWIN_STA_SLEEP);
            hdp->hFocusWin = SettingWndCreate(&hdp->ewii);
			if(hdp->hFocusWin){
            	GUI_WinSetFocusChild(hdp->hFocusWin);
			}
        }else if(HOME_SUBWIN_SETTING_TIME== msg->dwAddData2){
			GUI_LyrWinSetSta(hdp->ewii.inilyrHigher,GUI_LYRWIN_STA_SLEEP);
			GUI_LyrWinSetSta(hdp->ewii.lyrHigher,GUI_LYRWIN_STA_SLEEP);
			GUI_LyrWinSetSta(hdp->ewii.lyrLow,GUI_LYRWIN_STA_SLEEP);
            hdp->hFocusWin = Setting_TimeWndCreate(&hdp->ewii);
			if(hdp->hFocusWin){
            	GUI_WinSetFocusChild(hdp->hFocusWin);
			}
		}else {
            if(GUI_ManWinDelete(hdp->hFocusWin)==ORANGE_OK){
            	GUI_WinSetFocusChild(GUI_WinGetFirstChild(msg->h_deswin));
			    GUI_LyrWinSetSta(hdp->ewii.lyrLow,GUI_LYRWIN_STA_ON);
				GUI_LyrWinSetSta(hdp->ewii.lyrHigher,GUI_LYRWIN_STA_ON);
				GUI_LyrWinSetSta(hdp->ewii.inilyrHigher,GUI_LYRWIN_STA_ON);
            }
        }
        break;
    default:
#ifdef THIS_DEBUG
//        LogMI("Unhandled home window message (%d)", msg->id);
#endif
		GUI_ManWinDefaultProc(msg);
        break;
    }
    return 0;
}
コード例 #5
0
ファイル: clock.c プロジェクト: shuntianxia/86Box
static __s32 clockWndProc(__gui_msg_t * msg)
{
    __u32 clockhands[CLOCKHANDS];
    FB fb;

    HTHEME hback;
    HBLOCK block;
    void * pic;
    int length;
    int start_x;
    int start_y;

    ClockPrivate * draw;
    draw = (ClockPrivate *)GUI_WinGetAttr(msg->h_deswin);
    if ((!draw) || (-1 == EWin_CheckInherit(&draw->scrolling.ewii)) ||
        (!(draw->scrolling.ewii.mask[0] & SCR_WNDINFOMASK_SBUTTON))) {
        LogE("Null or wrong scrolling page window private data");
        return -1;
    }
    switch (msg->id) {
    case GUI_MSG_CREATE:
		draw->scrolling.ewii.mask[0] |= SCR_WNDINFOMASK_GESTURE;
        clockhands[0] = ID_CLOCK_PNG_DIG_HAND_H1_BMP;
        clockhands[1] = ID_CLOCK_PNG_DIG_HAND_H2_BMP;
        clockhands[2] = ID_CLOCK_PNG_DIG_HAND_H3_BMP;
        clockhands[3] = ID_CLOCK_PNG_DIG_HAND_H4_BMP;
        clockhands[4] = ID_CLOCK_PNG_DIG_HAND_H5_BMP;
        clockhands[5] = ID_CLOCK_PNG_DIG_HAND_H6_BMP;
        clockhands[6] = ID_CLOCK_PNG_DIG_HAND_H7_BMP;
        clockhands[7] = ID_CLOCK_PNG_DIG_HAND_H8_BMP;
        draw->hhdl = picswap_quadrant_begin(clockhands, 25, 80);
        clockhands[0] = ID_CLOCK_PNG_DIG_HAND_M1_BMP;
        clockhands[1] = ID_CLOCK_PNG_DIG_HAND_M2_BMP;
        clockhands[2] = ID_CLOCK_PNG_DIG_HAND_M3_BMP;
        clockhands[3] = ID_CLOCK_PNG_DIG_HAND_M4_BMP;
        clockhands[4] = ID_CLOCK_PNG_DIG_HAND_M5_BMP;
        clockhands[5] = ID_CLOCK_PNG_DIG_HAND_M6_BMP;
        clockhands[6] = ID_CLOCK_PNG_DIG_HAND_M7_BMP;
        clockhands[7] = ID_CLOCK_PNG_DIG_HAND_M8_BMP;
        draw->mhdl = picswap_quadrant_begin(clockhands, 25, 80);
        clockhands[0] = ID_CLOCK_PNG_DIG_HAND_S1_BMP;
        clockhands[1] = ID_CLOCK_PNG_DIG_HAND_S2_BMP;
        clockhands[2] = ID_CLOCK_PNG_DIG_HAND_S3_BMP;
        clockhands[3] = ID_CLOCK_PNG_DIG_HAND_S4_BMP;
        clockhands[4] = ID_CLOCK_PNG_DIG_HAND_S5_BMP;
        clockhands[5] = ID_CLOCK_PNG_DIG_HAND_S6_BMP;
        clockhands[6] = ID_CLOCK_PNG_DIG_HAND_S7_BMP;
        clockhands[7] = ID_CLOCK_PNG_DIG_HAND_S8_BMP;
        draw->shdl = picswap_quadrant_begin(clockhands, 25, 80);
        draw->bgicon = ID_CLOCK_BMP_DIGITALCLOCK_BG_BMP;
        GUI_LyrWinGetFB(draw->scrolling.ewii.lyrLow, &fb);
        draw->bgblock = GUI_BlockCreateFrom(NULL, fb.size.width, fb.size.height, fb.addr[0], 0);
        GUI_LyrWinGetFB(draw->scrolling.ewii.lyrHigher, &fb);
        draw->forgblock = GUI_BlockCreateFrom(NULL, fb.size.width, fb.size.height, fb.addr[0], 0);
        esTIME_GetTime(&draw->tm);
		draw->minute = draw->tm.minute;
        draw->invalidate |= INVALIDATE_BACKGROUND|INVALIDATE_FOREGROUND;
        break;
    case GUI_MSG_DESTROY:
        GUI_BlockDelete(draw->forgblock);
        GUI_BlockDelete(draw->bgblock);
        picswap_quadrant_end(draw->shdl);
        picswap_quadrant_end(draw->mhdl);
        picswap_quadrant_end(draw->hhdl);
        esMEMS_Mfree(0, draw);
        break;
    case GUI_MSG_PAINT:
        if (draw->invalidate & INVALIDATE_BACKGROUND) {
#ifdef THIS_DEBUG
            log_d("Invalidate background");
#endif
            GUI_LyrWinSel(draw->scrolling.ewii.lyrLow);
            hback = dsk_Systheme_open(draw->bgicon);
            pic = dsk_Systheme_hdl2buf(hback);
            GUI_BMP_Draw(pic, draw->scrolling.wndRect.x, draw->scrolling.wndRect.y);
            dsk_theme_close(hback);
            pic = picget_clock_pic(draw->hhdl, (draw->tm.hour % 12) * 5 + (draw->tm.minute / 12), &length, &start_x, &start_y);
            block = GUI_BlockCreateFrom(NULL, length, length, pic, 0);
            GUI_BlockBitBlit(draw->bgblock, draw->scrolling.wndRect.x + start_x + WATCH_OFFSET_X,
                draw->scrolling.wndRect.y + start_y + WATCH_OFFSET_Y,
                block, NULL, BLITFLAG_COLORALPHA, NULL);
            GUI_BlockDelete(block);
            pic = picget_clock_pic(draw->mhdl, draw->tm.minute, &length, &start_x, &start_y);
            block = GUI_BlockCreateFrom(NULL, length, length, pic, 0);
            GUI_BlockBitBlit(draw->bgblock, draw->scrolling.wndRect.x + start_x + WATCH_OFFSET_X,
                draw->scrolling.wndRect.y + start_y + WATCH_OFFSET_Y,
                block, NULL, BLITFLAG_COLORALPHA, NULL);
            GUI_BlockDelete(block);
        }
        
		if (draw->invalidate & INVALIDATE_FOREGROUND) {
			GUI_LyrWinSel(draw->scrolling.ewii.lyrHigher);
			GUI_SetBkColor(0);
            GUI_ClearRect(draw->scrolling.wndRect.x, draw->scrolling.wndRect.y,
                draw->scrolling.wndRect.x + draw->scrolling.wndRect.width, draw->scrolling.wndRect.y + draw->scrolling.wndRect.height);
        }
        pic = picget_clock_pic(draw->shdl, draw->tm.second, &length, &start_x, &start_y);
        block = GUI_BlockCreateFrom(NULL, length, length, pic, 0);
        GUI_BlockBitBlit(draw->forgblock, draw->scrolling.wndRect.x + start_x + WATCH_OFFSET_X,
            draw->scrolling.wndRect.y + start_y + WATCH_OFFSET_Y,
            block, NULL, BLITFLAG_COLORSET, NULL);
        GUI_BlockDelete(block);

        draw->invalidate = INVALIDATE_NULL;
        break;
    //case GUI_MSG_USER_REPAINT_NEIGHBOR:
        //draw->invalidate |= (INVALIDATE_BACKGROUND | INVALIDATE_FOREGROUND);
    case GUI_MSG_TIMER:
        esTIME_GetTime(&draw->tm);
        if (draw->minute != draw->tm.minute) {
            draw->minute = draw->tm.minute;
            draw->invalidate |= INVALIDATE_BACKGROUND;
        }
#ifdef THIS_DEBUG
        log_mi("time: %d,%d,%d", draw->tm.hour, draw->tm.minute, draw->tm.second);
        log_mi("Date: %d,%d,%d", draw->date.year, draw->date.month, draw->date.day);
#endif
        __here__;
        GUI_WinUpdate(msg->h_deswin, ORANGE_TRUE);
        break;
    case GUI_MSG_SET_FOCUS:
        draw->invalidate |= (INVALIDATE_BACKGROUND | INVALIDATE_FOREGROUND);
        GUI_SetTimer(msg->h_deswin, 1, 100, NULL);
		__msg("12");
        return 0;
    case GUI_MSG_SET_UNFOCUS:
        GUI_KillTimer(msg->h_deswin, 1);
        return 0;
    default:
        break;
    }

    return GUI_FrmWinDefaultProc(msg);
}
コード例 #6
0
ファイル: static.c プロジェクト: silview/C100A
static int StaticCtrlProc (__gui_msg_t *msg)
{
    __u32	            	dwStyle;
    static_data_t*			pData;

    dwStyle = GUI_WinGetStyle(msg->h_deswin);

    switch(msg->id)
    {
        case GUI_MSG_CREATE:
            pData = (static_data_t*) orange_malloc(sizeof(static_data_t));
            if (pData == NULL) 
            {
                return ORANGE_FAIL;
            }

            pData->status       = 0;
            pData->hmem         = 0;
            pData->str_move     = 0;
            pData->data         = (__u32)GUI_WinGetAttr(msg->h_deswin);
            GUI_CtrlWinSetAddData(msg->h_deswin,(__u32)pData);
            return 0;
       
        case GUI_MSG_DESTROY:
            pData = (static_data_t*)GUI_CtrlWinGetAddData(msg->h_deswin);
            if(pData->str_move)
            {
                GUI_LongStringDelete(pData->str_move);
            }
            orange_mfree ((void *)GUI_CtrlWinGetAddData(msg->h_deswin));
            return 0;
        
        case GUI_MSG_ENABLE:
            if (msg->dwAddData1 && (dwStyle & WS_DISABLED))
            {
                dwStyle &= ~WS_DISABLED;

                GUI_WinSetStyle(msg->h_deswin,dwStyle);
            }
            else if (!msg->dwAddData1 && !(dwStyle & WS_DISABLED))
            {
                dwStyle |= WS_DISABLED;

                GUI_WinSetStyle(msg->h_deswin,dwStyle);
            }
            else
            {
                return 0;
            }
            return 0;
            
        case GUI_MSG_SET_UNFOCUS:
            if((STATIC_DRAWSTATUS(msg->h_deswin) & STATICST_FOCUS))
            {
                STATIC_DRAWSTATUS(msg->h_deswin) &= (~STATICST_FOCUS);
                

    			GUI_InvalidateRect (msg->h_deswin, NULL, ORANGE_TRUE);
            }
            return 0;

        case GUI_MSG_SET_FOCUS:          
            if(!(STATIC_DRAWSTATUS(msg->h_deswin) & STATICST_FOCUS))
            {
                STATIC_DRAWSTATUS(msg->h_deswin) |= STATICST_FOCUS;

    			GUI_InvalidateRect (msg->h_deswin, NULL, ORANGE_TRUE);
            }
            return 0;
        
        case GUI_MSG_KEY:
			switch(msg->dwAddData1)
			{
				/*case GUI_MSG_KEY_RISE:
				{
					{
						__gui_notify_msg_t      notify_msg;

		                notify_msg.hWnd     = msg->h_deswin;
		                notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                notify_msg.msgcode  = STN_CLICKED;
		                notify_msg.dwAddData= last_key;
		                    
		                GUI_NotifyParent (&notify_msg);
		            }
				}
                return 0;*/
                
				case GUI_MSG_KEY_DOWN:
				{
					if(msg->dwAddData2 == KEY_UP_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;

		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_CLICKED;
		                	notify_msg.dwAddData= last_key;
		                    
		                GUI_NotifyParent (&notify_msg);
		            	}
					}

					if(msg->dwAddData2 == KEY_DOWN_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;

		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_PUSHED;
		                	notify_msg.dwAddData= GUI_MSG_KEY_DOWN;
		                    
		                	GUI_NotifyParent (&notify_msg);
		            	}
					}
		            
				}
                return 0;
                
				case GUI_MSG_KEY_ENTER:
				{
					if(msg->dwAddData2 == KEY_UP_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;

		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_CLICKED;
		                	notify_msg.dwAddData= last_key;
		                    
		                GUI_NotifyParent (&notify_msg);
		            	}
					}

					if(msg->dwAddData2 == KEY_DOWN_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;
	
		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_PUSHED;
		                	notify_msg.dwAddData= GUI_MSG_KEY_ENTER;
		                    
		                	GUI_NotifyParent (&notify_msg);
		            	}
					}
		            
				}

                return 0;
                
				case GUI_MSG_KEY_RIGHT:
				case GUI_MSG_KEY_LEFT:
				case GUI_MSG_KEY_UP:
				default:
                {
					if(msg->dwAddData2 == KEY_UP_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;

		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_CLICKED;
		                	notify_msg.dwAddData= last_key;
		                    
		                GUI_NotifyParent (&notify_msg);
		            	}
					}

					if(msg->dwAddData2 == KEY_DOWN_ACTION)
					{
						{
							__gui_notify_msg_t      notify_msg;
	
		                	notify_msg.hWnd     = msg->h_deswin;
		                	notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
		                	notify_msg.msgcode  = STN_PUSHED;
		                	notify_msg.dwAddData= msg->dwAddData1;
		                    
		                	GUI_NotifyParent (&notify_msg);
		            	}
					}
					
                }
				break;
					
			}

            /*if(msg->dwAddData1 != GUI_MSG_KEY_RISE)
            {
                last_key = msg->dwAddData1;
            }
            else
            {
                last_key = 0xffffffff;
            }*/
            last_key = msg->dwAddData1;
            
        return 0;
        
        case GUI_MSG_TOUCH:
			{
				switch(msg->dwAddData1)
				{
					case GUI_MSG_TOUCH_DOWN:
					{
						{
							__gui_notify_msg_t      notify_msg;

			                notify_msg.hWnd     = msg->h_deswin;
			                notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
			                notify_msg.msgcode  = STN_PUSHED;
			                notify_msg.dwAddData= 0;
			                    
			                GUI_NotifyParent (&notify_msg);
						}		            
					}
					break;
					
					case GUI_MSG_TOUCH_UP:
					{
						{
							__gui_notify_msg_t      notify_msg;

			                notify_msg.hWnd     = msg->h_deswin;
			                notify_msg.id       = GUI_WinGetItemId(msg->h_deswin);
			                notify_msg.msgcode  = STN_CLICKED;
			                notify_msg.dwAddData= 0;
			                    
			                GUI_NotifyParent (&notify_msg);
				         }
					}
					break;	
				}
			}
            
        return 0;

        case GUI_MSG_WIN_WAKEUP:
        case GUI_MSG_PAINT:
        {
			__gui_rect_t 	rcrect;
            RECT            fbrect;
			//void         	*pBMP;
            static_data_t   *static_data;
			static_para_t  	*user_data;
			//__u32			 color;

            //static_data = (static_para_t *)GUI_CtrlWinGetAddData(msg->h_deswin);

			user_data   = (static_para_t *)(((static_data_t *)GUI_CtrlWinGetAddData(msg->h_deswin))->data);
            static_data = (static_data_t *)GUI_CtrlWinGetAddData(msg->h_deswin);

            GUI_LyrWinSel(GUI_LyrP2H(GUI_WinGetLyrWin(msg->h_deswin)));
            
            GUI_WinGetClientFBRect(msg->h_deswin,&fbrect);
            if(!static_data->hmem && (GUI_WinGetStyle(msg->h_deswin) & WS_MEMDEV))
            {
            	#if GUI_CORE_MEMDEV_EN		//avoid complier error, by Derek
                static_data->hmem = GUI_MEMDEV_Create(fbrect.x,fbrect.y,fbrect.width,fbrect.height);
				#endif
            }
			SysRectToGuiRect(&fbrect,&rcrect);

			if(static_data->hmem)
			{
				#if GUI_CORE_MEMDEV_EN		//avoid complier error, by Derek
            	GUI_MEMDEV_Select(static_data->hmem);           // start memory device
            	#endif
        	}
				
        	if (STATIC_DRAWSTATUS(msg->h_deswin) & STATICST_FOCUS)
            {	
                GUI_RECT        rect;
                
                GUI_SetBkColor(user_data->bk_color);
            	GUI_ClearRect(rcrect.left,rcrect.top,
                 			rcrect.right,rcrect.bottom);

                if(user_data->focus_bmp)
                {
                    GUI_BMP_Draw(user_data->focus_bmp, rcrect.left + user_data->bmp_pos.x, 
    					rcrect.top + user_data->bmp_pos.y);
                }
				
				if(user_data->alpha_en)
                {
                    GUI_OpenAlphaBlend();
                }
                
				GUI_CharSetToEncode(user_data->draw_code);
				GUI_SetFont(user_data->draw_font);

				GUI_SetDrawMode(GUI_DRAWMODE_TRANS);
			    GUI_SetColor(user_data->ftxt_color);

                rect.x0 = rcrect.left;
                rect.y0 = rcrect.top;
                rect.x1 = rcrect.right;
                rect.y1 = rcrect.bottom;
                if(!user_data->txt_align)
                {
    			    GUI_DispStringAt(user_data->text,
    			                     rcrect.left + user_data->text_pos.x, 
    					            rcrect.top + user_data->text_pos.y);
                }
                else
                {
                    GUI_DispStringInRect(user_data->text,&rect,user_data->txt_align);
                }
            }
            else
            {
                GUI_RECT        rect;
                
                GUI_SetBkColor(user_data->bk_color);
				
            	GUI_ClearRect(rcrect.left,rcrect.top,
                 			rcrect.right,rcrect.bottom);

                if(user_data->unfocus_bmp)
                {
                    GUI_BMP_Draw(user_data->unfocus_bmp, rcrect.left + user_data->bmp_pos.x, 
    					rcrect.top + user_data->bmp_pos.y);
                }
				
				if(user_data->alpha_en)
                {
                    GUI_OpenAlphaBlend();
                }
                
				GUI_CharSetToEncode(user_data->draw_code);
				GUI_SetFont(user_data->draw_font);

				GUI_SetDrawMode(GUI_DRAWMODE_TRANS);
			    GUI_SetColor(user_data->uftxt_color);

                rect.x0 = rcrect.left;
                rect.y0 = rcrect.top;
                rect.x1 = rcrect.right;
                rect.y1 = rcrect.bottom;
                
			    if(!user_data->txt_align)
                {
    			    GUI_DispStringAt(user_data->text,
    			                     rcrect.left + user_data->text_pos.x, 
    					            rcrect.top + user_data->text_pos.y);
                }
                else
                {
                    GUI_DispStringInRect(user_data->text,&rect,user_data->txt_align);
                }
            }
            if(static_data->hmem)
            {
            	#if GUI_CORE_MEMDEV_EN		//avoid complier error, by Derek
	            GUI_MEMDEV_CopyToLCD( static_data->hmem );          // copy from memory device to fb
		        GUI_MEMDEV_Select( NULL );                    // stop memory device
		        GUI_MEMDEV_Delete(static_data->hmem);
				#endif
	            static_data->hmem = NULL;
        	}

            if(user_data->alpha_en)
            {
                GUI_CloseAlphaBlend();
            }

            GUI_LyrWinFlushFB(GUI_WinGetLyrWin(msg->h_deswin));
        }
        return 0;

        default:
        break;
    }
    
    return GUI_CtrlWinDefaultProc (msg);
}
コード例 #7
0
ファイル: spinbox.c プロジェクト: silview/C100A
/*
**********************************************************************************************************************
*                                               _spinbox_ctrl_proc
*
* author:           
*
* date:             2009-8-4
*
* Description:      spinboxctrlproc 
*
* parameters:       
*
* return:           if success return ERDK_OK
*                   if fail return the number of fail
* modify history: 
**********************************************************************************************************************
*/
static int _spinbox_ctrl_proc (__gui_msg_t *msg)
{
	__u32					dwStyle;
	spinbox_data_t* 		pData;

	dwStyle = GUI_WinGetStyle(msg->h_deswin);

	switch(msg->id)
	{
		case GUI_MSG_CREATE:
			pData = (spinbox_data_t*) esMEMS_Malloc( 0, sizeof(spinbox_data_t) );
			if (pData == NULL) 
			{
				return EPDK_FAIL;
			}
			
			pData->draw_sts 	= 0;
			pData->status		= 0;
			pData->draw_flag 	= 0;
			pData->hmem 		= 0;
			pData->data 		= (__u32)GUI_WinGetAttr(msg->h_deswin);
			GUI_CtrlWinSetAddData(msg->h_deswin,(__u32)pData);
			return 0;
	   
		case GUI_MSG_DESTROY:
			pData = (spinbox_data_t*)GUI_CtrlWinGetAddData(msg->h_deswin);
			esMEMS_Mfree ( 0, (void *)GUI_CtrlWinGetAddData(msg->h_deswin) );
			return 0;

		case GUI_MSG_ENABLE:
			if (msg->dwAddData1 && (dwStyle & WS_DISABLED))
			{
				dwStyle &= ~WS_DISABLED;

				GUI_WinSetStyle(msg->h_deswin,dwStyle);
			}
			else if (!msg->dwAddData1 && !(dwStyle & WS_DISABLED))
			{
				dwStyle |= WS_DISABLED;

				GUI_WinSetStyle(msg->h_deswin,dwStyle);
			}
			else
			{
				return 0;
			}
			return 0;
	
		case GUI_MSG_SET_UNFOCUS:
			if(SPINBOX_STATUS(msg->h_deswin) & BST_FOCUS)
			{
				SPINBOX_STATUS(msg->h_deswin) &= (~BST_FOCUS);

				GUI_InvalidateRect (msg->h_deswin, NULL, EPDK_TRUE);
			}

			return 0;

		case GUI_MSG_SET_FOCUS:
			if(!(SPINBOX_STATUS(msg->h_deswin) & BST_FOCUS))
			{
				SPINBOX_STATUS(msg->h_deswin) |= BST_FOCUS;

				GUI_InvalidateRect (msg->h_deswin, NULL, EPDK_TRUE);
			}
			return 0;		
		
		case GUI_MSG_KEY:
			_key_proc(msg);
			return 0;
		
		case GUI_MSG_TOUCH:
			_touch_proc(msg);
			return 0;
	
		case GUI_MSG_PAINT:
			_spinbox_ctrl_paint(msg);
			return 0;

		default:
			break;
	}
	
	return GUI_CtrlWinDefaultProc (msg);
}