/**
  * @brief  Show Message Box
  * @param  hWin:   pointer to the parent handle
  * @param  pTitle: pointer to the title
  * @param  pText:  pointer to the text
  * @retval int 
  */ 
static int _ShowMessageBox(WM_HWIN hWin, const char* pTitle, const char* pText, int YesNo)
{
  WM_HWIN hFrame, hClient, hBut;
  int r = 0;
  /* Create frame win */
  hFrame = FRAMEWIN_CreateEx(25, 82, 190, 90, hWin, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, pTitle, &_cbMessageBox);
  FRAMEWIN_SetClientColor   (hFrame, GUI_WHITE);
  FRAMEWIN_SetFont          (hFrame, &GUI_Font16B_ASCII);
  FRAMEWIN_SetTextAlign     (hFrame, GUI_TA_HCENTER);
  /* Create dialog items */
  hClient = WM_GetClientWindow(hFrame);
  TEXT_CreateEx(10, 7, 170, 30, hClient, WM_CF_SHOW, GUI_TA_HCENTER, 0, pText);
  
  if (YesNo) {
    hBut = BUTTON_CreateEx(97, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_CANCEL);
    BUTTON_SetText        (hBut, "No");
    hBut = BUTTON_CreateEx(32, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Yes");
  } else {
    hBut = BUTTON_CreateEx(64, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Ok");
  }
  
  WM_SetFocus(hFrame);  
  WM_MakeModal(hFrame);
  r = GUI_ExecCreatedDialog(hFrame);  
  return r;
}
Exemplo n.º 2
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  FRAMEWIN_Handle hWinVideo;
  BUTTON_Handle hBut;
  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  /* Create buttons */
  hBut = BUTTON_CreateEx(240,  5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
  BUTTON_SetText(hBut, "Create win");
  hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
  BUTTON_SetText(hBut, "Delete win");
  hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
  BUTTON_SetText(hBut, "Show win");
  hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
  BUTTON_SetText(hBut, "Hide win");
  /* Create framewin video */
  hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo);
  FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR);
  /* Create test windows */
  _CreateWindow();
  _CreateWindow();
  _CreateWindow();
  while (1) {
    GUI_Delay(1000);
  }
}
Exemplo n.º 3
0
/*********************************************************************
*
*       _ToggleFullScreenMode
*
* Purpose:
*   This routine switches between full screen mode and normal mode by hiding or showing the
*   widgets of the dialog, enlarging/shrinking the graph widget and modifying some other
*   attributes of the dialog widgets.
*/
static void _ToggleFullScreenMode(WM_HWIN hDlg) {
  static int FullScreenMode;
  static GUI_RECT Rect;
  static unsigned ScalePos;
  WM_HWIN hGraph, hButton;
  hGraph  = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
  hButton = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0);
  FullScreenMode ^= 1;
  if (FullScreenMode) {
    /* Enter the full screen mode */
    WM_HWIN hClient;
    GUI_RECT RectInside;
    hClient = WM_GetClientWindow(hDlg);
    BUTTON_SetText(hButton, "Back");
    WM_MoveWindow(hButton, 0, 11);
    FRAMEWIN_SetTitleVis(hDlg, 0);
    WM_GetInsideRectEx(hClient, &RectInside);
    WM_GetWindowRectEx(hGraph, &Rect);
    WM_ForEachDesc(hClient, _ForEach, &FullScreenMode); /* Hide all descendants */
    WM_SetWindowPos(hGraph, WM_GetWindowOrgX(hClient), WM_GetWindowOrgX(hClient), RectInside.x1, RectInside.y1);
    ScalePos = GRAPH_SCALE_SetPos(_hScaleH, RectInside.y1 - 105);
  } else {
    /* Return to normal mode */
    BUTTON_SetText(hButton, "Full Screen");
    WM_MoveWindow(hButton, 0, -11);
    WM_ForEachDesc(WM_GetClientWindow(hDlg), _ForEach, &FullScreenMode); /* Show all descendants */
    WM_SetWindowPos(hGraph, Rect.x0, Rect.y0, Rect.x1 - Rect.x0 + 1, Rect.y1 - Rect.y0 + 1);
    FRAMEWIN_SetTitleVis(hDlg, 1);
    GRAPH_SCALE_SetPos(_hScaleH, ScalePos);
  }
}
/*********************************************************************
*
*       _ShowDemo
*/
static void _ShowDemo(void) {
  WM_HWIN hWin0;
  WM_HWIN hWin1;
  WM_HWIN hWin2;
  WM_HWIN hFrame1;
  WM_HWIN hFrame2;
  WM_HWIN hClient1;
  WM_HWIN hClient2;

  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  hFrame1  = FRAMEWIN_CreateEx( 10, 30, 140, 140, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Early Clipping", _cbFrameWin1);
  hFrame2  = FRAMEWIN_CreateEx(170, 30, 140, 140, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Late Clipping", _cbFrameWin2);
  hClient1 = WM_GetClientWindow(hFrame1);
  hClient2 = WM_GetClientWindow(hFrame2);
  _hWin1   = WM_CreateWindowAsChild(0, 0, WM_GetWindowSizeX(hClient1), WM_GetWindowSizeY(hClient1), hClient1, WM_CF_SHOW, _cbFrameWin1, 0);
  _hWin2   = WM_CreateWindowAsChild(0, 0, WM_GetWindowSizeX(hClient2), WM_GetWindowSizeY(hClient2), hClient2, WM_CF_SHOW | WM_CF_LATE_CLIP, _cbFrameWin2, 0);
  _hBut1   = BUTTON_CreateEx( 10, 210, 140, 20, 0, WM_CF_SHOW, 0, 1);
  _hBut2   = BUTTON_CreateEx(170, 210, 140, 20, 0, WM_CF_SHOW, 0, 2);
  hWin0    = FRAMEWIN_CreateEx( 60,  80, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 0", _cbTop);
  hWin1    = FRAMEWIN_CreateEx(220,  80, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 1", _cbTop);
  hWin2    = FRAMEWIN_CreateEx(140, 170, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 2", _cbTop);
  FRAMEWIN_SetResizeable(hWin0, 1);
  FRAMEWIN_SetResizeable(hWin1, 1);
  FRAMEWIN_SetResizeable(hWin2, 1);
  BUTTON_SetText(_hBut1, "Invalidate");
  BUTTON_SetText(_hBut2, "Reset counters");
  while(1) {
    GUI_Delay(50);
  }
}
Exemplo n.º 5
0
 void TestCom(WM_MESSAGE * pMsg,ETestMode etest_mode_in)
 {
	 int lenth;
	 char buf[10];
	 etest_mode = etest_mode_in;

     if(etest_mode == TEST_MODE_COM)
	 {
	 _ListBox[1]="C";
	 }else if(etest_mode == TEST_MODE_T)
	 {
	 _ListBox[1]="T";
	 }else{
	 _ListBox[1]="S";
	 }

	  if(ttpars.dir == 2)
	  {
	  _ListBox[2] = "D";
	   }else{
	  _ListBox[2] = "R";
	   }
	  

	 if((get_data.e_work_state != START_TEST)&&(get_data.e_work_state != GET_V1))
	 {
	  lenth = LISTVIEW_GetNumRows(WM_GetDialogItem(pMsg->hWin,GUI_ID_LISTVIEW_RESULT_T));
	  if(lenth < TEST_TIMES)
	  {
		record.test_times++;
	  
		sprintf(buf,"%d",lenth+1);

		_ListBox[0]= buf;
		LISTVIEW_InsertRow(WM_GetDialogItem(pMsg->hWin,GUI_ID_LISTVIEW_RESULT_T),0,_ListBox);

		if(ttpars.dir !=2)
		{
		BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TRT),"正转中");
		ttpars.dir = 1;
		}else {
		BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TRT),"反转中");	
		}
		motor_dir(ttpars.dir);

		BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TSTOP),"运行中");
		start_test_init();

		if(!disp_mult)
		{
		draw_clear(&tdraw);
		}
		tdraw.draw_color = _aColor[record.test_times%5];
		tdraw.data_size = 0;
	  }
	  all_button(0,GUI_ID_BUTTON_TMAIN);
	  botton_able(1,GUI_ID_BUTTON_TSTOP);
	}
 }
int _ExecKeyboard(void) {
  int i;
  int Key;
  BUTTON_Handle ahButton[52];
  BUTTON_Handle hButtonESC;
  EDIT_Handle   hEdit;
  GUI_RECT rText = {000,0, LCD_XSIZE, 20};
  GUI_SetBkColor(GUI_BLUE);  
  GUI_Clear();
  GUI_DrawBitmap(&bmMicriumLogo, 0, 0);
  GUI_SetFont(&GUI_Font16B_1);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringInRect("µC/GUI", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER);
  rText.y0 +=20;
  rText.y1 +=20;
  GUI_DispStringInRect("Touch screen demo", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER);
  /* Create Keyboard Buttons */
  for (i=0; i< 51; i++) {
    int Pos = (i < 47) ? i : i+4;
    int x0 = 5  + 28*(Pos%11);
    int y0 = 100 + 28*(Pos/11);
    char c = _acText[i];
    int Id = c ? c : 1;
    char ac[2] = {0};
    char *s= ac;
    ac[0] = c;
    ahButton[i] = BUTTON_Create( x0, y0, 25, 25, Id,BUTTON_CF_SHOW );
    BUTTON_SetText   (ahButton[i], s);
    #if GUI_SUPPORT_MEMDEV
      BUTTON_EnableMemdev(ahButton[i]);
    #endif
  }
  ahButton[i] = BUTTON_Create( 89, 212, 109, 25, ' ',BUTTON_CF_SHOW );
  hButtonESC = BUTTON_Create( 230, 40, 80, 25, GUI_ID_CANCEL,BUTTON_CF_SHOW );
  BUTTON_SetText   (hButtonESC, "ESC");
  hEdit = EDIT_Create( 5, 70, 310, 25, ' ', 80, 0 );
  EDIT_SetFont(hEdit, &GUI_Font8x16);
  BUTTON_SetBkColor(ahButton[49], 0, GUI_RED);
  BUTTON_SetBkColor(ahButton[50], 0, GUI_BLUE);
  /* Handle Keyboard until ESC or ENTER is pressed */
  do {
    Key = GUIDEMO_WaitKey();
    switch (Key) {
    case 0:
    case GUI_ID_CANCEL:
     break;
    default:
      EDIT_AddKey(hEdit, Key);
	  
    }
  } while ((Key != 'N') && (Key!=GUI_ID_CANCEL) && (Key!=0));
  /* Cleanup */
  for (i=0; i< countof(ahButton); i++) {
    BUTTON_Delete(ahButton[i]);
  }
  BUTTON_Delete(hButtonESC);
  EDIT_Delete(hEdit);
  return Key;
}
Exemplo n.º 7
0
/*********************************************************************
*
*       _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) 
{
	static unsigned int GirdFlag = 0;
	int NCode, Id;
  switch (pMsg->MsgId) {
  case WM_PAINT:
		GUI_SetBkColor(GUI_LIGHTBLUE);
	  GUI_Clear();
    GUI_DispStringAt("Temperature Curve ", 80, 0);
  // GUIDEMO_DrawBk(1);
    break;
	case WM_TOUCH:
		GirdFlag++;
		GRAPH_SetGridVis(hGraph,GirdFlag%3);  //!< Display the  if touch the screen
		break;

	/*******************/
	case WM_NOTIFY_PARENT:
      Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
      NCode = pMsg->Data.v;               /* Notification code */
      switch (NCode) {
        case WM_NOTIFICATION_RELEASED:    /* React only if released */
          if (Id == ID_CURVE_BTN_SWTITCH_2_PARA)  /* ID =210 btn Button */  
					{                   	
							ClosePWM = ! ClosePWM;
						
							if(1 == ClosePWM)
							{
									BUTTON_SetText(btn,"Closed");
							}
							else
							{
									BUTTON_SetText(btn,"Running");
							}
							
          } 	
					if (Id == 202)  /* ID =210 btn Button */  
					{                   	
						BUTTON_SetText(btnClear,"PID_Set");
						GPIO_SetBits(GPIOF,GPIO_Pin_8);
						
						PID_CFG_Flag = 1;
						
						WM_HideWindow(hWM_HBKWIN_CURVE);
				  	WM_ShowWindow(hWM_HBKWIN_CFG_PID);

          } 
        break;      
        default:          
				{
				}
      }
	break;
	
  default:
    WM_DefaultProc(pMsg);
  }
}
int _ExecKeyboard(void) {
  int y0 = 75;
  int XSize = LCD_GetXSize();
  int YSize = LCD_GetYSize();
  int XStep = XSize / 4;
  int YStep = (YSize - y0) / 4;
  int i;
  int Key;
  BUTTON_Handle ahButton[16];
  BUTTON_Handle hButtonESC;
  EDIT_Handle   hEdit;
  GUI_RECT rText = {0};
  rText.x1 = LCD_GetXSize() - 3;
  rText.y1 = 20;
  GUI_SetBkColor(GUI_BLUE);  
  GUI_Clear();
  GUI_SetFont(&GUI_FontComic18B_ASCII);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringInRect("µC/GUI", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER);
  rText.y0 +=20;
  rText.y1 +=20;
  GUI_DispStringInRect("Touch screen demo", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER);
  /* Create Keyboard Buttons */
  for (i=0; _acText[i]; i++) {
    int XPos = (i%4) * XStep + 3;
    int YPos = (i/4) * YStep + 3 + y0;
    char c = _acText[i];
    int Id = c ? c : 1;
    char ac[2] = {0};
    char *s= ac;
    ac[0] = c;
    ahButton[i] = BUTTON_Create( XPos, YPos, XStep - 5, YStep - 5, Id, BUTTON_CF_SHOW );
    BUTTON_SetText(ahButton[i], s);
    BUTTON_EnableMemdev(ahButton[i]);
  }
  hButtonESC = BUTTON_Create( 3, 3, 80, 25, GUI_ID_CANCEL, BUTTON_CF_SHOW );
  BUTTON_SetText(hButtonESC, "ESC");
  hEdit = EDIT_Create( 5, y0 - 30, XSize - 10, 25, ' ', 80, 0 );
  EDIT_SetFont(hEdit, &GUI_Font8x16);
  /* Handle Keyboard until ESC or ENTER is pressed */
  do {
    Key = GUIDEMO_WaitKey();
    switch (Key) {
    case 0:
    case GUI_ID_CANCEL:
     break;
    default:
      EDIT_AddKey(hEdit, Key);
    }
  } while ((Key != 'N') && (Key!=GUI_ID_CANCEL) && (Key!=0));
  /* Cleanup */
  for (i=0; i< countof(ahButton); i++) {
    BUTTON_Delete(ahButton[i]);
  }
  BUTTON_Delete(hButtonESC);
  EDIT_Delete(hEdit);
  return Key;
}
void GUIDEMO_Touch(void) {
	
  #define ID_KEYBOARD  1
  #define ID_TESTCAL   2
  #define ID_CALIBRATE 3
  int i, r;
  int XSize = LCD_GetXSize();
  int YSize = LCD_GetYSize();
  int XMid = XSize / 2;
  int YMid = YSize / 2;
  //GUIDEMO_NotifyStartNext();
  GUIDEMO_HideInfoWin();
  
  do {
    GUI_RECT rText;/*= {0, 80, XSize, 120};*/
    BUTTON_Handle ahButton[3];
    rText.x0=0;
    rText.y0=50;
    rText.x1=XSize;
    rText.y1=90;
    GUI_SetBkColor(GUI_BLUE);
    GUI_Clear();
    GUI_DrawBitmap(&bmMicriumLogo, (XSize - 1 - bmMicriumLogo.XSize) / 2, 15);
    GUI_SetFont(&GUI_Font16B_1);
    GUI_DispStringInRect("µC/GUI Touch screen demo", &rText, GUI_TA_HCENTER | GUI_TA_VCENTER);
    ahButton[0] =  BUTTON_Create( XMid - 50, YMid - 30, 100, 50, ID_CALIBRATE,BUTTON_CF_SHOW );
    ahButton[1] =  BUTTON_Create( XMid - 90, YMid + 30, 80, 30, ID_KEYBOARD, BUTTON_CF_SHOW );
    ahButton[2] =  BUTTON_Create( XMid + 10, YMid + 30, 80, 30, ID_TESTCAL,BUTTON_CF_SHOW );
    BUTTON_SetText (ahButton[0], "Calibrate");
    BUTTON_SetBkColor(ahButton[0], 0, GUI_RED);
    BUTTON_SetText (ahButton[1], "Keyboard");
    BUTTON_SetText (ahButton[2], "Test calibration");
    BUTTON_SetFont(ahButton[0], &GUI_FontComic18B_ASCII);
    r = GUIDEMO_WaitKey();
    if (r==0) {
      r = ID_KEYBOARD;
      BUTTON_SetState(ahButton[1],BUTTON_STATE_PRESSED);
      GUIDEMO_Delay(500);
    }
    for (i=0; i< countof(ahButton); i++) {
      BUTTON_Delete(ahButton[i]);
    }
    switch (r) {
    case ID_KEYBOARD:  init_uart0(); send_press_key(); break;
    case ID_CALIBRATE: _ExecCalibration(); break;
    case ID_TESTCAL:   _TestCalibration(); break;
    }
  } while (r && (r!='n') && (r!='N'));
}
void _TestCalibration(void) {
  int IdleCnt=0;
  BUTTON_Handle hButton;
  GUI_SetBkColor(GUI_RED);  
  GUI_SetColor(GUI_WHITE);  
  GUI_Clear();
  hButton =  BUTTON_Create( 225, 15, 80, 40, 1, BUTTON_CF_SHOW );
  BUTTON_SetText (hButton, "ABORT");
  BUTTON_SetFont (hButton, &GUI_FontComic18B_ASCII);
  while ((IdleCnt<50) && (GUI_GetKey()==0)) {
    static GUI_PID_STATE StateLast;
    GUI_PID_STATE State;
    GUI_TOUCH_GetState(&State);
    if ((StateLast.Pressed != State.Pressed) && (State.Pressed == 0)) {
      GUI_Clear();
    }
    if ((StateLast.x != State.x) || ((StateLast.y != State.y))) {
      if (State.Pressed) {
        GUI_FillCircle(State.x, State.y, 5);
      }
      StateLast = State;
    }
    if (State.Pressed) {
      IdleCnt =0;
    } else {
      IdleCnt++;
    }
    GUI_Delay (100);
  }
  EDIT_Delete(hButton);
}
Exemplo n.º 11
0
void OnxxxClicked_CR(WM_MESSAGE * pMsg)
{
	if((get_data.e_work_state != START_TEST)&&(get_data.e_work_state != GET_V1))
	{
	
    if(button_cr_state)
	{
	BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_CR),"反转");
	button_cr_state = 0;
	}else{
	BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_CR),"正转");
	button_cr_state = 1;	
	}
	}
	 
}
Exemplo n.º 12
0
/*********************************************************************
*
*       GUIDEMO_main(): Small version of the demo
*
**********************************************************************
*/
void GUIDEMO_main(void) {
  #if GUI_WINSUPPORT
    int i;
  #endif
  #if GUI_WINSUPPORT
    #if LCD_NUM_DISPLAYS > 1
      FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW);
      GUI_Delay(1000);
    #endif
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Automatically use memory devices on all windows */
    _ButtonSizeX = 27;
    _ButtonSizeY = 14;
    _ahButton[0] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX * 2 - 5,
                                 LCD_GetYSize() - _ButtonSizeY - 3,
                                 _ButtonSizeX, _ButtonSizeY, 
                                 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    _ahButton[1] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX - 3,
                                 LCD_GetYSize() - _ButtonSizeY - 3,
                                 _ButtonSizeX, _ButtonSizeY, 
                                 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    BUTTON_SetFont(_ahButton[0], &GUI_Font8_ASCII);
    BUTTON_SetFont(_ahButton[1], &GUI_Font8_ASCII);
    BUTTON_SetText(_ahButton[0], "Stop");
    BUTTON_SetText(_ahButton[1], "Next");
    _UpdateCmdWin();
    WM_ExecIdle();
  #endif
  /* Show Intro */
  GUIDEMO_Intro();
  /* 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(_ahButton); i++) {
      BUTTON_Delete(_ahButton[i]);
    }
  #endif
}
Exemplo n.º 13
0
 void OnButtonTStopClicked(WM_MESSAGE * pMsg)
 {
	 get_data.e_work_state = HAND_OFF;
	BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TSTOP),"停止");
	motor_dir(0);

	all_button(1,GUI_ID_BUTTON_TMAIN);
 }
Exemplo n.º 14
0
 void OnButtonRTClicked(WM_MESSAGE * pMsg)
 {
	motor_speed(0);
	if((get_data.e_work_state != START_TEST)&&(get_data.e_work_state != GET_V1))
	{
	
    if(ttpars.dir == 1)
	{
	BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TRT),"反转");
	ttpars.dir = 2;
	}else {
	BUTTON_SetText(WM_GetDialogItem(pMsg->hWin,GUI_ID_BUTTON_TRT),"正转");	
	ttpars.dir = 1;
	}
	motor_dir(ttpars.dir);
	}
 }
Exemplo n.º 15
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);
}
Exemplo n.º 16
0
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;
}
void BUTTON_Set_Bitmap_Ex(WM_HWIN hWin, int buttonId, const GUI_BITMAP *pBitmap, int x, int y)
{
    WM_HWIN hItem;
    hItem = WM_GetDialogItem(hWin, buttonId);
    BUTTON_SetText(hItem, " ");
    BUTTON_SetBitmapEx(hItem, BUTTON_CI_DISABLED, pBitmap, x, y);
    BUTTON_SetBitmapEx(hItem, BUTTON_CI_PRESSED, pBitmap, x, y);
    BUTTON_SetBitmapEx(hItem, BUTTON_CI_UNPRESSED, pBitmap, x, y);
}
Exemplo n.º 18
0
/*********************************************************************
*
*       _CreateLButton
*/
static WM_HWIN _CreateLButton(const char* pText, int x, int w, int h, WM_HWIN hParent, int Id) {
  WM_HWIN hButton;
  GUI_RECT Rect;
  WM_GetClientRectEx(hParent, &Rect);
  hButton = BUTTON_CreateEx(x, Rect.y1 - h + 1, w, h, hParent, WM_CF_SHOW | WM_CF_ANCHOR_BOTTOM, 0, Id);
  BUTTON_SetText(hButton, pText);
  BUTTON_SetFont(hButton, &GUI_Font8_ASCII);
  return hButton;
}
Exemplo n.º 19
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");
}
Exemplo n.º 20
0
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);
}
/*********************************************************************
*
*       _CreateButton
*/
static WM_HWIN _CreateButton(int x, int y, int w, int h, int bx, int by, const char * pText, GUI_CONST_STORAGE GUI_BITMAP * pBm, int Id) {
  WM_HWIN hWin;
  hWin = BUTTON_CreateEx(x, y, w, h, WM_HBKWIN, WM_CF_SHOW, 0, Id);
  BUTTON_SetBitmapEx(hWin, 0, pBm, bx + 0, by + 0);
  BUTTON_SetBitmapEx(hWin, 1, pBm, bx + 1, by + 0);
  BUTTON_SetFont(hWin, &GUI_FontAA2_21);
  BUTTON_SetTextAlign(hWin, GUI_TA_TOP | GUI_TA_HCENTER);
  BUTTON_SetText(hWin, pText);
  BUTTON_SetBkColor(hWin, 0, GUI_LIGHTBLUE);
  return hWin;
}
Exemplo n.º 22
0
void configuration_panel_init() {
  int frmWinWidth = GUI_X_MAX;
  int frmWinHeight = GUI_Y_MAX - 40;
  int x0 = 0;
  int y0 = 20;
  
  int checkBoxX = 5;
  int checkBoxY = 22;
  int checkBoxWidth = 60;
  int checkBoxHeight = 15;
  
  int buttonWidth = 90;
  int buttonHeight = 20;
  int buttonX = 5;
  int buttonY = frmWinHeight - (buttonHeight + 5);
  
  sel_conf_language = sel_language;
  
  configPageWin = FRAMEWIN_Create(confFrmText[sel_language], _cbConfigWin, WM_CF_SHOW, x0, y0, frmWinWidth, frmWinHeight);
  FRAMEWIN_SetFont(configPageWin, &GUI_FontArialBold14_8_Unicode);
  
  for (int i = 0; i < NUM_CONF_ITEMS; i++) {
    int id = i + ID_CONF_DSTP_CFG_PRT_ONB;
    CHECKBOX_Handle checkBox = CHECKBOX_Create(checkBoxX, checkBoxY, checkBoxWidth, checkBoxHeight, configPageWin, id, WM_CF_SHOW);
    CHECKBOX_SetFont(checkBox, &GUI_FontArialStandard14_8_Unicode);
    CHECKBOX_SetText(checkBox, conf_checkbox_item[sel_language][i]);
    CHECKBOX_SetBoxBkColor(checkBox, GUI_USER_LIGHTGRAY, CHECKBOX_CI_DISABLED);
    CHECKBOX_SetBoxBkColor(checkBox, GUI_YELLOW, CHECKBOX_CI_ENABLED);
    CHECKBOX_SetFocusColor(checkBox, GUI_BLUE);
    checkBoxY += 15;
  }
  
  BUTTON_Handle ESC_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ESC);
  BUTTON_SetFont(ESC_Button, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ESC_Button, escButtonExpl[sel_language]);
  
  buttonX = frmWinWidth - (buttonWidth + 5);
  BUTTON_Handle ENTER_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ENTER);
  BUTTON_SetFont(ENTER_Button, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ENTER_Button, enterButtonExpl[sel_language]);
}
Exemplo n.º 23
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Window'
    //
    hItem = pMsg->hWin;
    WINDOW_SetBkColor(hItem, 0x00808040);
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, "Coming");
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // 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;
  }
}
Exemplo n.º 24
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  FRAMEWIN_Handle hWinVideo;
  BUTTON_Handle   hBut;
  WM_HWIN         hText;

  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  hText = TEXT_CreateEx(240,  85, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT0, "The client\nwindow is");
  TEXT_SetTextColor(hText, GUI_WHITE);
  hText = TEXT_CreateEx(240, 111, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT1, NULL);
  TEXT_SetTextColor(hText, GUI_WHITE);
  //
  // Create buttons
  //
  hBut = BUTTON_CreateEx(240,  5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
  BUTTON_SetText(hBut, "Create win");
  hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
  BUTTON_SetText(hBut, "Delete win");
  hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
  BUTTON_SetText(hBut, "Show win");
  hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
  BUTTON_SetText(hBut, "Hide win");
  //
  // Create framewin video
  //  
  hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo);
  FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR);
  //
  // Create test windows
  //
  _CreateWindow();
  _CreateWindow();
  _CreateWindow();
  while (1) {
    GUI_Delay(1000);
  }
}
Exemplo n.º 25
0
/*******************************************************************
*
*       _DemoButton
*/
static void _DemoButton(void) {
  BUTTON_Handle hButton;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on button...", 160, 90);
  /* Create the button*/
  hButton = BUTTON_Create(110, 110, 100, 40, GUI_ID_OK, WM_CF_SHOW);
  /* Set the button text */
  BUTTON_SetText(hButton, "Click me...");
  /* Let window manager handle the button */
  while (GUI_WaitKey() != GUI_ID_OK);
  /* Delete the button*/
  BUTTON_Delete(hButton);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(1000);
}
Exemplo n.º 26
0
/*---------------------------------------------------------------------------*
 * Routine:     setNewButtonText
 *---------------------------------------------------------------------------*
 * Description:
 *      Applies the current mapping to the keys.
 * Inputs:
 *      WM_MESSAGE *pMsg -- message structure for current dialog.
 *      int aNCode -- Type of event received to process.
 *      int aID    -- not used.
 * Outputs:
 *      TBool -- EFalse is not problems, else ETrue.
 *---------------------------------------------------------------------------*/
static void setNewButtonText(WM_MESSAGE * pMsg, int aNCode, int aID)
{
     T_keyboardMapping *p = G_keypadCurrentMapping;
     WM_HWIN hitem;
         
     while(p->iID){
        hitem = WM_GetDialogItem(pMsg->hWin, p->iID);
        BUTTON_SetText(hitem, p->iTextOnButton);
        if ((p->iType == 0) || (p->iType & G_showKeys)) {
            WM_EnableWindow(hitem);
        } else {
            WM_DisableWindow(hitem);
        }
        p++;
     }
}
Exemplo n.º 27
0
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;
		}
	}
}
Exemplo n.º 28
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    // USER START (Optionally insert additional variables)
    // USER END
    GUI_DrawBitmap(&bmlogo,40,10);
#if(Gradient_Rectangle)
    {
        GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2);
    }
#endif

#if(RoundedFrame)
    GUI_SetColor(GUI_GREEN);
    GUI_DrawRoundedFrame(218,118,582,382,20,3);
#endif

#if(FillRoundedRect)
    GUI_SetColor(RoundedRect);
    GUI_FillRoundedRect(220,120,580,380,20);
#endif

    switch (pMsg->MsgId)
        {
        case WM_INIT_DIALOG:
            //
            // Initialization of 'inuse'
            //


            hItem = pMsg->hWin;
            FRAMEWIN_SetTitleVis(hItem, 0);
            FRAMEWIN_SetClientColor( hItem, framewin_backcolor);
            FRAMEWIN_SetFont(hItem, GUI_FONT_8_1);
            FRAMEWIN_SetText(hItem, "Framewin");
            FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            FRAMEWIN_SetTextColor(hItem, 0x00000000);


            hItem = pMsg->hWin;
            FRAMEWIN_SetTitleVis(hItem, 0);

            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
            BUTTON_SetFont(hItem, &GUI_Fonthz_song30);
            BUTTON_SetText(hItem, "返回 ");
#if(Button_3Dskin)
            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
#endif
#if(!Button_3Dskin)
            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
#endif

            //
            // Initialization of 'Button'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
            BUTTON_SetFont(hItem, &GUI_Fonthz_song30);
            BUTTON_SetText(hItem, "停止充电 ");
#if(Button_3Dskin)
            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
#endif
#if(!Button_3Dskin)
            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
#endif
            //
            // Initialization of 'Button'
            //
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,9999,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'cddianliang'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "使用电量 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "使用时间 ");
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "消费金额 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "账户余额 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);

            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetText(hItem, "安徽绿建科技有限公司 ");
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetFont(hItem, &GUI_FontSong_60);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD.");
            TEXT_SetFont(hItem, GUI_FONT_24_ASCII);
            // USER START (Optionally insert additional code for further widget initialization)
            // USER END
            break;
        case WM_NOTIFY_PARENT:
            Id    = WM_GetId(pMsg->hWinSrc);
            NCode = pMsg->Data.v;
            switch(Id)
                {
                case ID_BUTTON_0: // Notifications sent by 'Button'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
//                        op=ensure;
//                        handle_button();
                        
                        GUI_EndDialog( pMsg->hWin,1);
                        Createensure();
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_BUTTON_1: // Notifications sent by 'Button'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            GUI_EndDialog( pMsg->hWin,1);
                            Createwindow0();
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_EDIT_0: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_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;
                case ID_EDIT_1: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_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;
                case ID_EDIT_2: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_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;
                case ID_EDIT_3: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_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;
        }
}
Exemplo n.º 29
0
/*********************************************************************
 *
 *       _cbDialog
 */
static void _cbDialog(WM_MESSAGE * pMsg) {
	WM_HWIN hItem;
	int NCode;
	int Id;

	switch (pMsg->MsgId) {
	case WM_INIT_DIALOG:
		//
		// Initialization of 'Dropdown'
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_LIGHTS);
		DROPDOWN_AddString(hItem, "Light 2");
		DROPDOWN_AddString(hItem, "Light 1");
		DROPDOWN_AddString(hItem, "Item");
		DROPDOWN_IncSel(hItem);
		//
		// Initialization of 'Address' Text
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_ADDRESS);
		TEXT_SetText(hItem, "Address: <address>");
		//
		// Initialization of 'Status' Text
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_ONOFF);
		TEXT_SetText(hItem, "Status: ON");
		//
		// Initialization of 'On/Off' Button
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_ONOFF);
		BUTTON_SetText(hItem, "Toggle On/Off");
		//
		// Initialization of 'Mode' Text
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_MODE);
		TEXT_SetText(hItem, "Mode: Auto");
		//
		// Initialization of 'Mode' Button
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_MODE);
		BUTTON_SetText(hItem, "Trigger SOS");
		//
		// Initialization of 'Add' Button
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_ADD);
		BUTTON_SetText(hItem, "Add new...");
		//
		// Initialization of 'Reconfigure' Button
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_RECONFIGURE);
		BUTTON_SetText(hItem, "Reconfigure...");
		//
		// Initialization of 'Remove' Button
		//
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_REMOVE);
		BUTTON_SetText(hItem, "Remove...");

		WM_MakeModal(pMsg->hWin);
		break;
	case WM_NOTIFY_PARENT:
		Id = WM_GetId(pMsg->hWinSrc);
		NCode = pMsg->Data.v;
		switch (Id) {
		case ID_DROPDOWN_LIGHTS: // Notifications sent by 'Dropdown'
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			case WM_NOTIFICATION_SEL_CHANGED:
				break;
			}
			break;
		case ID_BUTTON_ONOFF:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				ToggleLightN(1, WM_GetDialogItem(pMsg->hWin, ID_TEXT_ONOFF));
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		case ID_BUTTON_MODE:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				TriggerSOS(1, WM_GetDialogItem(pMsg->hWin, ID_TEXT_MODE));
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		case ID_BUTTON_ADD:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				AddNewLight(0);
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		case ID_BUTTON_RECONFIGURE:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				ReconfigureLight(0);
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		case ID_BUTTON_REMOVE:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				RemoveLight(0);
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		case ID_BUTTON_OK:
			switch (NCode) {
			case WM_NOTIFICATION_CLICKED:
				GUI_EndDialog(pMsg->hWin, 0);
				break;
			case WM_NOTIFICATION_RELEASED:
				break;
			}
			break;
		}
		break;
	default:
		WM_DefaultProc(pMsg);
		break;
	}
}
Exemplo n.º 30
0
static void _cbDialog(WM_MESSAGE * pMsg) {
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    int led;
    static int i;
    int led_num;
    
    switch (pMsg->MsgId)
    {
        case WM_TIMER:

            rt_device_control(dev_led, RT_DEVICE_GET_LED_NUM, &led_num);
            rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &i);
            i++; i%= led_num;
            if(_gMode == LED_WATERLAMP)
            {
                WM_RestartTimer(pMsg->Data.v, _gFreq);
            }
            break;
      case WM_INIT_DIALOG:

        _gMode = 0;
        _LedInit();

        hItem = pMsg->hWin;
        FRAMEWIN_SetText(hItem, "led");
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO_0);
        RADIO_SetText(hItem, "control", 0);
        RADIO_SetText(hItem, "Water lamp", 1);
        RADIO_SetFont(hItem, GUI_FONT_13B_1);
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0);
        SLIDER_SetRange(hItem, 50, 1000);
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
        BUTTON_SetText(hItem, "led1");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
        BUTTON_SetText(hItem, "led2");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
        TEXT_SetText(hItem, "freuqency");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
        BUTTON_SetText(hItem, "led3");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
        BUTTON_SetText(hItem, "led4");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
        BUTTON_SetText(hItem, "Cancel");
        break;
      case WM_NOTIFY_PARENT:
        Id    = WM_GetId(pMsg->hWinSrc);
        NCode = pMsg->Data.v;
        switch(Id) {
        case ID_SLIDER_0: // Notifications sent by 'Slider'
            switch(NCode)
            {
                case WM_NOTIFICATION_VALUE_CHANGED:
                    _gFreq = SLIDER_GetValue(WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0));
                break;
            }
            break;
        case ID_RADIO_0:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
            break;
          case WM_NOTIFICATION_RELEASED:
            break;
          case WM_NOTIFICATION_VALUE_CHANGED:
              _gMode = RADIO_GetValue(WM_GetDialogItem(pMsg->hWin, ID_RADIO_0));
              if(_gMode == LED_WATERLAMP)
              {
                  WM_CreateTimer(WM_GetClientWindow(pMsg->hWin), 0, 200, 0);
              }
              
            break;
          }
          break;
          
        case ID_BUTTON_0:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 0;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
                break;
          }
          break;

        case ID_BUTTON_1:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 1;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_2:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 2;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_3:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 3;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_4: // Notifications sent by 'Button'
          switch(NCode) {
          case WM_NOTIFICATION_RELEASED:
                    GUI_EndDialog(pMsg->hWin, 0);
            break;

          }
          break;
        }
        break;

  default:
    WM_DefaultProc(pMsg);
    break;
  }
}