Пример #1
0
int GUIDEMO_Delay(int t) {
  int r = 0;
  #if GUI_WINSUPPORT
    int tRem, tEnd = GUI_GetTime() + t;
    PROGBAR_Handle hProg;
    WM_SetForegroundWindow(_ahButton[0]);
    hProg = (t >100) ? PROGBAR_Create(_FrameWinPosX[1]  + 10,
                                      _FrameWinPosY[1]  + 25,
                                      _FrameWinSizeX[1] - 20,
                                      7,
                                      WM_CF_SHOW|WM_CF_STAYONTOP) : 0;
    #if GUI_SUPPORT_MEMDEV
      PROGBAR_EnableMemdev(hProg);  
    #endif
    PROGBAR_SetMinMax(hProg, 0, t);
    for (; tRem = tEnd - GUI_GetTime(), (tRem > 0) && !GUIDEMO_CheckCancel();) {
      PROGBAR_SetValue(hProg, t - tRem);
      WM_ExecIdle();
      GUI_Delay(10);
    }
    PROGBAR_Delete(hProg);
    _UpdateCmdWin();
    WM_ExecIdle();
  #else
    GUI_Delay(t);
  #endif
  return r;
}
Пример #2
0
int GUIDEMO_Delay(int t) {

  int r = 0;
  #if GUI_WINSUPPORT
    int tm, value;
    #if GUIDEMO_LARGE
      PROGBAR_Handle hProg;
    #endif
    WM_SetForegroundWindow(_ahButton[0]);
    #if GUIDEMO_LARGE
      hProg = (t >100) ? PROGBAR_CreateAsChild(10, 10, 60, 7, _ahInfoWin[1], 0,
                                        WM_CF_SHOW | WM_CF_STAYONTOP| WM_CF_MEMDEV) : 0;
      PROGBAR_SetMinMax(hProg, 0, t);
    #endif
    tm = GUI_GetTime();
    do {
      value = GUI_GetTime() - tm;
      #if GUIDEMO_LARGE
        PROGBAR_SetValue(hProg, value);
        WM_ExecIdle();
      #endif
      GUI_Delay(10);
    } while ((value < t) && !GUIDEMO_CheckCancel());
    #if GUIDEMO_LARGE
      PROGBAR_Delete(hProg);
    #endif
    _UpdateCmdWin();
    WM_ExecIdle();
  #else
    GUI_Delay(t);
  #endif
  return r;

}
/*******************************************************************
*
*        _DemoProgBar
*/
static void _DemoProgBar(void) {
  PROGBAR_Handle ahProgBar;
  int i;
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringAt("Progress bar", 100,80);
  /* Create progress bar */  
  ahProgBar = PROGBAR_Create(100, 100, 100, 20, WM_CF_SHOW);
  GUI_Delay (500);
  /* Modify progress bar */
  for (i = 0; i <= 100; i++) {
    PROGBAR_SetValue(ahProgBar, i);
    GUI_Delay(10);
  }
  GUI_Delay (400);
  /* Delete progress bar */  
  PROGBAR_Delete(ahProgBar);
  GUI_ClearRect(0, 50, 319, 239);
  GUI_Delay(750);
}
Пример #4
0
int GUIDEMO_WaitKey(void) {
  int r = 0;
  int tMax = GUI_GetTime() + 4000;
  int tDiff; 
  #if GUI_WINSUPPORT
    PROGBAR_Handle hProg = PROGBAR_Create(LCD_GetXSize() - 70, 
                                          LCD_GetYSize() - 40, 
                                          80, 5, WM_CF_SHOW);
  #endif
  while (tDiff = tMax-GUI_GetTime(), (tDiff > 0) && !GUIDEMO_CheckCancel()) {
    if ((r = GUI_GetKey()) != 0)
      break;
  }
  #if GUI_WINSUPPORT
    PROGBAR_Delete(hProg);
    WM_ExecIdle();
  #endif
  return r;
}
Пример #5
0
void GUIDEMO_DemoProgBar(void) {
  int i, iRep;
  int XMid = LCD_GetXSize() / 2;
  int YMid = LCD_GetYSize() / 2;
  int Length[2] = {100, 140};
  int Height[2] = {20, 10};
  #if GUIDEMO_LARGE
    int MaxReps = 2;
  #else
    int MaxReps = 1;
  #endif
  PROGBAR_Handle ahProgBar[2];
  GUIDEMO_ShowIntro("Widgets", 
                    "\nProgressbars in"
                    "\nall variations");
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Progress bar", XMid, YMid - 40);
  /* Create `em */  
  ahProgBar[0] = PROGBAR_Create(XMid - Length[0] / 2,
                                YMid - 15,
                                Length[0], 
                                Height[0], 
                                WM_CF_SHOW);
  ahProgBar[1] = PROGBAR_Create(XMid - Length[1] / 2,
                                YMid + 20,
                                Length[1], 
                                Height[1], 
                                WM_CF_SHOW);
  /* Use memory device (optional, for better looks) */
  #if GUI_SUPPORT_MEMDEV
    PROGBAR_EnableMemdev(ahProgBar[0]);
    PROGBAR_EnableMemdev(ahProgBar[1]);
  #endif
  GUIDEMO_Delay (1000);
  PROGBAR_SetMinMax(ahProgBar[1], 0, 500);
  for (iRep = 0; iRep < MaxReps; iRep++) {
    PROGBAR_SetFont(ahProgBar[0], &GUI_Font8x16);
    #if   (LCD_BITSPERPIXEL == 2)
      PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_BLACK);
      PROGBAR_SetBarColor(ahProgBar[1], 0, GUI_BLACK);
      PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_LIGHTGRAY);
    #elif (LCD_BITSPERPIXEL <= 4)
      PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_DARKGRAY);
      PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_LIGHTGRAY);
    #else
      PROGBAR_SetBarColor(ahProgBar[0], 0, GUI_GREEN);
      PROGBAR_SetBarColor(ahProgBar[0], 1, GUI_RED);
    #endif
    for (i = 0; (i <= 100) && !GUIDEMO_CheckCancel(); i++) {
      PROGBAR_SetValue(ahProgBar[0], i);
      PROGBAR_SetValue(ahProgBar[1], i);
      GUI_Delay(5);
    }
    PROGBAR_SetText(ahProgBar[0], "Tank empty");
    for (; (i >= 0)&& !GUIDEMO_CheckCancel(); i--) {
      PROGBAR_SetValue(ahProgBar[0], i);
      PROGBAR_SetValue(ahProgBar[1], 200 - i);
      GUI_Delay(5);
    }
    PROGBAR_SetText(ahProgBar[0], "Any text ...");
    PROGBAR_SetTextAlign(ahProgBar[0], GUI_TA_LEFT);
    for (; (i <= 100)&& !GUIDEMO_CheckCancel(); i++) {
      PROGBAR_SetValue(ahProgBar[0], i);
      PROGBAR_SetValue(ahProgBar[1], 200 + i);
      GUI_Delay(5);
    }
    for (; (i >= 0)&& !GUIDEMO_CheckCancel(); i--) {
      PROGBAR_SetValue(ahProgBar[0], i);
      PROGBAR_SetValue(ahProgBar[1], 400 - i);
      GUI_Delay(5);
    }
    PROGBAR_SetFont(ahProgBar[0], &GUI_FontComic18B_1);
    PROGBAR_SetText(ahProgBar[0], "Any font ...");
    for (; (i <= 100)&& !GUIDEMO_CheckCancel(); i++) {
      PROGBAR_SetValue(ahProgBar[0], i);
      PROGBAR_SetValue(ahProgBar[1], 400 + i);
      GUI_Delay(5);
    }
    GUIDEMO_Delay(1000);
  }
  GUIDEMO_Delay(1000);
  PROGBAR_Delete(ahProgBar[0]);
  PROGBAR_Delete(ahProgBar[1]);
  GUIDEMO_Delay(1000);
  GUI_SetFont(&GUI_Font10S_ASCII);
}