Пример #1
0
/*********************************************************************
*
*       LISTBOX__SetScrollbarWidth
*/
void LISTBOX__SetScrollbarWidth(LISTBOX_Handle hObj, const LISTBOX_Obj* pObj) {
  WM_HWIN hBarH, hBarV;
  int Width;
  Width = pObj->ScrollbarWidth;
  if (Width == 0) {
    Width = SCROLLBAR_GetDefaultWidth();
  }
  hBarH = WM_GetDialogItem(hObj, GUI_ID_HSCROLL);
  hBarV = WM_GetDialogItem(hObj, GUI_ID_VSCROLL);
  SCROLLBAR_SetWidth(hBarH, Width);
  SCROLLBAR_SetWidth(hBarV, Width);
}
Пример #2
0
/*******************************************************************
*
*       _ShowSeveralFunctions
*/
static void _ShowSeveralFunctions(LISTBOX_Handle hListBox) {
  int NumEntries, i;
  /* Add scrollbar */
  GUI_DispStringAtCEOL("SCROLLBAR_CreateAttached", 5, 55);
  GUI_Delay(SPEED);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  GUI_Delay(SPEED * 0.75);
  /* Add strings */
  GUI_DispStringAtCEOL("LISTBOX_AddString", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_AddString(hListBox, "Français");
  GUI_Delay(SPEED / 6);
  LISTBOX_AddString(hListBox, "Japanese");
  GUI_Delay(SPEED / 6);
  LISTBOX_AddString(hListBox, "Italiano");
  GUI_Delay(SPEED / 6);
  LISTBOX_AddString(hListBox, "Español");
  GUI_Delay(SPEED / 6);
  LISTBOX_AddString(hListBox, "Other language ...");
  GUI_Delay(SPEED * 0.6);
  /* Set focus */
  GUI_DispStringAtCEOL("WM_SetFocus", 5, 55);
  GUI_Delay(SPEED * 0.9);
  WM_SetFocus(hListBox);
  GUI_Delay(SPEED * 0.7);
  /* Set font */
  GUI_DispStringAtCEOL("LISTBOX_SetFont", 5, 55);
  GUI_Delay(SPEED * 0.9);
  LISTBOX_SetFont(hListBox, &GUI_Font13B_1);
  GUI_Delay(SPEED * 0.7);
  /* Increment selection */
  GUI_DispStringAtCEOL("LISTBOX_IncSel", 5, 55);
  GUI_Delay(SPEED);
  NumEntries = LISTBOX_GetNumItems(hListBox);
  for (i = 0; i < NumEntries - 1; i++) {
    LISTBOX_IncSel(hListBox);
    GUI_Delay(SPEED / 6);
	}
  GUI_Delay(SPEED / 4);
  /* Show automatic scrollbar */
  GUI_DispStringAtCEOL("Optional automatic scrollbar", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_SetAutoScrollH(hListBox, 1);
  LISTBOX_SetAutoScrollV(hListBox, 1);
  GUI_Delay(SPEED * 0.75);
  /* Set font */
  GUI_DispStringAtCEOL("LISTBOX_SetFont", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_SetFont(hListBox, &GUI_Font16B_1);
  GUI_Delay(SPEED * 0.75);
  /* Decrement selection */
  GUI_DispStringAtCEOL("LISTBOX_DecSel", 5, 55);
  GUI_Delay(SPEED);
  for (i = 0; i < NumEntries - 1; i++) {
    LISTBOX_DecSel(hListBox);
    GUI_Delay(SPEED / 6);
	}
  GUI_Delay(SPEED / 4);
  /* Change width of scrollbar */
  GUI_DispStringAtCEOL("Change scrollbar width", 5, 55);
  GUI_Delay(SPEED * 0.7);
  {
    SCROLLBAR_Handle hScrollH = WM_GetDialogItem(hListBox, GUI_ID_HSCROLL);
    SCROLLBAR_Handle hScrollV = WM_GetDialogItem(hListBox, GUI_ID_VSCROLL);
    SCROLLBAR_SetWidth(hScrollV, 14);
    GUI_Delay(SPEED / 4);
    SCROLLBAR_SetWidth(hScrollH, 14);
    GUI_Delay(SPEED * 0.6);
  }
  /* Change size of listbox */
  GUI_DispStringAtCEOL("Change size of listbox", 5, 55);
  GUI_Delay(SPEED * 0.75);
  WM_ResizeWindow(hListBox, -15, 0);
  GUI_Delay(SPEED / 4);
  WM_ResizeWindow(hListBox, 0, -15);
  GUI_Delay(SPEED / 4);
  WM_ResizeWindow(hListBox, 15, 0);
  GUI_Delay(SPEED / 4);
  WM_ResizeWindow(hListBox, 0, 15);
  GUI_Delay(SPEED / 2);
  /* Disable item */
  GUI_DispStringAtCEOL("LISTBOX_SetItemDisabled", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_SetItemDisabled(hListBox, 4, 1);
  GUI_Delay(SPEED * 0.75);
  /* Set multi selection mode */
  GUI_DispStringAtCEOL("LISTBOX_SetMulti", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_SetMulti(hListBox, 1);
  GUI_Delay(SPEED * 0.75);
  /* Select item */
  GUI_DispStringAtCEOL("LISTBOX_SetItemSel", 5, 55);
  GUI_Delay(SPEED);
  LISTBOX_SetItemSel(hListBox, 0, 1);
  GUI_Delay(SPEED / 4);
  LISTBOX_SetItemSel(hListBox, 1, 1);
  GUI_Delay(SPEED / 4);
  LISTBOX_SetItemSel(hListBox, 2, 1);
  GUI_Delay(SPEED * 0.8);
  /* Delete listbox widget */
  GUI_DispStringAtCEOL("LISTBOX_Delete", 5, 55);
  GUI_Delay(SPEED * 1.1);
  LISTBOX_Delete(hListBox);
  GUI_Delay(SPEED * 0.75);
}
Пример #3
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialogBrowser(WM_MESSAGE * pMsg) {
	TREEVIEW_ITEM_Handle hNode;			//结点句柄
	TREEVIEW_ITEM_INFO ItemInfo;
	WM_HWIN                hItem;
	int                    NCode;
	int                    Id;
	// USER START (Optionally insert additional variables)
    SCROLLBAR_Handle       hScrollbar;
	// USER END

	switch (pMsg->MsgId) {
	case WM_DELETE:
		ltk_printf("Browserapp delete\n");
        record_file=0;
        _CreateFrame(&_cbIndex);
	break;
	case WM_INIT_DIALOG:
		//
		// Initialization of 'Browser'
		//
		hItem = pMsg->hWin;
		FRAMEWIN_SetTextColor(hItem,GUI_WHITE);
		FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII);
		FRAMEWIN_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
		FRAMEWIN_AddCloseButton(hItem,FRAMEWIN_BUTTON_RIGHT,0);
//      FRAMEWIN_AddMaxButton(hItem, FRAMEWIN_BUTTON_RIGHT, 1);
//      FRAMEWIN_AddMinButton(hItem, FRAMEWIN_BUTTON_RIGHT, 2);
		FRAMEWIN_SetTitleHeight(hItem, 25);
		//
		// Initialization of 'FileTree'
		//
        GUI_UC_SetEncodeNone();
		hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TREEVIEW0);
        TREEVIEW_SetFont(hItem,&GUI_FontHZ16);
//		TREEVIEW_SetAutoScrollH(hItem,1);
//		TREEVIEW_SetAutoScrollV(hItem,1);
        hScrollbar = SCROLLBAR_CreateAttached(hItem,SCROLLBAR_CF_VERTICAL);  //创建窗口的子控件
        SCROLLBAR_SetWidth(hScrollbar,20); //设置滚动条宽度为20
		TREEVIEW_SetSelMode(hItem, TREEVIEW_SELMODE_ROW);  //使用自动滚动条
		hNode = TREEVIEW_InsertItem(hItem, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "SDCard[0:]");
		// USER START (Optionally insert additional code for further widget initialization)
        if( SD_OK !=  c_sdReader_init()) ltk_printf("sd card init failed\r\n");
		Fill_FileList("0:",record_file,hItem,hNode,NULL);
		TREEVIEW_ITEM_Expand(hNode);
		// USER END
	break;
	case WM_NOTIFY_PARENT:
		Id    = WM_GetId(pMsg->hWinSrc);
		NCode = pMsg->Data.v;
		switch(Id) {
		case GUI_ID_TREEVIEW0: // Notifications sent by 'FileTree'
            switch(NCode) {
            case WM_NOTIFICATION_CLICKED:
            break;
            case WM_NOTIFICATION_RELEASED:
                // USER START (Optionally insert code for reacting on notification message)
                //printf("\n release\n");				
                /* 查看选中了哪个项目 */
                hNode = TREEVIEW_GetSel(pMsg->hWinSrc);						
                /* 获取该项目的信息 */
                TREEVIEW_ITEM_GetInfo(hNode,&ItemInfo);

                if(ItemInfo.IsNode == 0)        //点击的是目录树的叶子(即文件)
                {
                    //printf("\r\nleaf num =%ld",hNode);
                    OpenFileProcess(hNode,record_file);
                }
                //		else										        //结点
                //		{					
                //			printf("\r\nnode num =%ld",hNode);
                //		}
                // USER END
            break;
            case WM_NOTIFICATION_MOVED_OUT:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
            break;
            case WM_NOTIFICATION_SEL_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;
	}
}