Esempio n. 1
0
/**
  * @brief  Callback function of the process manager dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbProcessManagerDialog(WM_MESSAGE * pMsg) {
  WM_HWIN  hItem;
  int      NCode;
  int      Id, Idx;

  switch (pMsg->MsgId) {
    
  case WM_INIT_DIALOG:

    hItem = pMsg->hWin;
    FRAMEWIN_SetTitleVis(hItem, 0);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_PROCESSMANAGER);
    LISTVIEW_AddColumn(hItem, 170, "Tasks", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_AddColumn(hItem, 60, "Priority", GUI_TA_HCENTER | GUI_TA_VCENTER);
    LISTVIEW_AddColumn(hItem, 70, "State", GUI_TA_HCENTER | GUI_TA_VCENTER);
    
    LISTVIEW_SetGridVis(hItem, 1);
    LISTVIEW_SetTextAlign(hItem, 0, GUI_TA_LEFT);
    LISTVIEW_SetTextAlign(hItem, 1, GUI_TA_HCENTER);
    LISTVIEW_SetTextAlign(hItem, 2, GUI_TA_HCENTER);
    HEADER_SetDragLimit(LISTVIEW_GetHeader(hItem), 1);
    LISTVIEW_SetCompareFunc(hItem, 1, LISTVIEW_CompareDec);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_SELFOCUS, GUI_LIGHTBLUE);  
  
    for (Idx = 0; Idx < 16 ; Idx ++)
    {
      LISTVIEW_AddRow(hItem, NULL);
    }
  
    _UpdateProcessManagerView(hItem);
    
    WM_CreateWindowAsChild(470, 0, 10, 10, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbTaskWindow , 0); 
    break;

  case WM_PAINT:
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_PROCESSMANAGER);
    _UpdateProcessManagerView(hItem);
    break;

  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_CANCEL_PROCESSMANAGER: /* Notifications sent by 'Cancel' button */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        hProcess = 0;       
        break;
      }
      break;
    case ID_LISTVIEW_PROCESSMANAGER: /* Notifications sent by 'Listview' */
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Esempio n. 2
0
/**
  * @brief  Callback routine of Info dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE 
  * @retval None
  */
static void _cbPlaylistDialog(WM_MESSAGE * pMsg) {
  int     NCode;
  int     Id;
  int     r;
  WM_HWIN hItem;

  static char tmp[64];
  uint32_t i = 0;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OKPL);
    WM_SetCallback(hItem, _cbButton_okPL);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_ADDPL);
    WM_SetCallback(hItem, _cbButton_add2PL);   
    
    
    hItem = LISTVIEW_CreateEx(60, 30, 300, 250, pMsg->hWin, WM_CF_SHOW, 0, ID_VIDEO_LIST);

    LISTVIEW_SetFont(hItem, &GUI_Font16_1);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_UNSEL, 0x00DCA939);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_SEL, GUI_WHITE);
    LISTVIEW_SetHeaderHeight(hItem, 0);
    LISTVIEW_AddColumn(hItem, 300, "", GUI_TA_VCENTER | GUI_TA_LEFT);
    LISTVIEW_SetGridVis(hItem, 0);
    LISTVIEW_SetAutoScrollV(hItem, 1);  
    WIDGET_SetEffect(hItem, &WIDGET_Effect_None);
    LISTVIEW_SetTextAlign(hItem, 0, GUI_TA_HCENTER); 
    
    if(VideoList.ptr > 0)
    {
      for(i=0; i<VideoList.ptr; i++)
      {
        strcpy(FileInfo.pRoot, (char *)VideoList.file[i].name);
        FILEMGR_GetFileOnly ((char *)tmp, (char *)FileInfo.pRoot);
        hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
        
        LISTVIEW_AddRow(hItem, NULL);         
        LISTVIEW_SetItemText(hItem, 0, i, (char *)tmp);
      }
    }     
    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;   
    switch(Id) {
    case ID_BUTTON_OKPL: /* Notifications sent by 'OK' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0); 
        break;
      }
      break;
      
    case ID_BUTTON_ADDPL: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        FileInfo.pfGetData = k_GetData;
        FileInfo.pMask = acMask_video;     
        hItem = CHOOSEFILE_Create(pMsg->hWin, 48, 30, 330, 240, apDrives, GUI_COUNTOF(apDrives), 0, "Video files", 0, &FileInfo);
        WM_MakeModal(hItem);
        r = GUI_ExecCreatedDialog(hItem);
        if (r == 0) 
        {
          if((strstr(FileInfo.pRoot, ".emf")) || (strstr(FileInfo.pRoot, ".EMF")))
          {
            if(VideoList.ptr < FILEMGR_LIST_DEPDTH)
            {
              strcpy((char *)VideoList.file[VideoList.ptr].name, FileInfo.pRoot);
              FILEMGR_GetFileOnly ((char *)tmp, (char *)FileInfo.pRoot);
              hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
              
              LISTVIEW_AddRow(hItem, NULL);         
              LISTVIEW_SetItemText(hItem, 0, VideoList.ptr, (char *)tmp);
              VideoList.ptr++;
            }
          }
          WM_InvalidateWindow(pMsg->hWin);
        }
        
        break;
      }
      break;        
      
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Esempio n. 3
0
/*********************************************************************
*
*       _Demo
*/
static void _Demo(void) {
  unsigned int i, j;
  int Key = 0;
  int Cnt = 15;
  char acInfoText[] = "-- sec to play with header control";
  HEADER_Handle hHeader;
  hHeader = LISTVIEW_GetHeader(_hListView);
  WM_SetFocus(_hListView);
  _ChangeInfoText("LISTVIEW_AddColumn");
  LISTVIEW_AddColumn(_hListView, 100, "EAN",         GUI_TA_CENTER);
  GUI_Delay(SPEED / 2);
  LISTVIEW_AddColumn(_hListView,  50, "Order #\0x0", GUI_TA_CENTER);
  GUI_Delay(SPEED / 2);
  LISTVIEW_AddColumn(_hListView, 100, "Description", GUI_TA_CENTER);
  GUI_Delay(SPEED / 2);
  _ChangeInfoText("SCROLLBAR_CreateAttached");
  SCROLLBAR_CreateAttached(_hListView, SCROLLBAR_CF_VERTICAL);
  GUI_Delay(SPEED / 2);
  _ChangeInfoText("LISTVIEW_AddRow");
  for (i = 0; i < GUI_COUNTOF(_aTable_1); i++) {
    LISTVIEW_AddRow(_hListView, _aTable_1[i]);
    GUI_Delay(SPEED / 3);
  }
  _ChangeInfoText("LISTVIEW_IncSel");
  for (i = 0; i < LISTVIEW_GetNumRows(_hListView); i++) {
    LISTVIEW_IncSel(_hListView);
    GUI_Delay(SPEED / 4);
  }
  GUI_Delay(SPEED / 4);
  _ChangeInfoText("LISTVIEW_DecSel");
  for (i = 0; i < LISTVIEW_GetNumRows(_hListView); i++) {
    LISTVIEW_DecSel(_hListView);
    GUI_Delay(SPEED / 4);
  }
  GUI_Delay(SPEED / 4);
  _ChangeInfoText("LISTVIEW_SetTextAlign");
  LISTVIEW_SetTextAlign(_hListView, 0, GUI_TA_RIGHT);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("LISTVIEW_SetColumnWidth");
  LISTVIEW_SetColumnWidth(_hListView, 1, 70);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("HEADER_SetTextColor");
  HEADER_SetTextColor(hHeader, GUI_BLUE);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("LISTVIEW_SetItemText");
  for (i = 0; i < GUI_COUNTOF(_aTable_2); i++) {
    for (j = 0; j < GUI_COUNTOF(_aTable_2[i]); j++) {
      LISTVIEW_SetItemText(_hListView, j, i, _aTable_2[i][j]);
    }
  }
  GUI_Delay(SPEED / 2);
  _ChangeInfoText("LISTVIEW_SetBkColor");
  LISTVIEW_SetBkColor(_hListView, 0, GUI_YELLOW);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("LISTVIEW_SetGridVis");
  LISTVIEW_SetGridVis(_hListView, 1);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("HEADER_SetHeight");
  HEADER_SetHeight(hHeader, 30);
  GUI_Delay(SPEED * 0.7);
  _ChangeInfoText("HEADER_SetBitmapEx");
  HEADER_SetBitmap(hHeader, 0, &bmBarCode);
  GUI_Delay(SPEED * 0.7);
  while ((Key != GUI_KEY_ENTER) && (Cnt > 0)) {
    acInfoText[0] = '0' + (Cnt / 10);
    acInfoText[1] = '0' + (Cnt-- % 10);
    _ChangeInfoText(acInfoText);
    GUI_Delay(1000);
    Key = GUI_GetKey();
  }
}
Esempio n. 4
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
	
	WM_HWIN hWin;
	WM_HWIN hText;
	const WM_KEY_INFO* pInfo;
	WM_HWIN  hItem  = 0;
  int     i  = 0;
  int     NCode;
  int     Id;
	hWin = pMsg->hWin;
  // USER START (Optionally insert additional variables)
  // USER END
  switch (pMsg->MsgId) 
	{
		  case USER_MSG_LANGUAGE:
					    InfoSel(0,1);
					    break;
				case WM_PAINT:
									GUI_SetBkColor(GUI_WHITE);
									GUI_Clear();
									GUI_SetColor(GUI_BLACK);
									GUI_AA_DrawLine(190,0,220,60);
									GUI_AA_DrawLine(220,60,800,60);
// 				     if (Language == 0)
// 									{
// 									   GUI_DispStringAt("所处      页/共      页",560,435);	
// 									}
// 									else
// 									{
//   										GUI_DispStringAt (pLanguage->Page,560,435);
// 									}
// 										 	GUI_DispDecAt(thispage,605,435,3);
// 							   		GUI_DispDecAt(pageNum,700,435,3);
									//GUI_DispStringAt("高电压警告",230,28);
				     GUI_PNG_Draw(&acPOWER,sizeof(acPOWER),755,35);

									break;
		
		case WM_INIT_DIALOG:
			
			    pLanguage = &Lgumainwin[Language];
							hButton = WM_GetDialogItem (hWin,ID_BUTTON_0);
							BUTTON_SetBkColor (hButton,BUTTON_CI_UNPRESSED,GUI_WHITE);
							BUTTON_SetTextColor (hButton,BUTTON_CI_UNPRESSED,GUI_BLACK);
							BUTTON_SetTextAlign (hButton,GUI_TA_HCENTER|GUI_TA_VCENTER);
							BUTTON_SetText(hButton,pLanguage->ButtonInfo[0]);
							BUTTON_SetFocusColor (hButton,GUI_WHITE);
							WIDGET_SetEffect (hButton,&WIDGET_Effect_None);
							WM_SetCallback (hButton,&mybutton);
							WM_SetFocus (hButton);
							hListview = WM_GetDialogItem (hWin,ID_LV_0);
							hListhead = LISTVIEW_GetHeader(hListview);
							LISTVIEW_SetFont(hListview,&GUI_Font30);
							LISTVIEW_SetRowHeight(hListview,40);
							LISTVIEW_SetHeaderHeight(hListview,30);
							LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SELFOCUS,GUI_GRAY);
							LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SEL,GUI_WHITE);
							LISTVIEW_SetTextColor (hListview,LISTVIEW_CI_SEL,GUI_BLACK);
							LISTVIEW_SetTextColor(hListview,LISTVIEW_CI_SELFOCUS,GUI_WHITE);
							WIDGET_SetEffect(hListhead,&WIDGET_Effect_3D);
							HEADER_SetBkColor (hListhead,GUI_BLACK);
							HEADER_SetTextColor(hListhead,GUI_WHITE);
							HEADER_SetFont(hListhead,&GUI_Font24);
							LISTVIEW_AddColumn(hListview,80,"序号",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息编码",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,130,"yyy/mm/dd",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,90,"hh:mm",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,120,"频道",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息类型",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息状态",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_SetTextAlign(hListview,6,GUI_TA_LEFT|GUI_TA_VCENTER);
							
							// WM_HWIN - TEXT
							mainwinText[0] = WM_GetDialogItem(hWin,ID_TEXT_3); //高压警告
							mainwinText[1] = WM_GetDialogItem(hWin,ID_TEXT_0); //INT
							mainwinText[2] = WM_GetDialogItem(hWin,ID_TEXT_1); //loc1,loc2,chs
							mainwinText[3] = WM_GetDialogItem(hWin,ID_TEXT_2); //time
							mainwinText[4] = WM_GetDialogItem(hWin,ID_TEXT_4); //page
							
							WM_SetCallback(mainwinText[1],&mytext);
							WM_SetCallback(mainwinText[2],&mytext);			
							
							TEXT_SetText(mainwinText[0],"");
							
							TEXT_SetFont(mainwinText[4],&GUI_Font30);
							TEXT_SetTextAlign(mainwinText[4],TEXT_CF_RIGHT);
							TEXT_SetText(mainwinText[4],"所处 01页/共 02页");
							//time
							TEXT_SetTextAlign(mainwinText[3],TEXT_CF_VCENTER);
							TEXT_SetFont(mainwinText[3],&GUI_Font30);
							TEXT_SetText(mainwinText[3],"UTC 2015.10.24 17:30");
							for (i=0;	i<16; i++)
							{
									INFO_add(&TESTDATA[i]);
							}
							if (rowNum < 8)
							 	pageNum = 1;
							else if (rowNum%8 == 0)
						 		pageNum = rowNum/8;
							else pageNum = rowNum/8+1;	
							InfoSel(0,1);
							//DisPage();	 
					 	WM_SetCallback (hListview,&mylistview);
							
					  break;
						
		 default:
       WM_DefaultProc(pMsg);
       break;
	}
}