Beispiel #1
0
/*********************************************************************
*
*       _DemoListview
*/
static void _DemoListview(void) {
  WM_HWIN hList;
  int     xSpace;
  int     ySpace;
  int     xSize;
  int     ySize;

  xSize  = LCD_GetXSize();
  ySize  = LCD_GetYSize();
  if ((CONTROL_SIZE_X + MIN_SPACE) < ((xSize - LISTVIEW_SIZE_X) / 2)) {
    xSpace = (xSize - LISTVIEW_SIZE_X) / 2;
  } else {
    xSpace = (xSize - LISTVIEW_SIZE_X - CONTROL_SIZE_X) / 2;
  }
  ySpace = (ySize - INFO_SIZE_Y) / 8;
  hList  = LISTVIEW_CreateEx(xSpace, INFO_SIZE_Y + ySpace, LISTVIEW_SIZE_X, ySize - INFO_SIZE_Y - (ySpace * 2), WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_LISTVIEW0);
  WM_SetFocus(hList);
  _InitListview(hList);
  _Action(hList);
  WM_DeleteWindow(hList);
}
/**
  * @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;
  }
}
Beispiel #3
0
static void GUIMakeWinOut() {
    hWinOut = WINDOW_CreateEx(
        20, 140, 200, 150,
        0,
        WM_CF_SHOW,
        0,
        ++curId,
        0
    );
    hMultipage = MULTIPAGE_CreateEx(
        10, 10, 180, 130,
        hWinOut,
        WM_CF_SHOW,
        0,
        ++curId
    );
    MULTIPAGE_SetSkin(hMultipage, MULTIPAGE_SKIN_FLEX);

    WM_HWIN hMultipageWindow1 = WINDOW_CreateEx(
        0, 0, 180, 110,
        hMultipage,
        0,
        0,
        ++curId,
        _cbPage1
    );
    WINDOW_SetBkColor(hMultipageWindow1, GUI_RED);
    MULTIPAGE_AddPage(hMultipage, hMultipageWindow1, "Custom");

    hListview = LISTVIEW_CreateEx(0, 0, 180, 130,
        hMultipageWindow1,
        WM_CF_SHOW,
        0,
        ++curId
    );
    LISTVIEW_AddColumn( hListview, 120 ,
            "Cloth",
            GUI_TA_HCENTER | GUI_TA_VCENTER );
    LISTVIEW_AddColumn( hListview, 60 ,
            "Position",
            GUI_TA_HCENTER | GUI_TA_VCENTER );

    const char* name[][2] = {
        {"Polka dot long dress", "40"},
        {"White Shirt", "60"}
    };
    LISTVIEW_AddRow( hListview, (GUI_ConstString*)name[0] );
    LISTVIEW_AddRow( hListview, (GUI_ConstString*)name[1] );


    WM_HWIN hMultipageWindow2 = WINDOW_CreateEx(
        0, 0, 180, 110,
        hMultipage,
        0,
        0,
        ++curId,
        NULL
    );
    WINDOW_SetBkColor(hMultipageWindow2, GUI_BLUE);
    MULTIPAGE_AddPage(hMultipage, hMultipageWindow2, "Suggest");
}