Esempio n. 1
0
static void Draw(void * p) {
  int i;
  PARAM * pParam = (PARAM *)p;
  GUI_SetBkColor(GUI_BLACK);
  GUI_SetColor(GUI_DARKGRAY);
  GUI_ClearRect(19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21));
  for (i = 0; i < (YSIZE / 2); i += 20) {
    GUI_DrawHLine((LCD_YSIZE - 20) - (YSIZE / 2) + i, 19, (LCD_XSIZE - 2));
    if (i) {
      GUI_DrawHLine((LCD_YSIZE - 20) - (YSIZE / 2) - i, 19, (LCD_XSIZE - 2));
    }
  }
  for (i = 40; i < (LCD_XSIZE - 20); i += 40) {
    GUI_DrawVLine(18 + i, (LCD_YSIZE - 20) - YSIZE, (LCD_YSIZE - 21));
  }
  GUI_SetColor(COLOR_GRAPH0);
  GUI_DrawGraph(pParam->aY, (LCD_XSIZE - 20), 19, (LCD_YSIZE - 20) - YSIZE);
}
/*********************************************************************
*
*       _cbDesktop
*
* Purpose:
*   This routine handles the drawing of the desktop window.
*/
static void _cbDesktop(WM_MESSAGE * pMsg) {
  int i;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_RED);
    GUI_Clear();
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt(_aTitle, 160, 5);
    GUI_DispNextLine();
    GUI_SetFont(GUI_DEFAULT_FONT);
    GUI_DispNextLine();
    for (i = 0; i < GUI_COUNTOF(_apExplain); i++) {
      GUI_DispStringHCenterAt(_apExplain[i], 160, GUI_GetDispPosY());
      GUI_DispNextLine();
    }
    break;
  }
}
Esempio n. 3
0
/*********************************************************************
*
*       _OnPaint
*/
static void _OnPaint(void) {
  int xPos = 0;
  GUI_RECT Rect;
  GUI_SetBkColor(GUI_GRAY);
  GUI_Clear();
  WM_GetClientRect(&Rect);
  Rect.x1 = HEADER_GetItemWidth(_hHeader, 0);
  GUI_SetColor(GUI_RED);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
  Rect.x0 = Rect.x1;
  Rect.x1 += HEADER_GetItemWidth(_hHeader, 1);
  GUI_SetColor(GUI_GREEN);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
  Rect.x0 = Rect.x1;
  Rect.x1 += HEADER_GetItemWidth(_hHeader, 2);
  GUI_SetColor(GUI_BLUE);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
}
Esempio n. 4
0
File: wm.c Progetto: byxob/calendar
static WM_RESULT cbBackWin( WM_MESSAGE* pMsg) {
  WM_KEY_INFO* pKeyInfo;
  switch (pMsg->MsgId) {
  case WM_KEY:
    pKeyInfo = (WM_KEY_INFO*)pMsg->Data.p;
    if (pKeyInfo->PressedCnt == 0) {
      GUI_StoreKey(pKeyInfo->Key);
    }
    break;
  case WM_PAINT:
    if (WM__BkColor != GUI_INVALID_COLOR) {
      GUI_SetBkColor(WM__BkColor);
      GUI_Clear();
    }
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 5
0
static void  _cbClock(WM_MESSAGE *pMsg)
{
	int NCode, Id;
	//PARAM pParam;
	switch (pMsg->MsgId)
	{
	case WM_PAINT:
		GUI_SetBkColor(GUI_WHITE); 
		GUI_Clear();
		GUI_SetColor(GUI_BLACK);
		_ShowButton(pMsg->hWin);
		GUI_DrawBitmap(&bmwatch, 37, 0);

		//GUI_AA_FillPolygon(pParam.aPoint1, GUI_COUNTOF(_aNeedle[0]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));
	//	GUI_AA_FillPolygon(pParam.aPoint2, GUI_COUNTOF(_aNeedle[1]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));
		//GUI_AA_FillPolygon(pParam.aPoint3, GUI_COUNTOF(_aNeedle[2]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2));

		GUI_FillCircle(160, 120, 3);
	
		break;
	case WM_NOTIFY_PARENT:
		Id = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
		NCode = pMsg->Data.v;            /* Notification code */
		switch (NCode)
		{
		case WM_NOTIFICATION_CLICKED:
			switch (Id)
			{
			case BUTTON_ID_EXIT:
				GUI_SetAppIndex(APP_MainMenu);
				GUI_SetAppDirection(MEMDEV_ANIMATION_LEFT);
				_MoveShiftWindow(&pMsg->hWin, MEMDEV_ANIMATION_RIGHT, 1, 1);
				GUI_SetCancel(APP_Clock);
				GUI_ClearHalt();
				break;
			default:
				break;
			}
		}
		break;
	default:
		WM_DefaultProc(pMsg);
	}
}
Esempio n. 6
0
/*******************************************************************
*
*       _cbWindow2
*/
static void _cbWindow2(WM_MESSAGE* pMsg) {
  int x, y;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(_WindowColor2);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Window 2", x / 2, (y / 4) - 12);
    break;
  case WM_SIZE:
    WM_InvalidateWindow(_hChild);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 7
0
void OUI_DrawGraph(){	
	GUI_MEMDEV_Select(OUI_MemoryDeviceGrid.DeviceHandle);
	GUI_SetBkColor(OUI_GRAPH_BACKGROUND);
	GUI_Clear();
	
	GUI_SetColor(OUI_GRAPH_LINES);
	for(int i = 0; i <= 180; i += 20){
		GUI_DrawLine(0, i, 270, i);
	}
	for(int i = 0; i <= 270; i += 30){
		GUI_DrawLine(i, 0, i, 180);
	}
	
	OUI_Components[2]->DrawGraph(OUI_Components[1], 0, 0);
	OUI_Components[1]->DrawGraph(OUI_Components[1], 0, 0);
	
	GUI_MEMDEV_CopyToLCDAt(OUI_MemoryDeviceGrid.DeviceHandle,OUI_MemoryDeviceGrid.X,OUI_MemoryDeviceGrid.Y);
	GUI_MEMDEV_Clear(OUI_MemoryDeviceGrid.DeviceHandle);
}
/*******************************************************************
*
*       _DemoOrData
*/
static void _DemoOrData(void) {
  int i;
  PARAM Param;
  GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
  GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_RED);
  GUI_ClearRect(0, 55, LCD_XSIZE, 75);
  GUI_SetFont(&GUI_FontComic18B_1);
  GUI_DispStringAt("Several waves...", 20 ,55);
  Param.aY = GUI_ALLOC_h2p(hMem);
  _GetSineData(Param.aY, 405);
  GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
  for (i = 0; (i < 90); i++) {
    _DrawOrData(GUI_GREEN, ++Param.aY);
    GUI_Delay(10);
  }
  GUI_ALLOC_Free(hMem);
}
Esempio n. 9
0
/**
* @brief  Paints record button
* @param  hObj: button handle
* @retval None
*/
static void _OnPaint_bg(BUTTON_Handle hObj) {

  int Index = 0;
  
  GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
  GUI_Clear();
  
  
  Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
  
  if (Index)
  {
    GUI_DrawBitmap(&bmbg, 0, 0);
  }
  else
  {
    GUI_DrawBitmap(&bmbg, 0, 0);
  }
}
Esempio n. 10
0
/**
  * @brief  Paints camera button
  * @param  hObj: button handle
  * @retval None
  */
static void _OnPaint_camera(BUTTON_Handle hObj, uint32_t alarm_status, uint32_t camera_status) {
  
  GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
  GUI_Clear();
    
  GUI_DrawBitmap(&bmcamera, 0, 0);
  
  if(HomeSettings.b.alarm == ALARM_ON)
  {     
    if(HomeSettings.b.camera != CAM_DESACTIVATED)
    {
      GUI_DrawBitmap(&bmdes_camera, 0, 0);
    }
  }
  else
  {
    GUI_DrawBitmap(&bmcamera, 0, 0);
  }
}
Esempio n. 11
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  GUI_PID_STATE TouchState;
  int           xPhys;
  int           yPhys;

  GUI_Init();
  GUI_CURSOR_Show();
  GUI_CURSOR_Select(&GUI_CursorCrossL);
  GUI_SetBkColor(GUI_WHITE);
  GUI_SetColor(GUI_BLACK);
  GUI_Clear();
  GUI_DispString("Measurement of\nA/D converter values");
  while (1) {
    GUI_TOUCH_GetState(&TouchState);  // Get the touch position in pixel
    xPhys = GUI_TOUCH_GetxPhys();     // Get the A/D mesurement result in x
    yPhys = GUI_TOUCH_GetyPhys();     // Get the A/D mesurement result in y
    //
    // Display the measurement result
    //
    GUI_SetColor(GUI_BLUE);
    GUI_DispStringAt("Analog input:\n", 0, 20);
    GUI_GotoY(GUI_GetDispPosY() + 2);
    GUI_DispString("x:");
    GUI_DispDec(xPhys, 4);
    GUI_DispString(", y:");
    GUI_DispDec(yPhys, 4);
    //
    // Display the according position
    //
    GUI_SetColor(GUI_RED);
    GUI_GotoY(GUI_GetDispPosY() + 4);
    GUI_DispString("\nPosition:\n");
    GUI_GotoY(GUI_GetDispPosY() + 2);
    GUI_DispString("x:");
    GUI_DispDec(TouchState.x,4);
    GUI_DispString(", y:");
    GUI_DispDec(TouchState.y,4);
    //
    // Wait a while
    //
    GUI_Delay(100);
  };
}
/*********************************************************************
*
*       _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
  int xPos;
  int yPos;

  xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2;
  yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2 ;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_BLUE);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("DIALOG_SliderColor - Sample", 160, 5);
    GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos );
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 13
0
    /*****************************************************************************
    * Function
    * DESCRIPTION:
    * Redraws or clears the colon.
    *****************************************************************************/
    bool DataPointTime::RedrawColon()
    {
      if (mVisible)
      {
        int x = 0;
        int minutes = mTime.GetTime(MINUTES);

        char sz_time[10];
        if (mFormat == DATETIME_FORMAT_MDY_AMPM)// timeformat using am/pm
        {
          bool isAm;
          int hoursOffset;
          GetAs12HourClock(&isAm, &hoursOffset);
          sprintf(sz_time, ":%02d %s", minutes, isAm ? "am" : "pm");
        }
        else
        {
          sprintf(sz_time, ":%02d", minutes);
        }

        SelectWindow();
        GUI_SetColor(mColour);
        GUI_SetBkColor(mBackgroundColour);
        GUI_SetFont(GetFont());

        x = GetWidth() - GUI_GetStringDistX(sz_time);

        if (mShowColon)
        {
          GUI_DispStringAt(":", x, 2);
          mLastColonPosition = x;
        }
        else if (mLastColonPosition == x)
        {
          GUI_ClearRect(x, 0, x + 1, GetHeight() - 1);
        }

        Validate();
      }
      
      return true;
    }
Esempio n. 14
0
static void _UpdateCmdWin(void) {
  #if GUI_WINSUPPORT && GUIDEMO_LARGE
    /* Update info in command window */
    WM_HWIN hWin;
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    hWin = WM_SelectWindow(_ahInfoWin[1]);
    GUI_SetDefault();
    GUI_SetBkColor(GUI_GRAY);
    GUI_Clear();
    GUI_DispStringAt("Demo ", 0, 0);
    GUI_DispDecMin(_iTest + 1);
    GUI_DispString(".");
    GUI_DispDecMin(_iTestMinor);
    GUI_DispString("/");
    GUI_DispDecMin(countof(_apfTest));
    WM_SelectWindow(hWin);
    GUI_RestoreContext(&ContextOld);
  #endif
}
Esempio n. 15
0
/*******************************************************************
*
*       _cbChild
*/
static void _cbChild(WM_MESSAGE* pMsg) {
  GUI_RECT Rect;
  int x, y;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    WM_GetInsideRect(&Rect);
    GUI_SetBkColor(_ChildColor);
    GUI_SetColor(_ChildFrame);
    GUI_ClearRectEx(&Rect);
    GUI_DrawRectEx(&Rect);
    GUI_SetColor(GUI_RED);
    GUI_SetFont(&GUI_Font24_ASCII);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Child window", x / 2, (y / 2) - 12);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
/*******************************************************************
*
*       _DemoEdit
*
  Edit a string until ESC or ENTER is pressed
*/
static void _DemoEdit(void) {
  EDIT_Handle hEdit;
  char aBuffer[28];
  int Key;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("WIDGET_Edit - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Use keyboard to modify string...", 160, 90);
  /* Create edit widget */
  hEdit = EDIT_Create( 50, 110, 220, 25, ' ', sizeof(aBuffer), WM_CF_SHOW);
  /* Modify edit widget */
  EDIT_SetText(hEdit, "Press <ENTER> when done...");
  EDIT_SetFont(hEdit, &GUI_Font8x16);
  EDIT_SetTextColor(hEdit, 0, GUI_RED);
  /* Set keyboard focus to edit widget */
  WM_SetFocus(hEdit);
  /* Handle keyboard until ESC or ENTER is pressed */
  do {
    WM_Exec();
    Key = GUI_GetKey();
  } while ((Key != GUI_KEY_ENTER) && (Key != GUI_KEY_ESCAPE));
  /* Fetch result from edit widget */
  if (Key == GUI_KEY_ENTER) {
    EDIT_GetText(hEdit, aBuffer, sizeof(aBuffer));
  }
  /* Delete the edit widget */
  EDIT_Delete(hEdit);
  GUI_ClearRect(0, 50, 319, 239);
  /* Display the changed string */
  if (Key == GUI_KEY_ENTER) {
    GUI_Delay(250);
    GUI_DispStringHCenterAt("The string you have modified is:", 160, 90);
    GUI_DispStringHCenterAt(aBuffer, 160, 110);
    GUI_Delay(3000);
    GUI_ClearRect(0, 50, 319, 239);
  }
  GUI_Delay(500);
}
Esempio n. 17
0
/**
  * @brief  wt_InitBackGround
  * @param  
  * @retval None
  */
void wt_InitBackGround(void)
{
//	uint32_t i = 0;
  
	sprintf((char *)StatusText, "就绪...");
	
	GUI_SelectLayer(0);
	GUI_SetLayerVisEx (0, 0);
  GUI_DrawBitmap(&bm_BackGround480x272A, 0,0);  
	
	GUI_SetLayerVisEx (0, 1);
	GUI_SelectLayer(1);
	GUI_SetBkColor(GUI_TRANSPARENT);
  GUI_Clear();
	
	// creat title
	hWin_Title = GUI_CreateDialogBox(_aTitleDialogCreate, GUI_COUNTOF(_aTitleDialogCreate), _cbTitle, WM_HBKWIN, 0, 0);

	//creat status
	hWin_Statue = WM_CreateWindowAsChild(0,LCD_GetYSize()-25,LCD_GetXSize(), 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS , _cbStatus, 0);
}
/*******************************************************************
*
*       _ShowHiresAntialiasing

  This function creates the memory auto devices and handle the
  rotation of the pointers
*/
static void _ShowHiresAntialiasing(void) {
  int i;
  GUI_AUTODEV aAuto[2];
  PARAM Param;
  Param.Factor = 3;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringAt("AA_HiResAntialiasing - Sample", 160, 5);
  GUI_SetFont(&GUI_Font6x8);
  GUI_DispStringHCenterAt("Using\nhigh\nresolution\nmode", 110, 180);
  GUI_DispStringHCenterAt("Not using\nhigh\nresolution\nmode", 210, 180);
  /* Create GUI_AUTODEV objects */
  for (i = 0; i < countof(aAuto); i++) {
    GUI_MEMDEV_CreateAuto(&aAuto[i]);
  }
  /* Calculate pointer for high resolution */
  for (i = 0; i < countof(_aPointer); i++) {
    _aPointerHiRes[i].x = _aPointer[i].x * Param.Factor;
    _aPointerHiRes[i].y = _aPointer[i].y * Param.Factor;
  }
  GUI_AA_SetFactor(Param.Factor); /* Set antialiasing factor */
  while(1) {
    for (i = 0; i < 1800; i++) {
      float Angle = (i >= 900) ? 1800 - i : i;
      Angle *= 3.1415926f / 1800;
      /* Draw pointer with high resolution */
      GUI_AA_EnableHiRes();
      GUI_RotatePolygon(Param.aPoints, _aPointerHiRes, countof(_aPointer), Angle);
      GUI_MEMDEV_DrawAuto(&aAuto[0], &Param.AutoInfo, _DrawHiRes, &Param);
      /* Draw pointer without high resolution */
      GUI_AA_DisableHiRes();
      GUI_RotatePolygon(Param.aPoints, _aPointer, countof(_aPointer), Angle);
      GUI_MEMDEV_DrawAuto(&aAuto[1], &Param.AutoInfo, _Draw, &Param);
      GUI_Delay(2);
    }
  }
}
Esempio n. 19
0
/*****************************************************************************
 * FUNCTION - ShowErrorMessage_C
 * DESCRIPTION: Displays an error message. 
 * Further actions (Rebooting or ignoring errors when not debugging) depend 
 * on the caller (or the caller of the caller...).
 *
 * Called by embOS\D3018X\OS_Error and Factory::FatalErrorOccured()
 *  
 ****************************************************************************/
extern "C" void ShowErrorMessage_C(const char* errorDescription = "-")
{
  int i;
  char sz_msg[250];
  WM_HWIN win;
  WM_HWIN win_next;
  GUI_RECT  rect;

  WM_SelectWindow(WM_GetDesktopWindow());
  win = WM_GetFirstChild(WM_GetDesktopWindow());

  while(win != (WM_HWIN) NULL)
  {
    win_next = WM_GetNextSibling(win);
    WM_DeleteWindow(win);
    win = win_next;
  }

  WM_SetStayOnTop(WM_GetDesktopWindow(),1);
  WM_BringToTop(WM_GetDesktopWindow());
  GUI_SetBkColor(GUI_WHITE);
  GUI_SetColor(GUI_BLACK);
  GUI_SetFont(&Helvetica_57_13);
  GUI_Clear();

  sprintf(sz_msg, "Fatal error.\n\n %s", errorDescription);

  rect.x0 = 0;
  rect.y0 = 10;
  rect.x1 = 239;
  rect.y1 = 319;

  for (i=0; i<5; i++)
  {
    GUI_Clear();
    GUI_Delay(100);
    GUI_DispStringInRect(sz_msg,&rect,GUI_TA_VCENTER|GUI_TA_HCENTER);
    GUI_Delay(500);
  }
}
Esempio n. 20
0
/**
  * @brief  Callback routine of desktop window
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbBk(WM_MESSAGE* pMsg) {
	uint32_t NCode, Id, sel;
	static uint32_t module_mutex = 0;

	switch (pMsg->MsgId) {
		case WM_PAINT:
			GUI_SetBkColor(GUI_TRANSPARENT);
			GUI_Clear();
			break;
		case WM_NOTIFY_PARENT:
			Id    = WM_GetId(pMsg->hWinSrc);
			NCode = pMsg->Data.v;
			switch (NCode) {
				case WM_NOTIFICATION_CLICKED:
					if ('0' == Id) {
						sel = ICONVIEW_GetSel(pMsg->hWinSrc);
						if (sel < GUI_COUNTOF(_aBitmapItem)) {
							if (0 == module_mutex) {
								module_mutex = 1;
								_apModules[sel](pMsg->hWinSrc);
								current_module = sel;
							}
						}
					}
					break;
				case 0x500:
					module_mutex = 0;
					current_module = 0xFF;
					ICONVIEW_SetSel(pMsg->hWinSrc, -1);
					break;
				default:
					break;
			}
			break;
			default:
				WM_DefaultProc(pMsg);
			break;
	}
}
Esempio n. 21
0
/*******************************************************************
*
*       _DemoListBox
*/
static void _DemoListBox(void) {
  LISTBOX_Handle hListBox;
  /* Display titel */
  GUI_SetBkColor(0xB00000);
  GUI_SetColor(0xFFFFFF);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("Listbox - Sample", 160, 5);
  GUI_Delay(SPEED / 2);
  /* Create listbox */
  GUI_SetFont(&GUI_Font8x16);
  GUI_SetTextAlign(GUI_TA_LEFT);
  GUI_DispStringAtCEOL("using", 5, 40);
  GUI_DispStringAtCEOL("LISTBOX_Create", 5, 55);
  GUI_Delay(SPEED * 0.9);
  hListBox = LISTBOX_Create(_ListBox, 100, 80, 120, 115, WM_CF_SHOW);
  GUI_Delay(SPEED * 0.75);
  /* Show serveral functions of listbox */
  _ShowSeveralFunctions(hListBox);
  /* Clear display */
  GUI_Clear();
  GUI_Delay(SPEED * 1.5);
}
Esempio n. 22
0
/*******************************************************************
*
*       _DemoDropDown
*/
static void _DemoDropDown(void) {
  WM_HWIN hDropDown;
  /* Display titel */
  GUI_SetBkColor(0xB00000);
  GUI_SetColor(0xFFFFFF);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("Dropdown - Sample", 160, 5);
  GUI_Delay(SPEED / 2);
  /* Create listbox */
  GUI_SetFont(&GUI_Font8x16);
  GUI_SetTextAlign(GUI_TA_LEFT);
  GUI_DispStringAtCEOL("using", 5, 40);
  GUI_DispStringAtCEOL("DROPDOWN_CreateEx", 5, 55);
  GUI_Delay(SPEED * 0.9);
  hDropDown = DROPDOWN_CreateEx(100, 80, 120, 115-50, WM_HBKWIN, WM_CF_SHOW, 0, 0);
  GUI_Delay(SPEED * 0.75);
  /* Show serveral functions of listbox */
  _ShowSeveralFunctions(hDropDown);
  /* Clear display */
  GUI_Clear();
  GUI_Delay(SPEED * 1.5);
}
/*******************************************************************
*
*       _DemoRedraw
*/
static void _DemoRedraw(void) {
  WM_CALLBACK* _cbOldBk;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("WM_Redraw - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  while(1) {
    /* Move a window over background */
    _MoveWindow("Background has not been redrawn");
    /* Clear background */
    GUI_ClearRect(0, 50, 319, 239);
    GUI_Delay(1000);
    /* Set callback for background window */
    _cbOldBk = WM_SetCallback(WM_HBKWIN, _cbBkWindow);
    /* Move a window over background */
    _MoveWindow("Background has been redrawn");
    /* Delete callback for Background window */
    WM_SetCallback(WM_HBKWIN, _cbOldBk);
  }
}
Esempio n. 24
0
/*********************************************************************
*
*       _cbDialogIntro
*
* Function description
*   Callback routine of DialogIntro
*/
static void _cbDialogIntro(WM_MESSAGE * pMsg) {
  GUI_RECT Rect;
  WM_HWIN  hDlg;
  int      Id;
  unsigned i;
  int      ySizeText;
  int      yPos;

  yPos = 40;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    WM_GetClientRect(&Rect);
    GUI_SetBkColor(GUI_WHITE);
    GUI_SetColor(GUI_BLACK);
    GUI_Clear();
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("Virtual screens", 160, 5);
    GUI_SetFont(&GUI_Font13B_ASCII);
    GUI_DrawBitmap(&_bmLogoBitmap, (Rect.x1 - _bmLogoBitmap.XSize) / 2, yPos);
    ySizeText = GUI_GetFontSizeY();
    yPos += _bmLogoBitmap.YSize + 15;
    for (i = 0; i < GUI_COUNTOF(_apDialogIntro); i++) {
      GUI_DispStringHCenterAt(_apDialogIntro[i], Rect.x1 / 2, yPos);
      yPos += ySizeText;
    }
    break;
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
      Id = WM_GetId(pMsg->hWinSrc);      // Id of widget
      if (Id == GUI_ID_BUTTON0) {
        GUI_EndDialog(hDlg, 0);
      }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 25
0
/**
  * @brief  Paints Stop button
  * @param  hObj: button handle
  * @retval None
  */
static void _OnPaint_stop(BUTTON_Handle hObj) {
  
  GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
  GUI_Clear();
  
  if((RecorderMode == RECORDER_MODE_REC_IDLE)||
     (RecorderMode == RECORDER_MODE_REC_DISABLED))
  {
      GUI_DrawBitmapMag(&record_bmstop_des, 0, 0, 2, 2);
  }
  else 
  {
    if((WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED))
    {
      GUI_DrawBitmapMag(&record_bmstop_pressed, 0, 0, 2, 2);
    } 
    else
    {
      GUI_DrawBitmapMag(&record_bmstop, 0, 0, 2, 2); 
    }
  }  
}
Esempio n. 26
0
/*******************************************************************
*
*       _cbWindow2
*/
static void _cbWindow2(WM_MESSAGE * pMsg) {
  GUI_RECT Rect;
  int      x;
  int      y;

  switch (pMsg->MsgId) {
  case WM_PAINT:
    WM_GetInsideRect(&Rect);
    GUI_SetBkColor(_WindowColor2);
    GUI_SetColor(_FrameColor2);
    GUI_ClearRectEx(&Rect);
    GUI_DrawRectEx(&Rect);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font24_ASCII);
    x = WM_GetWindowSizeX(pMsg->hWin);
    y = WM_GetWindowSizeY(pMsg->hWin);
    GUI_DispStringHCenterAt("Window 2", x / 2, (y / 4) - 12);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 27
0
/*******************************************************************
*
*       _DemoScrollbarMove

  This function creates the window and his child objects. Then it
  runs into a idle-loop, so that the window manager can handle the
  objects.
*/
static void _DemoScrollbarMove(void) {
  int x, y;
  WM_HWIN hWindow;
  SCROLLBAR_Handle hScroll;
  /* Clear display and display headline */
  GUI_SetBkColor(GUI_BLUE);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_DispStringAt("SCROLLBAR_Move - Sample", 160, 5);
  GUI_SetTextAlign(GUI_TA_LEFT);
  GUI_SetColor(0xFFFFFF);
  GUI_SetFont(&GUI_Font8x16);
  /* Create the window */
  hWindow = WM_CreateWindow(50, 90, 220, 79, WM_CF_SHOW, &_cbWindow, 0);
  /* Create the scrollbar */
  hScroll = SCROLLBAR_CreateAttached(hWindow, 0);
  SCROLLBAR_SetNumItems(hScroll, 48 * EDIT_MAX_X);
  SCROLLBAR_SetPageSize(hScroll, 220);
  /* Create the edit-fields */
  for (y = 0; y < EDIT_MAX_Y; y++) {
    for (x = 0; x < EDIT_MAX_X; x++) {
      _aahEdit[y][x] = EDIT_CreateAsChild(x * 48, y * 22, 48, 22, 
                                        hWindow, 13, WM_CF_SHOW, 5);
      EDIT_SetTextAlign(_aahEdit[y][x], GUI_TA_RIGHT | GUI_TA_VCENTER);
      EDIT_SetFont(_aahEdit[y][x], &GUI_Font8x16);
      EDIT_SetDecMode(_aahEdit[y][x], ((y * EDIT_MAX_X) + x) * 100, -99999, +99999, 2, 0);
	  }
  }
  /* idle-loop */
  while (1) {
    GUI_Exec();
    GUI_Delay(20);
  }
  /* delete window and clear display */
  WM_DeleteWindow(hWindow);
  GUI_Clear();
}
Esempio n. 28
0
/*********************************************************************
*
*       MainTask
*/
void MainTask_TOUCHCAL(void) {
  int aPhysX[2], aPhysY[2], aLogX[2], aLogY[2], i;
  GUI_Init();
  GUI_SetBkColor(GUI_WHITE);
  GUI_Clear();
  GUI_SetColor(GUI_BLACK);
  GUI_SetFont(&GUI_Font13B_ASCII);
  _Explain();
  /* Set the logical values */
  aLogX[0] = 15;
  aLogY[0] = 15;
  aLogX[1] = LCD_GetXSize() - 15;
  aLogY[1] = LCD_GetYSize() - 15;
  /* Get the physical values of the AD converter for 2 positions */
  for (i = 0; i < 2; i++) {
    _GetPhysValues(aLogX[i], aLogY[i], &aPhysX[i], &aPhysY[i], _acPos[i]);
  }
  /* Use the physical values to calibrate the touch screen */
  GUI_TOUCH_Calibrate(0, aLogX[0], aLogX[1], aPhysX[0], aPhysX[1]); /* Calibrate X-axis */ //如果我们要存到外部存储器中 那么就存储这里的8个参数
  GUI_TOUCH_Calibrate(1, aLogY[0], aLogY[1], aPhysY[0], aPhysY[1]); /* Calibrate Y-axis */
  /* Display the result */
  GUI_CURSOR_Show();
  GUI_Clear();
  _DispStringCentered("Congratulation, your\n"
                      "touch screen has been\n"
                      "calibrated. Please use\n"
                      "the cursor to test\n"
                      "the calibration...");
  /* Let the user play */
  while(1) {
    GUI_PID_STATE State;

    GUI_TOUCH_GetState(&State);
    if (State.Pressed == 1) {
      GUI_FillCircle(State.x, State.y, 3);
    }
    GUI_Delay(10);
  }
}
Esempio n. 29
0
void Display_User_Data(u8 *datain,u8 blank)
{
	u8 i;
	GUI_SetBkColor(GUI_BLACK);
	GUI_Clear();
	DisplayBattery();
	GUI_SetColor(GUI_RED);
	GUI_GotoXY(0, 10);
	
  for (i = 0; i < 32; i++)
  {
      if ((i != 0) && ((i % 8) == 0))
      {
          GUI_DispChar('\n');
          GUI_DispHex(datain[i+blank*32],2);
      }
      else			
      {
          GUI_DispHex(datain[i+blank*32],2);
      }
  }
}
Esempio n. 30
0
static void _Draw(void * p) {
  int i;
  PARAM * pParam = (PARAM *)p;
  int lcd_xsize;
  int lcd_ysize;
  lcd_xsize = LCD_GetXSize();
  lcd_ysize = LCD_GetYSize();  
  GUI_SetBkColor(GUI_BLACK);
  GUI_SetColor(GUI_DARKGRAY);
  GUI_ClearRect(19, (lcd_ysize - 20) - _YSize, (lcd_xsize - 2), (lcd_ysize - 21));
  for (i = 0; i < (_YSize / 2); i += 20) {
    GUI_DrawHLine((lcd_ysize - 20) - (_YSize / 2) + i, 19, (lcd_xsize - 2));
    if (i) {
      GUI_DrawHLine((lcd_ysize - 20) - (_YSize / 2) - i, 19, (lcd_xsize - 2));
    }
  }
  for (i = 40; i < (lcd_xsize - 20); i += 40) {
    GUI_DrawVLine(18 + i, (lcd_ysize - 20) - _YSize, (lcd_ysize - 21));
  }
  GUIDEMO_SetColor(COLOR_GRAPH0);
  GUI_DrawGraph(pParam->aY, (lcd_xsize - 20), 19, (lcd_ysize - 20) - _YSize);
}