コード例 #1
0
static void _ShowButton(WM_HWIN hParent)
{
	_ahButton[0] = BUTTON_CreateAsChild(60, 15, 13, 14, hParent, BUTTON_ID_LEFT, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[1] = BUTTON_CreateAsChild(260, 15, 13, 14, hParent, BUTTON_ID_RIGHT, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[2] = BUTTON_CreateAsChild(10, 10, 30, 25, hParent, BUTTON_ID_EXIT, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);

	BUTTON_SetBitmap(_ahButton[0], BUTTON_BI_UNPRESSED, &bmLeftarrows);
	BUTTON_SetBitmap(_ahButton[1], BUTTON_BI_UNPRESSED, &bmRightarrows);
	BUTTON_SetText(_ahButton[2], "EXIT");
}
コード例 #2
0
static U8 SynthCreateItems(WM_HWIN hParent)
{
	int x,y;
	hCOMPcomm = CreateCommComponentEx(hParent,COMMON_ITEM_CLOSE);
	memset(hSynthItems,0,sizeof(hSynthItems));
	// Panel 1
	x = 4;
	y = bmEMPTYTITLEBAR.YSize;
	//y += SYNTH_YOFFSET;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL1] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL1);
	y += STRING_PANEL_HEIGHT;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL2] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL2);
	y += STRING_PANEL_HEIGHT;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL3] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL3);
	y += STRING_PANEL_HEIGHT;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL4] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL4);
	y += STRING_PANEL_HEIGHT;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL5] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL5);
	y += STRING_PANEL_HEIGHT;
	y += 1;
	hSynthItems[SYNTH_STRINGPANEL6] = MisaSynthString_Create(x,y,0,0,hParent,SYNTH_ID_STRINGPANEL6);

	x = SYNTH_XOFFSET;
	y = 502;
	hSynthItems[SYNTH_MIDICTRL] = BUTTON_CreateAsChild(x,y,bmSM_MIDICTL_UN.XSize,bmSM_MIDICTL_UN.YSize,hParent,SYNTH_ID_MIDICTRL,WM_CF_SHOW|WM_CF_MEMDEV);
	BUTTON_SetFocussable(hSynthItems[SYNTH_MIDICTRL],0);
	BUTTON_SetBitmap(hSynthItems[SYNTH_MIDICTRL],BUTTON_CI_UNPRESSED,&bmSM_MIDICTL_UN);
	BUTTON_SetBitmap(hSynthItems[SYNTH_MIDICTRL],BUTTON_CI_PRESSED,&bmSM_MIDICTL_SE);
	return 0;
}
コード例 #3
0
static void CreateCalculator(WM_HWIN hWin)
{
	int y0 = 55;
	int XSize = LCD_GetXSize();
	int YSize = LCD_GetYSize();
	int XStep = XSize / 5;
	int YStep = (YSize - y0 - 25) / 4;

	char ac[2];
	char *s=NULL;
	int XPos,YPos;
	int i = 0;
	for (i = 0; i < 19; i++)
	{
		if (i == 14)
			i = 15;
		 XPos = (i % 5) * XStep + 3;
		 YPos = (i / 5) * YStep + 3 + y0;

		memset(&ac, 0, sizeof(char)* 2);
		 s = ac;
		ac[0] = _acText[i];
		if (i == 18)
		{
			hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep * 2 - 5, YStep - 5, hWin, _acText[i], WM_CF_SHOW);
		}
		else if (i == 9)
			hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep - 5, YStep * 2 - 5, hWin, _acText[i], WM_CF_SHOW);
		else hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep - 5, YStep - 5, hWin, _acText[i], WM_CF_SHOW);
		BUTTON_SetBkColor(hButton[i], BUTTON_CI_UNPRESSED, 0x50A0FF);
		BUTTON_SetBkColor(hButton[i], BUTTON_CI_PRESSED, 0x004080);
		BUTTON_SetTextColor(hButton[i], BUTTON_CI_UNPRESSED, GUI_WHITE);
		BUTTON_SetTextColor(hButton[i], BUTTON_CI_PRESSED, GUI_WHITE);
		BUTTON_SetFont(hButton[i], &GUI_Font24B_ASCII);
		if (i == 18)
		{
			BUTTON_SetText(hButton[i], "EXIT");
		}
		else BUTTON_SetText(hButton[i], s);
	}
	hEdit = EDIT_CreateAsChild(0, 0, 320, 50, hWin, 0, WM_CF_SHOW, 80);
	EDIT_SetTextColor(hEdit, 0, 0x0080FF);
	EDIT_SetFont(hEdit, &GUI_Font24B_ASCII);
	EDIT_SetBkColor(hEdit, 0, GUI_RED);
}
コード例 #4
0
ファイル: button.c プロジェクト: Cee/uCOS-II-Timebomb
BUTTON_Handle BUTTON_CreateIndirect(const GUI_WIDGET_CREATE_INFO* pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK* cb) {
  BUTTON_Handle  hThis;
  GUI_USE_PARA(cb);
  hThis = BUTTON_CreateAsChild(
    pCreateInfo->x0 + x0, pCreateInfo->y0 + y0, pCreateInfo->xSize, pCreateInfo->ySize,
    hWinParent, pCreateInfo->Id, pCreateInfo->Flags);
  BUTTON_SetText(hThis, pCreateInfo->pName);
  return hThis;
}
コード例 #5
0
ファイル: easygx_control_.c プロジェクト: edgarliu/easygx
egx_wnd_t egx_pushbutton_create_(int res_id,char *name,egx_uint32_t style,int x,int y,int width,int height,egx_wnd_t parent)
{
	BUTTON_Handle hButton;
	if(parent){
		hButton = BUTTON_CreateAsChild(x, y, width, height,GUIWND_TO_HWND(parent),res_id,WM_CF_SHOW);
	}else{
		hButton = BUTTON_Create(x, y, width, height,res_id,WM_CF_SHOW);
	}
	BUTTON_SetText(hButton, name);
	return HWND_TO_GUIWND(hButton);
}
コード例 #6
0
ファイル: AppMenu.c プロジェクト: fzzjoy/SimulationTrial
static _ShowButton(WM_HWIN hWin)
{
	_ahButton[0] = BUTTON_CreateAsChild(50, 50, 40, 40, hWin, BUTTON_ID_CALENDAR, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[1] = BUTTON_CreateAsChild(140, 50, 40, 40, hWin, BUTTON_ID_STOPWATCH, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[2] = BUTTON_CreateAsChild(230, 50, 40, 40, hWin, BUTTON_ID_CLOCK, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[3] = BUTTON_CreateAsChild(50, 130, 40, 40, hWin, BUTTON_ID_LED, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[4] = BUTTON_CreateAsChild(140, 130, 40, 40, hWin, BUTTON_ID_CALCULATOR, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	_ahButton[5] = BUTTON_CreateAsChild(230, 130, 40, 40, hWin, BUTTON_ID_FILESYSTEM, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);

	BUTTON_SetBitmap(_ahButton[0], BUTTON_BI_UNPRESSED, &bmcalendar);
	BUTTON_SetBitmap(_ahButton[1], BUTTON_BI_UNPRESSED, &bmSecWatch);
	BUTTON_SetBitmap(_ahButton[2], BUTTON_BI_UNPRESSED, &bmclock);
	BUTTON_SetBitmap(_ahButton[3], BUTTON_BI_UNPRESSED, &bmled);
	BUTTON_SetBitmap(_ahButton[4], BUTTON_BI_UNPRESSED, &bmcalculator);
	BUTTON_SetBitmap(_ahButton[5], BUTTON_BI_UNPRESSED, &bmfileSystem);
}
コード例 #7
0
ファイル: Desktop.c プロジェクト: HackLinux/jz4725
void CreateButton(WM_HWIN Win1,PDesktopButton pButton,int cx,int cy)
{
	int i,x,y;
	int top = 10,left = 0;
	int size = 40;
	int space = 20;
	int bmsize = 32; 
	int width = 480;
	int height = 272;
	x = left;
	y = top;
    //sizeof(pButton)/sizeof(pButton[0])
	for(i = 0;i < 20;i++)
	{
		if(pButton[i].title[0] == 0)
			break;

		if(y + size < height)
		{
			pButton[i].button = BUTTON_CreateAsChild(x,y,size,size,Win1,10,WM_CF_SHOW);
			BUTTON_SetBitmapEx(pButton[i].button,0,pButton[i].hBitMap_1,(size - bmsize) / 2, 4);
			BUTTON_SetBitmapEx(pButton[i].button,1,pButton[i].hBitMap_2,(size - bmsize) / 2, 4);
			BUTTON_SetText(pButton[i].button,pButton[i].title);
			BUTTON_SetTextAlign(pButton[i].button,GUI_TA_BOTTOM | GUI_TA_HCENTER);
			//BUTTON_SetFont(pButton[i].button,&GUI_Font8x12_ASCII);
			//BUTTON_SetBkColor(pButton[i].button,0,GUI_GetBkColor());
			WM_Paint(pButton[i].button); 

		}
		x += size + space;
		if(x > width)
		{
			x = left;
			y += size + space;
		}
	}
}
コード例 #8
0
ファイル: FRAMEWIN_Button.c プロジェクト: Jaly314/CH-K-Lib
/*********************************************************************
*
*       FRAMEWIN_AddButton
*/
WM_HWIN FRAMEWIN_AddButton(FRAMEWIN_Handle hObj, int Flags, int Off, int Id) {
  WM_HWIN r = 0;
  if (hObj) {
    FRAMEWIN_Obj* pObj;
    POSITIONS Pos;
    int Size       = FRAMEWIN_GetTitleHeight(hObj);
    int BorderSize = FRAMEWIN_GetBorderSize(hObj);
    int WinFlags, x;
    WM_LOCK();
    pObj = FRAMEWIN_H2P(hObj);
    FRAMEWIN__CalcPositions(pObj, &Pos);
    if (Flags & FRAMEWIN_BUTTON_RIGHT) {
      x = Pos.rTitleText.x1 - (Size - 1) - Off;
      WinFlags = WM_CF_SHOW | WM_CF_ANCHOR_RIGHT;
    } else {
      x = Pos.rTitleText.x0 + Off;
      WinFlags = WM_CF_SHOW;
    }
    r = BUTTON_CreateAsChild(x, BorderSize, Size, Size, hObj, Id, WinFlags);
    BUTTON_SetFocussable(r, 0);
    WM_UNLOCK();
  }
  return r;
}
コード例 #9
0
ファイル: button.c プロジェクト: Cee/uCOS-II-Timebomb
BUTTON_Handle BUTTON_Create      (  int x0, int y0, int xsize, int ysize, int Id, int Flags) {
  return BUTTON_CreateAsChild(x0, y0, xsize, ysize, WM_HMEM_NULL, Id, Flags);
}
コード例 #10
0
static U8 DistortionCreateItems(WM_HWIN hParent)
{
	int x,y;
	//MENU_ITEM_DATA menuItem;
	hCOMPcomm = CreateCommComponent(hParent);
	memset(hDistortionItems,0,sizeof(hDistortionItems));
	x = 4;
	y = bmEMPTYTITLEBAR.YSize;
	hDistortionItems[DISTORTION_LEFTARROW] = BUTTON_CreateAsChild(x,y,bmLEFTARROW_UN.XSize,bmLEFTARROW_UN.YSize,hParent,DISTORTION_ID_LEFTARROW,WM_CF_SHOW|WM_CF_MEMDEV);
	BUTTON_SetFocussable(hDistortionItems[DISTORTION_LEFTARROW],0);
	BUTTON_SetBitmap(hDistortionItems[DISTORTION_LEFTARROW],BUTTON_CI_UNPRESSED,&bmLEFTARROW_UN);
	BUTTON_SetBitmap(hDistortionItems[DISTORTION_LEFTARROW],BUTTON_CI_PRESSED,&bmLEFTARROW_SE);
	x += bmLEFTARROW_UN.XSize+356;	
	hDistortionItems[DISTORTION_RIGHTARROW] = BUTTON_CreateAsChild(x,y,bmRIGHTARROW_UN.XSize,bmRIGHTARROW_UN.YSize,hParent,DISTORTION_ID_RIGHTARROW,WM_CF_SHOW|WM_CF_MEMDEV);
	BUTTON_SetFocussable(hDistortionItems[DISTORTION_RIGHTARROW],0);
	BUTTON_SetBitmap(hDistortionItems[DISTORTION_RIGHTARROW],BUTTON_CI_UNPRESSED,&bmRIGHTARROW_UN);
	BUTTON_SetBitmap(hDistortionItems[DISTORTION_RIGHTARROW],BUTTON_CI_PRESSED,&bmRIGHTARROW_SE);
	y += bmDISTYPEAREA.YSize;
	y += DISTORTION_YOFFSET;
	int xbar = 50;
	hDistortionItems[DISTORTION_PROGDRIVE] = MisaProgressbar_Create(xbar,y,0,0,hParent,DISTORTION_ID_PROGDRIVE,"Drive",MISAPROG_FONT24);
	xbar += (bmSLIDER.XSize + 100);
	hDistortionItems[DISTORTION_PROGTONE] = MisaProgressbar_Create(xbar,y,0,0,hParent,DISTORTION_ID_PROGTONE,"Tone",MISAPROG_FONT24);
	xbar += (bmSLIDER.XSize + 100);
	hDistortionItems[DISTORTION_PROGLEVEL] = MisaProgressbar_Create(xbar,y,0,0,hParent,DISTORTION_ID_PROGLEVEL,"Level",MISAPROG_FONT24);
//MZ - remove noise reduction control as it only works with line in
//	hDistortionItems[DISTORTION_PROGNOISEREDUCTION] = MisaProgressbar_CreateEx(500,y,0,0,hParent,DISTORTION_ID_PROGNOISEREDUCTION,"Noise","Reduct.",MISAPROG_FONT24,DistortionNoiseReductionCB);
//	MisaProgressbar_SetCheck(hDistortionItems[DISTORTION_PROGNOISEREDUCTION], 2);
	hDistortionItems[DISTORTION_PROGBOOSTER] = MisaProgressbar_CreateEx(650,y,0,0,hParent,DISTORTION_ID_PROGBOOSTER,"Booster",0,MISAPROG_FONT24,DistortionBoosterCB);
	MisaProgressbar_SetCheck(hDistortionItems[DISTORTION_PROGBOOSTER], 2);
	/*hDistortionItems[DISTORTION_POPMENU] = MENU_CreateEx(0,0,0,0,hParent,WM_CF_MEMDEV,MENU_CF_VERTICAL,DISTORTION_ID_POPMENU);
	menuItem.pText = "warm drive";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "overdrive";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "cry";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "distortion";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "metal";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "max saturation";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);
	menuItem.pText = "fuzz";
	menuItem.Id = DISTORTION_ID_POPMENU;
	menuItem.Flags = 0;
	menuItem.hSubmenu = 0;
	MENU_AddItem(hDistortionItems[DISTORTION_POPMENU],&menuItem);*/
	return 0;
}
コード例 #11
0
void GUIDEMO_main(void) {
  #if GUI_WINSUPPORT
    int i;
  #endif
  GUI_Clear();
  #if GUI_WINSUPPORT
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Automatically use memory devices on all windows */
    /* Calculate position and size of FrameWin[1] */
    _FrameWinSizeX[1] = 80;
    _FrameWinSizeY[1] = 60;
    _FrameWinPosX[1] = LCD_GetXSize() - _FrameWinSizeX[1];
    _FrameWinPosY[1] = LCD_GetYSize() - _FrameWinSizeY[1];
    _ButtonSizeX = (_FrameWinSizeX[1] - 20) / 2;
    _ButtonSizeY = 20;
    /* Create the control window incl. buttons */
    _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP,
                                     _FrameWinPosX[1], _FrameWinPosY[1],
                                     _FrameWinSizeX[1], _FrameWinSizeY[1]);
    _ahInfoWin[1] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[1], 
                                           WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0);
    _ahButton[0] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 20,
                                 + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 
                                 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    _ahButton[1] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 2,
                                 + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 
                                 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    BUTTON_SetText(_ahButton[0], "Stop");
    BUTTON_SetText(_ahButton[1], "Next");
    _UpdateCmdWin();
    WM_ExecIdle();
  #endif
  /* Show Intro */
  GUIDEMO_Intro();
  #if GUI_WINSUPPORT
    /* Calculate position and size of FrameWin[0] */
    _FrameWinSizeX[0] = LCD_GetXSize() / 2;
    _FrameWinSizeY[0] = 65;
    _FrameWinPosX[0] = LCD_GetXSize() - _FrameWinSizeX[0];
    _FrameWinPosY[0] = 0;
    /* Create info window and run the individual demos */
    _ahFrameWin[0] = FRAMEWIN_Create("ARMSYS Demo", NULL, WM_CF_STAYONTOP, 
                                     _FrameWinPosX[0], _FrameWinPosY[0], _FrameWinSizeX[0], _FrameWinSizeY[0]);
    _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[0], WM_CF_STAYONTOP, 0, 0);
    WM_ExecIdle();
  #endif
  /* Run the individual demos !  */
  for (_iTest = 0; _apfTest[_iTest]; _iTest++) {
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    _iTestMinor = 0;
    _UpdateCmdWin();
    (*_apfTest[_iTest])();
    _CmdNext = 0;
    GUI_RestoreContext(&ContextOld);
  }
  /* Cleanup */
  #if GUI_WINSUPPORT
    for (i = 0; i < countof(_ahFrameWin); i++) {
      WM_DeleteWindow(_ahFrameWin[i]);
    }
    for (i = 0; i < countof(_ahInfoWin); i++) {
      WM_DeleteWindow(_ahInfoWin[i]);
    }
  #endif
}
コード例 #12
0
ファイル: GUIDEMO.c プロジェクト: Mrho/ucos-gui
void GUIDEMO_main(void) {
  #if GUI_WINSUPPORT
    int i;
    int xSize, ySize, xPos, yPos;
  #endif
  #if (GUI_SUPPORT_CURSOR|GUI_SUPPORT_TOUCH)
    GUI_CURSOR_Show();
  #endif
  GUI_Clear();
  #if GUI_WINSUPPORT
    #if LCD_NUM_DISPLAYS > 1
      FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW);
      WM_SetDesktopColorEx(GUI_RED, 1);
      GUI_Delay(1000);
    #endif
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Automatically use memory devices on all windows */
    /* Calculate position and size of FrameWin[1] */
    _ButtonSizeX = 30;
    _ButtonSizeY = 20;
    /* Create the control window incl. buttons */
    _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP,
                                                LCD_GetXSize() - 80, LCD_GetYSize() - 60, 80, 60);
    _ahInfoWin[1] = WM_CreateWindowAsChild( 0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[1]), WM_CF_SHOW | WM_CF_STAYONTOP, &_cbCmdWin, 0);
    _ahButton[0] = BUTTON_CreateAsChild(4, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 
                                        'S' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    _ahButton[1] = BUTTON_CreateAsChild(40, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 
                                        'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    BUTTON_SetText(_ahButton[0], "Stop");
    BUTTON_SetText(_ahButton[1], "Next");
    _UpdateCmdWin();
    WM_ExecIdle();
  #endif
  /* Show Intro */
  GUIDEMO_Intro();
  #if GUI_WINSUPPORT
    /* Calculate position and size of FrameWin[0] */
    xSize = LCD_GetXSize() / 2;
    ySize = 65;
    xPos  = LCD_GetXSize() - xSize;
    yPos  = 0;
    /* Create info window and run the individual demos */
    _ahFrameWin[0] = FRAMEWIN_Create("µC/GUI Demo", NULL, WM_CF_STAYONTOP, 
                                     xPos, yPos, xSize, ySize);
//    _ahInfoWin[0] = WM_GetFirstChild(_ahFrameWin[0]);
    _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[0]), WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0);
    WM_ExecIdle();
  #endif
  /* Run the individual demos !  */
  for (_iTest = 0; _apfTest[_iTest]; _iTest++) {
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    _iTestMinor = 0;
    _UpdateCmdWin();
    (*_apfTest[_iTest])();
    _CmdNext = 0;
    GUI_RestoreContext(&ContextOld);
  }
  /* Cleanup */
  #if GUI_WINSUPPORT
    for (i = 0; i < countof(_ahFrameWin); i++) {
      WM_DeleteWindow(_ahFrameWin[i]);
    }
    for (i = 0; i < countof(_ahInfoWin); i++) {
      WM_DeleteWindow(_ahInfoWin[i]);
    }
  #endif
}
コード例 #13
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) 
{
		
	GUI_Init();
	
	
	WM_SetDesktopColor(GUI_BLUE);	//!< SetDesktopColor
	
	 /* The First window to display the Temperature Curve */
	{
		hWM_HBKWIN_CURVE =
		WM_CreateWindow(0,0,400,240,WM_CF_SHOW | WM_CF_MEMDEV ,0,0);
		
		btn = 		 BUTTON_CreateAsChild(315, 10, 75, 35,hWM_HBKWIN_CURVE, ID_CURVE_BTN_SWTITCH_2_PARA, WM_CF_SHOW);
		btnClear = BUTTON_CreateAsChild(315, 60, 75, 35,hWM_HBKWIN_CURVE, 202, WM_CF_SHOW);
		
		/** PWM Edit **/
		{
			/* Edit to display the PWM1 */
				Edit_PWM1 = EDIT_CreateEx			 (370, 170, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM1,
																				 3);
				EDIT_SetDecMode(Edit_PWM1,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM1,0);
				
				/* Edit to display the PWM2 */
				Edit_PWM2 = EDIT_CreateEx			 (370, 190, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM2,
																				 3);
				EDIT_SetDecMode(Edit_PWM2,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM2,0);
				
					/* Edit to display the PWM3 */
				Edit_PWM3 = EDIT_CreateEx			 (370, 210, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM3,
																				 3);
				EDIT_SetDecMode(Edit_PWM3,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM3,0);
		}


		
		
		// Set Callback function for background window
		WM_SetCallback(hWM_HBKWIN_CURVE, _cbBk);
	}
		
	{
		hWM_HBKWIN_CFG_PID =
		WM_CreateWindow(0,0,400,240,WM_CF_HIDE | WM_CF_MEMDEV ,0,0); //Add the | WM_CF_MEMDEV flah
		
	

		btn1 			= BUTTON_CreateAsChild(320, 30 , 60, 35,hWM_HBKWIN_CFG_PID, ID_CFG_PID_BTN_SWTITCH_2_CURVE, WM_CF_SHOW);
		btnClear1 = BUTTON_CreateAsChild(320, 75, 60, 35,hWM_HBKWIN_CFG_PID, 203, WM_CF_SHOW);
		BUTTON_SetText(btn1,"PID_Set");
		BUTTON_SetText(btnClear1,"Back");
		
		BUTTON_SetText(btn     ,"Running");
		BUTTON_SetText(btnClear,"PID_Set");
	

		WM_SetCallback(hWM_HBKWIN_CFG_PID, _cbBk_CFG_PID);
	}
	

	
	//!< Create a graph widget
	{
		hGraph = GRAPH_CreateEx(8, 10, 300, 220, hWM_HBKWIN_CURVE, WM_CF_SHOW | WM_CF_CONST_OUTLINE | WM_CF_MEMDEV_ON_REDRAW , 0, 100);
		//GRAPH_DATA_YT_MirrorX(hGraph , 1);
		
		//!< Create a YT_data 
		hData  = GRAPH_DATA_YT_Create(GUI_BLUE, 292,0, 0); // Set the	MaxItemNum to 0	
		hData2 = GRAPH_DATA_YT_Create(GUI_RED,292,0,0);
		
		GRAPH_AttachData(hGraph, hData); //!< Attach the data to graph
		GRAPH_AttachData(hGraph, hData2); //!< Attach the data to graph
		
	}
	
	WM_ShowWindow(hWM_HBKWIN_CURVE);
	WM_HideWindow(hWM_HBKWIN_CFG_PID);
/*
	WM_BringToTop(hWM_HBKWIN);
	WM_BringToBottom(hWM_HBKWIN_CFG_PID);
	WM_MoveTo(hWM_HBKWIN_CFG_PID,400,240);
	WM_ResizeWindow(hWM_HBKWIN_CFG_PID,1,1);
*/	
	#ifdef PWM_TEXT		
			/** PWM Text **/
		{
			/* Edit to display the PWM1 */
				Text_PWM1 = TEXT_CreateEx			 (310, 170, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM1,
																				 "PMW1");				
				/* Edit to display the PWM2 */
				Text_PWM2 = TEXT_CreateEx			 (310, 190, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM2,
																				 "PWM2");
					/* Edit to display the PWM3 */
				Text_PWM3 = TEXT_CreateEx			 (310, 210, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM3,
																				 "PWM3");
		}
#endif
		
#ifdef EDIT_AD		
	 {
				/* Edit to display the AD1 */
				Edit_AD1 = EDIT_CreateEx			 (350, 120, 35, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD1,
																				 5);
				EDIT_SetDecMode(Edit_AD1,0,0,4095,0,0);
				EDIT_SetValue(Edit_AD1,0);
				
				/* Edit to display the AD2 */
				Edit_AD2 = EDIT_CreateEx			 (350, 140, 35, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD2,
																				 5);
				EDIT_SetDecMode(Edit_AD2,0,0,4095,0,0);
				EDIT_SetValue(Edit_AD2,0);
		 

				EDIT_SetFloatMode(
													Edit_AD1,1.0,
													0.0,99.9,1,/*1 bit after dot*/
													0
													);
				EDIT_SetFloatMode(
													Edit_AD2,0.0,
													0.0,99.9,1,/*1 bit after dot*/
													0
													);
	 }
#endif		

	//!< Graph configuration
	{
		hScale = GRAPH_SCALE_Create(28, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 20);
		GRAPH_SCALE_SetTextColor(hScale,GUI_GREEN);
		GRAPH_SCALE_SetFactor(hScale,0.5);
		GRAPH_SCALE_SetNumDecs(hScale,1);
		GRAPH_AttachScale(hGraph, hScale);
		
		GRAPH_SetGridDistX(hGraph,0); // Hide the X Grid
		GRAPH_SetGridDistY(hGraph,20);	
		GRAPH_SetGridVis(hGraph,1);  //!< Display the Grid
		
		GRAPH_SetBorder(hGraph,30,5,5,5);  //!< Set the frame border 
		
		//GRAPH_SetGridFixedX(hGraph,1);
		//GRAPH_SetVSizeX(hGraph,500);  //加入此会导致死掉 程序卡死在获取此指针上面.
		//GRAPH_SetGridFixedY(hGraph,1);
		GRAPH_SetColor(hGraph,GUI_BLUE,GRAPH_CI_BORDER);
		GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_BK);
		GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_FRAME);

	}	
	/* Button Configuration */
	{
	
		BUTTON_SetBkColor(btn,BUTTON_CI_UNPRESSED,GUI_LIGHTBLUE);
		BUTTON_SetBkColor(btn,BUTTON_CI_PRESSED,GUI_RED);
			
		BUTTON_SetFocusColor(btn,GUI_YELLOW);	
	}
			
  while(1) 
	{
		GUI_Exec();	

	 	OSTimeDlyHMSM(0,0,0,50);
//#define DRAWPOINT
#ifdef DRAWPOINT
		
		itoa(usValue, buf, 10);
		BUTTON_SetText(btn,buf);

	//	GRAPH_DATA_YT_AddValue(hData,usValue/20);
#endif		
	}
}
コード例 #14
0
ファイル: gui_desktop.c プロジェクト: jeenter/CH-K-Lib
static void _cbDialog(WM_MESSAGE * pMsg) {
    int i;
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    gui_msg_t msg;
    msg.exec = RT_NULL;
    
    switch (pMsg->MsgId)
    {
        case WM_INIT_DIALOG:
        hItem = pMsg->hWin;
        WM_EnableMemdev(hItem);
        //WM_MoveTo(hItem, 0, -30);
        //WM_MOTION_SetMoveable(hItem, WM_CF_MOTION_Y, 1);
        WINDOW_SetBkColor(hItem, GUI_WHITE);
        int fd;
        

        /* load APP */
        for(i=0;i<GUI_COUNTOF(UIApp);i++)
        {
            hItem = BUTTON_CreateAsChild(10, 10, 50, 50, pMsg->hWin, UIApp[i].GUID, WM_CF_SHOW);
            BUTTON_SetText(hItem, UIApp[i].text);
            WM_EnableMemdev(hItem);
            struct stat s;
            stat(UIApp[i].logoPath, &s);
            
            UIApp[i].plogo = rt_malloc(s.st_size);
            if(UIApp[i].plogo)
            {
                fd = open(UIApp[i].logoPath, O_RDONLY , 0);
                if(fd >=0)
                {
                    rt_kprintf("%s", UIApp[i].logoPath);
                    read(fd, UIApp[i].plogo, s.st_size);

                    
                    //WM_MoveTo(hItem, 0+(i%2)*120, (i/2)*120 + 0);
                    
                    WM_SetSize(hItem, GUI_BMP_GetXSize(UIApp[i].plogo), GUI_BMP_GetYSize(UIApp[i].plogo));
                    //xPos+= xSize;
                    //yPos+= ySize;
                    
                    
                    BUTTON_SetBMPEx(hItem, BUTTON_BI_UNPRESSED, UIApp[i].plogo ,0, 0);
                    BUTTON_SetBMPEx(hItem, BUTTON_BI_PRESSED, UIApp[i].plogo ,1, 1);
                    BUTTON_SetTextOffset(hItem, 0, 50);
                    close(fd);
                }
            }
            else
            {
                rt_kprintf("no mem!\r\n");
            }
        }
        
        /* algin Apps */
        int xPos, yPos, xSize, ySize;
        xPos = 0; xSize = 0;
        yPos = 0; ySize = 0;
        for(i=0;i<GUI_COUNTOF(UIApp);i++)
        {
            hItem = WM_GetDialogItem(pMsg->hWin, UIApp[i].GUID);
            xSize = GUI_BMP_GetXSize(UIApp[i].plogo);
            ySize = GUI_BMP_GetYSize(UIApp[i].plogo);
            
            if(xSize == 0 || xSize > 9999)
            {
                xSize = 60;
            }
            if(ySize == 0 || ySize > 9999)
            {
                ySize = 60;
            }
            
            if(abs(LCD_GetXSize() - xPos) >= xSize)
            {
                WM_MoveTo(hItem, xPos, yPos);
                xPos+=xSize;
            }
            else
            {
                xPos = 0;
                yPos+=ySize;
                WM_MoveTo(hItem, xPos, yPos);
                xPos+=xSize; 
            }
        }
    
//        char *p;
//        p = rt_malloc(38399);
//        fd = open("/SD/DESKTOP.JPG",O_RDONLY , 0);
//        read(fd, p, 38399);
//        hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
//        WM_EnableMemdev(hItem);
      //  IMAGE_SetJPEG(hItem, p, 38399);
        break;
    case WM_NOTIFY_PARENT:
        Id = WM_GetId(pMsg->hWinSrc);
        NCode = pMsg->Data.v;
    if(NCode == WM_NOTIFICATION_RELEASED)
    {
        for(i=0;i<GUI_COUNTOF(UIApp);i++)
        {
            if(Id == UIApp[i].GUID)
            {
                msg.exec = UIApp[i].exec;
                break;
            }
        }
        if(msg.exec != RT_NULL)
        {
            rt_mq_send(guimq, &msg, sizeof(msg));
        }
    }
    break;
    default:
        WM_DefaultProc(pMsg);
        break;
    }
}
コード例 #15
0
ファイル: AppClock.c プロジェクト: fzzjoy/SimulationTrial
static void _ShowButton(WM_HWIN hParent)
{
	_ahButton = BUTTON_CreateAsChild(10, 10, 30, 25, hParent, BUTTON_ID_EXIT, WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
	BUTTON_SetText(_ahButton, "EXIT");
}