static U8 DistortionDeleteItems()
{
	if(hDistortionItems[DISTORTION_LEFTARROW])
	{
		BUTTON_Delete(hDistortionItems[DISTORTION_LEFTARROW]);
	}
	if(hDistortionItems[DISTORTION_RIGHTARROW])
	{
		BUTTON_Delete(hDistortionItems[DISTORTION_RIGHTARROW]);
	}
	if(hDistortionItems[DISTORTION_PROGDRIVE])
	{
		MisaProgressbar_Delete(hDistortionItems[DISTORTION_PROGDRIVE]);
	}
	if(hDistortionItems[DISTORTION_PROGTONE])
	{
		MisaProgressbar_Delete(hDistortionItems[DISTORTION_PROGTONE]);
	}
	if(hDistortionItems[DISTORTION_PROGLEVEL])
	{
		MisaProgressbar_Delete(hDistortionItems[DISTORTION_PROGLEVEL]);
	}
	//if(hDistortionItems[DISTORTION_POPMENU])
	//{
	//	MENU_Delete(hDistortionItems[DISTORTION_POPMENU]);
	//}
	DeleteCommComponent(hCOMPcomm);
	return 0;
}
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;
}
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;
}
/*******************************************************************
*
*       _DemoButton
*/
static void _DemoButton(void) {
  BUTTON_Handle hButton;
  int Stat = 0;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on phone button...", 160,80);
  GUI_Delay(500);
  /* Create the button */
  hButton = BUTTON_Create(142, 100, 36, 40, GUI_ID_OK, WM_CF_SHOW);
  /* Modify the button attributes */
  BUTTON_SetBkColor (hButton, 1, GUI_RED);
  /* Loop until button is pressed */
  while (1) {
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_1, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
    if (!_Wait(50)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_0, 2, 4);
    if (!_Wait(45)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_2, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_2, 2, 4);
    if (!_Wait(50)) break;
    BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
    BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_0, 2, 4);
    if (!_Wait(45)) break;
  }
  BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_1, 2, 4);
  BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
  GUI_ClearRect(0, 80, 319, 120);
  GUI_DispStringHCenterAt("You have answered the telephone", 160, 145);
  GUI_Delay(2000);
  /* Delete button object */
  BUTTON_Delete(hButton);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(400);
}
Beispiel #5
0
/*******************************************************************
*
*       _DemoButton
*/
static void _DemoButton(void) {
  BUTTON_Handle hButton;
  int Stat = 0;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on phone button...", 160,80);
  GUI_Delay(500);
  /* Create the button */
  hButton = BUTTON_Create(142, 100, 36, 40, GUI_ID_OK, WM_CF_SHOW);
  /* Modify the button attributes */
  BUTTON_SetBkColor(hButton, 1, GUI_RED);
  BUTTON_SetBitmapEx(hButton, 0, &bm_1bpp_0, 2, 4);
  BUTTON_SetBitmapEx(hButton, 1, &bm_1bpp_1, 2, 4);
  /* Loop until button is pressed */
  while(GUI_GetKey() != GUI_ID_OK) {
    if (Stat ^= 1) {
      BUTTON_SetState(hButton, 
                      BUTTON_STATE_HASFOCUS | BUTTON_STATE_INACTIVE);
    } else {
      BUTTON_SetState(hButton, 
                      BUTTON_STATE_HASFOCUS | BUTTON_STATE_PRESSED);
    }
    GUI_Delay(500);
  }
  /* Delete button object */
  BUTTON_Delete(hButton);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(1750);
}
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'));
}
Beispiel #7
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);
}
Beispiel #8
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
}
Beispiel #9
0
static U8 SynthDeleteItems()
{
	if(hSynthItems[SYNTH_STRINGPANEL1])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL1]);
		hSynthItems[SYNTH_STRINGPANEL1] = 0;
	}
	if(hSynthItems[SYNTH_STRINGPANEL2])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL2]);
		hSynthItems[SYNTH_STRINGPANEL2] = 0;
	}
	if(hSynthItems[SYNTH_STRINGPANEL3])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL3]);
		hSynthItems[SYNTH_STRINGPANEL3] = 0;
	}
	if(hSynthItems[SYNTH_STRINGPANEL4])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL4]);
		hSynthItems[SYNTH_STRINGPANEL4] = 0;
	}
	if(hSynthItems[SYNTH_STRINGPANEL5])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL5]);
		hSynthItems[SYNTH_STRINGPANEL5] = 0;
	}
	if(hSynthItems[SYNTH_STRINGPANEL6])
	{
		MisaSynthString_Delete(hSynthItems[SYNTH_STRINGPANEL6]);
		hSynthItems[SYNTH_STRINGPANEL6] = 0;
	}
	if(hSynthItems[SYNTH_MIDICTRL])
	{
		BUTTON_Delete(hSynthItems[SYNTH_MIDICTRL]);
		hSynthItems[SYNTH_MIDICTRL] = 0;
	}
	DeleteCommComponent(hCOMPcomm);
	return 0;
}
Beispiel #10
0
//@@@@@@@@@@@@@@@@@@@@@  屏幕上显示的按键  @@@@@@@@@@@@@@@@@@@@@@@@@@
static void Button(void) 
{

 BUTTON_Handle hButton[6];
 int t=0;
 int i=0;
 /* Create the button*/
      //BUTTON_SetBkColor(hButton[0],0,GUI_RED);

 hButton[0] = BUTTON_Create(260, 160, 20, 20, 1, WM_CF_SHOW);
 hButton[1] = BUTTON_Create(240, 180, 20, 20, 2, WM_CF_SHOW);
 hButton[2] = BUTTON_Create(260, 180, 20, 20, 3, WM_CF_SHOW);
 hButton[3] = BUTTON_Create(280, 180, 20, 20, 4, WM_CF_SHOW);
 hButton[4] = BUTTON_Create(260, 220, 20, 20, 5, WM_CF_SHOW);
 //hButton[5] = BUTTON_Create(240, 220, 20, 20, 6, WM_CF_SHOW);

 BUTTON_SetText(hButton[0], "w");
 BUTTON_SetText(hButton[1], "a");
 BUTTON_SetText(hButton[2], "s");
 BUTTON_SetText(hButton[3], "d");
 BUTTON_SetText(hButton[4], "B");
 //BUTTON_SetText(hButton[5], "W");

 t=GUI_WaitKey();
 
 switch( t )
 {
 case 1:
 point.y_point-=20;
 if(point.y_point<20)
 point.y_point+=20;
 break;
 case 2:
 point.x_point-=20;
 if(point.x_point<20)
 point.x_point+=20;
 break;
 case 3:
 point.y_point+=20;
 if(point.y_point>200)
 point.y_point-=20;
 break;
 case 4:
 point.x_point+=20;
 if(point.x_point>200)
 point.x_point-=20;
 break;
 case 5:
 if( map[point.y_map][point.x_map]==0 )
 {
change_color();
map[point.y_map][point.x_map]=point.color;
draw_map();

if( if_won(point.y_map,point.x_map,point.color) )
{
GUI_SetTextMode(GUI_DM_TRANS); //设置为透明
GUI_SetFont(&GUI_Font8x16x1x2);
GUI_DispStringAt("win!",250,90);

for(i=0;i<5;i++)
GUI_Delay(1000);
map_initial();

GUI_SetDrawMode(GUI_DM_NORMAL);
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);
draw_net();
draw_point();
}

 }
 break;
 case 6:
 /*
 if( map[point.y_map][point.x_map]==0 )
map[point.y_map][point.x_map]=1;
 */
 break;
 default:

 break;
 
 }

 
 
 for(t=0;t<6;t++)
BUTTON_Delete(hButton[t]);
 
}
Beispiel #11
0
void vHeartbeatTask (void * pvParameters){

	int Key, Entries, ySize;
	uint16_t click_cnt=0;
	int8_t Item_nb;
	BUTTON_Handle hOK_Button, hTest_Key;
	LISTBOX_Handle hStationListBox;
	static enum GuiState eGuiState = SELECT;
	static const GUI_ConstString StationList[] = {"ZET", "RMFFM", "RMFMAXXX", "SKY.FM", "ESKA ROCK", "TERMINAL", NULL};

	vSemaphoreCreateBinary(xButton_pushed_Semaphore);
	if(xDMAch1_Semaphore != NULL){
		xSemaphoreTake(xButton_pushed_Semaphore, 0);
	}else{
		// The semaphore was not created
	}
	BUTTON_Config();	//INT0 Button as source of interrupt
	xSemaphoreTake(xButton_pushed_Semaphore, 0);

	xListBoxQueue = xQueueCreate(2, sizeof(int8_t));


	GUI_Init();
	if(0){
		_ExecCalibration();
	}else{
		_DefaultCalibration();
	}

	GUI_SetBkColor(GUI_BLUE);
	GUI_Clear();



	if (xSemaphoreTake(xDhcpCmplSemaphore_1, portMAX_DELAY) == pdTRUE) {
		/* OK button */
		hOK_Button = BUTTON_CreateEx(120, 210, 80, 20, 0, WM_CF_SHOW, 0, 12);
		GUI_SetFont(&GUI_Font32_ASCII);
		BUTTON_SetText(hOK_Button, "OK");

		/* Cancel button */
		hTest_Key = BUTTON_CreateEx(120, 180, 80, 20, 0, WM_CF_SHOW, 0, 13);
		GUI_SetFont(&GUI_Font16B_ASCII);
		BUTTON_SetText(hTest_Key, "CLICK");
		WM_SetStayOnTop(hTest_Key, 1);

		/* Station list */
		Entries = 6;//countof(StationList) - 1;
		ySize = GUI_GetYDistOfFont(&GUI_Font16B_ASCII)*Entries;
		hStationListBox = LISTBOX_CreateEx(100, 10, 120, ySize, 0, WM_CF_SHOW, 0, 5, StationList);
		SCROLLBAR_CreateAttached(hStationListBox, SCROLLBAR_CF_VERTICAL);

	}

	while(1){
		Key = GUI_GetKey();
		//top = WM_GetStayOnTop(hTest_Key);

		switch(eGuiState){
		case SELECT:
			switch (Key){
			case 12:
				Item_nb = LISTBOX_GetSel(hStationListBox);
				if(Item_nb >= 0){
					if(xQueueSendToBack(xListBoxQueue, &Item_nb, 50/portTICK_RATE_MS) == pdPASS){
						/* OK button delete */
						BUTTON_Delete(hOK_Button);
						GUI_SetBkColor(GUI_BLUE);
						GUI_ClearRect(120, 210, 200, 230);
						GUI_ClearKeyBuffer();

						/* Listbox delete */
						LISTBOX_Delete(hStationListBox);
						GUI_ClearRect(100, 10, 220, ySize+10);

						eGuiState = PLAYING;
					}
				}
				vTaskResume(xShoutcastTaskHandle);
				break;
			case 13:
				click_cnt++;
				GUI_SetFont(&GUI_Font16B_ASCII);
				Item_nb = LISTBOX_GetSel(hStationListBox);
				GUI_DispStringAt("CNT = ", 0, 210);
				GUI_DispDecSpace(Item_nb, 3);
				break;
			default:
				break;
			}

			break;
		case PLAYING:
			switch (Key){
			case 13:
				click_cnt++;
				GUI_SetFont(&GUI_Font16B_ASCII);
//				Item_nb = LISTBOX_GetSel(hStationListBox);
				GUI_DispStringAt("CNT = ", 0, 210);
				GUI_DispDecSpace(123, 3);
				break;
			default:
				break;
			}
		}
		vTaskDelay(20/portTICK_RATE_MS);
	}
}
Beispiel #12
0
int main(void) {
	BUTTON_Handle hButton, hB1, hB2, hB3, hB4;
	PROGBAR_Handle hProgbar;
	uint8_t i;
	
	/* Initialize system */
	SystemInit();
	
	/* Initialize delay functions */
	TM_DELAY_Init();
	
	/* Initialize LEDs */
	TM_DISCO_LedInit();
	
	/* Initialize emWin */
	if (TM_EMWIN_Init() != TM_EMWIN_Result_Ok) {
		/* Initialization error */
		while (1) {
			/* Toggle RED led */
			TM_DISCO_LedToggle(LED_RED);
			
			/* Delay */
			Delayms(100);
		}
	}
	
	/* Create progress bar at location x = 10, y = 10, length = 219, height = 30 */
	hProgbar = PROGBAR_CreateEx(10, 10, 219, 30, 0, WM_CF_SHOW, 0, GUI_ID_PROGBAR0);
	/* Set progress bar font */
	PROGBAR_SetFont(hProgbar, &GUI_Font8x16);
	/* Set progress bar text */
	PROGBAR_SetText(hProgbar, "LOADING..Please wait..");
	
	/* Imitate loading */
	for (i = 1; i <= 100; i++) {
		/* Set bar */
		PROGBAR_SetValue(hProgbar, i);
		/* Little delay, update value on LCD */
		GUI_Delay(20);
	}
	
	/* Create button with GUI_ID_OK ID number */
	hButton = BUTTON_CreateEx(10, 50, 219, 30, 0, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
	/* Set text and font */
	BUTTON_SetText(hButton, "Click me to continue..");
	BUTTON_SetFont(hButton, &GUI_Font8x15B_ASCII);
	
	/* Execute, show button */
	GUI_Exec();
	
	/* Wait till button pressed */
	while (1) {
		/* Check if button was pressed */
		if (GUI_GetKey() == GUI_ID_BUTTON0) {
			/* Led Off */
			TM_DISCO_LedOff(LED_GREEN);
			
			/* Stop while loop */
			break;
		}
		/* Toggle green led */
		TM_DISCO_LedToggle(LED_GREEN);
		/* Delay 100ms */
		GUI_Delay(100);
	}

	/* Delete button functionality */
	BUTTON_Delete(hButton);
	/* Delete button from LCD */
	GUI_ClearRect(10, 50, 269, 90);
	
	/* Create buttons for leds control */
	hB1 = BUTTON_CreateEx(10, 90, 105, 50, 0, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
	hB2 = BUTTON_CreateEx(124, 90, 105, 50, 0, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
	hB3 = BUTTON_CreateEx(10, 150, 105, 50, 0, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
	hB4 = BUTTON_CreateEx(124, 150, 105, 50, 0, WM_CF_SHOW, 0, GUI_ID_BUTTON4);
	
	/* Set font for buttons */
	BUTTON_SetFont(hB1, &GUI_Font13HB_ASCII);
	BUTTON_SetFont(hB2, &GUI_Font13HB_ASCII);
	BUTTON_SetFont(hB3, &GUI_Font13HB_ASCII);
	BUTTON_SetFont(hB4, &GUI_Font13HB_ASCII);
	
	/* Set button text */
	BUTTON_SetText(hB1, "GREEN on");
	BUTTON_SetText(hB2, "GREEN off");
	BUTTON_SetText(hB3, "RED on");
	BUTTON_SetText(hB4, "RED off");
	
	/* Button styling */
	/* Background color when button is not pressed */
	BUTTON_SetBkColor(hB1, BUTTON_CI_UNPRESSED, GUI_DARKGREEN);
	/* Background color when button is pressed */
	BUTTON_SetBkColor(hB1, BUTTON_CI_PRESSED, GUI_GREEN);
	
	/* Background color when button is not pressed */
	BUTTON_SetBkColor(hB3, BUTTON_CI_UNPRESSED, GUI_DARKRED);
	/* Background color when button is pressed */
	BUTTON_SetBkColor(hB3, BUTTON_CI_PRESSED, GUI_RED);
	
	/* Show buttons */
	GUI_Exec();
	
	while (1) {
		/* Get pressed key */
		switch (GUI_GetKey()) {
			case GUI_ID_BUTTON1:
				/* Button 1 pressed */
				TM_DISCO_LedOn(LED_GREEN);
				break;
			case GUI_ID_BUTTON2:
				/* Button 2 pressed */
				TM_DISCO_LedOff(LED_GREEN);
				break;
			case GUI_ID_BUTTON3:
				/* Button 3 pressed */
				TM_DISCO_LedOn(LED_RED);
				break;
			case GUI_ID_BUTTON4:
				/* Button 4 pressed */
				TM_DISCO_LedOff(LED_RED);
				break;
			default:
				break;
		}
	}
}