/*********************************************************************
*
*       _WIDGET_EFFECT_Simple_DrawDownRect
*/
static void _WIDGET_EFFECT_Simple_DrawDownRect(const GUI_RECT* pRect) {
  GUI_CONTEXT Context;
  GUI_SaveContext(&Context);
  LCD_SetColor(GUI_BLACK);
  GUI_DrawRect(pRect->x0, pRect->y0, pRect->x1, pRect->y1);          /* Draw rectangle around it */
  GUI_RestoreContext(&Context);
}
static void _UpdateInfoWin(void) {
  #if GUI_WINSUPPORT && GUIDEMO_LARGE
    GUI_RECT rClient;
    WM_HWIN hWin;
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    /* Update info  window */
    WM_ShowWindow(_ahInfoWin[0]);
    WM_ShowWindow(_ahFrameWin[0]);
    hWin = WM_SelectWindow(_ahInfoWin[0]);
    GUI_GetClientRect(&rClient);
    GUI_SetBkColor(GUI_WHITE);
    GUI_Clear();
    GUI_SetColor(GUI_BLACK);
    //GUI_SetFont(&GUI_Font13_1);
	GUI_SetFont(&GUI_FontHZ12);
    GUI_SetTextAlign(GUI_TA_HCENTER);
    GUI_DispStringHCenterAt(_sInfo, (rClient.x1 - rClient.x0) / 2, 0);
    GUI_SetTextAlign(GUI_TA_LEFT);
    GUI_SetFont(&GUI_Font8_ASCII);
    GUI_DispStringAt(_sExplain, 0, 20);
    WM_SelectWindow(hWin);
    GUI_RestoreContext(&ContextOld);
  #endif
}
void GUIDEMO_ShowIntro(const char * s, const char * sExp) {
  GUI_CONTEXT ContextOld;
  GUI_SaveContext(&ContextOld);
  _sInfo = s;
  _sExplain = sExp;
  GUI_SetDefault();
  GUIDEMO_HideInfoWin();
  GUI_SetBkColor(GUI_BLUE);
  GUI_SetColor(GUI_WHITE);
  GUI_Clear();
  //GUI_SetFont(&GUI_FontComic18B_ASCII);
  GUI_SetFont(&GUI_FontHZ12);
  GUI_DispStringHCenterAt(s, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 3 - 10);
  if (_sExplain) {
    GUI_SetFont(&GUI_Font8_ASCII);
    GUI_DispStringHCenterAt(_sExplain, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 2 - 10);
  }
  GUIDEMO_Delay(_sExplain ? 2000 : 4000);
#if GUI_WINSUPPORT
  _UpdateInfoWin();
  _UpdateCmdWin();
#endif
  GUI_RestoreContext(&ContextOld);
  #if GUI_WINSUPPORT
    WM_ExecIdle();
  #endif
  GUIDEMO_NotifyStartNext();
  GUI_SetBkColor(GUI_RED);
  GUI_Clear();
}
Exemple #4
0
static void _DrawNext(void) {
  int UpdateRem = 1;
  WM_HWIN iWin = (NextDrawWin == WM_HWIN_NULL) ? WM__FirstWin : NextDrawWin;
  GUI_CONTEXT ContextOld;
  GUI_SaveContext(&ContextOld);
  /* Make sure the next window to redraw is valid */
  for (; (iWin!=WM_HWIN_NULL) && UpdateRem; ) {
    WM_Obj* pWin = WM_H2P(iWin);
    if (pWin->Status & WM_SF_INVALID) {
      U8 Status = (pWin->Status &=  ~WM_SF_INVALID); /* Clear invalid flag */
      WM__NumInvalidWindows--;
      /* Send WM_PAINT if window is visible and a callback is defined */
      if ((pWin->cb != NULL)  && (Status & WM_SF_ISVIS)) {
        WM_MESSAGE Msg;
        Msg.hWin   = iWin;
        Msg.MsgId  = WM_PAINT;
        Msg.Data.p = (GUI_RECT*)&pWin->InvalidRect;
        WM_SelectWindow(iWin);
        WM_SetDefault();
        #if GUI_SUPPORT_MEMDEV
          if (Status & WM_SF_MEMDEV) {
            GUI_RECT r = pWin->InvalidRect;
            GUI_MoveRect (&r, pWin->Rect.x0, pWin->Rect.y0);
            GUI_MEMDEV_Draw(&r, cbPaint, &Msg, 0, (Status & WM_SF_HASTRANS) ? GUI_MEMDEV_HASTRANS : 0);
          } else
        #endif
        WM_SendMessage(iWin, &Msg);
        UpdateRem--;  /* Only the given number of windows at a time ... */
      }
    }
    iWin = pWin->hNextLin;
  }  
  NextDrawWin = iWin;   /* Remember the window */
  GUI_RestoreContext(&ContextOld);
}
Exemple #5
0
void  DrawCharUcs2Ex(unsigned short character, unsigned int x, unsigned int y, GUI_FONT *font, COLOR color_f, COLOR color_b) {
   GUI_CONTEXT oldcontex;
   GUI_SaveContext(&oldcontex);
   GUI_Context.Color = color_f;
   GUI_Context.BkColor = color_b;
   GUI_Context.DispPosX = x;
   GUI_Context.DispPosY = y;
   GUI_Context.pAFont = font;
   GUI_Context.pAFont->pfDispChar(character);
   GUI_RestoreContext(&oldcontex);
}
Exemple #6
0
void drawStringEx(const TEXTCHAR *text, unsigned int x, unsigned int y, const GUI_FONT *font, COLOR color_f,COLOR color_b){
   GUI_CONTEXT oldc;
   GUI_SaveContext(&oldc);
   GUI_Context.DispPosX = x;
   GUI_Context.DispPosY = y;
   GUI_Context.Color = color_f;
   GUI_Context.BkColor = color_b;
   GUI_Context.pAFont = font;
   drawString(text, x, y);
   GUI_RestoreContext(&oldc);
}
Exemple #7
0
void drawStringEx_ucs2(const wchar *wcs, unsigned int x, unsigned int y, const GUI_FONT *font, COLOR color_f,COLOR color_b){
   GUI_CONTEXT oldc;
   GUI_SaveContext(&oldc);
   GUI_Context.DispPosX = x;
   GUI_Context.DispPosY = y;
   GUI_Context.Color = color_f;
   GUI_Context.BkColor = color_b;
   GUI_Context.pAFont = font;
   drawString_ucs2(wcs, x, y);
   GUI_RestoreContext(&oldc);
}
Exemple #8
0
void drawStringAlignEx_ucs2(const wchar *wcs, uint32 align, uint16 x, uint16 y, uint16 width,uint16 height, const GUI_FONT *font, COLOR color_f, COLOR color_b) {
   GUI_CONTEXT old;
   GUI_SaveContext(&old);
   GUI_SetFont(font);
   GUI_SetBkColor(color_b);
   GUI_SetColor( color_f);
   GUI_Context.DispPosX = x;
   GUI_Context.DispPosY = y;
   GUI_Context.pAFont = font;
   drawStringAlign_ucs2(wcs,align, x,y,width,height);
   GUI_RestoreContext(&old);
}
Exemple #9
0
void WIDGET_EFFECT_3D_DrawUpRect(const GUI_RECT* pRect) {
  GUI_RECT r;
  GUI_CONTEXT Context;
  GUI_SaveContext(&Context);
  r = *pRect;
  GUI_SetColor(0x000000);
  GUI_DrawRect(r.x0, r.y0, r.x1, r.y1);          /* Draw rectangle around it */
 /* Draw the bright sides */
  GUI_SetColor(0xffffff);
  GUI_DrawHLine(r.y0 + 1, r.x0 + 1, r.x1 - 2);    /* Draw top line */
  GUI_DrawVLine(r.x0 + 1, r.y0 + 1, r.y1 - 2);
  /* Draw the dark sides */
  GUI_SetColor(0x555555);
  GUI_DrawHLine(r.y1-1, r.x0 + 1, r.x1 - 1);
  GUI_DrawVLine(r.x1-1, r.y0 + 1, r.y1 - 2);
  GUI_RestoreContext(&Context);
}
Exemple #10
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
}
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
}
void GUIDEMO_main(void) {
  #if GUI_WINSUPPORT
    int i;
  #endif
  GUI_Clear();
  #if GUI_WINSUPPORT
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Automatically use memory devices on all windows */
    /* Calculate position and size of FrameWin[1] */
    _FrameWinSizeX[1] = 80;
    _FrameWinSizeY[1] = 60;
    _FrameWinPosX[1] = LCD_GetXSize() - _FrameWinSizeX[1];
    _FrameWinPosY[1] = LCD_GetYSize() - _FrameWinSizeY[1];
    _ButtonSizeX = (_FrameWinSizeX[1] - 20) / 2;
    _ButtonSizeY = 20;
    /* Create the control window incl. buttons */
    _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP,
                                     _FrameWinPosX[1], _FrameWinPosY[1],
                                     _FrameWinSizeX[1], _FrameWinSizeY[1]);
    _ahInfoWin[1] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[1], 
                                           WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0);
    _ahButton[0] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 20,
                                 + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 
                                 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    _ahButton[1] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 2,
                                 + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 
                                 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    BUTTON_SetText(_ahButton[0], "Stop");
    BUTTON_SetText(_ahButton[1], "Next");
    _UpdateCmdWin();
    WM_ExecIdle();
  #endif
  /* Show Intro */
  GUIDEMO_Intro();
  #if GUI_WINSUPPORT
    /* Calculate position and size of FrameWin[0] */
    _FrameWinSizeX[0] = LCD_GetXSize() / 2;
    _FrameWinSizeY[0] = 65;
    _FrameWinPosX[0] = LCD_GetXSize() - _FrameWinSizeX[0];
    _FrameWinPosY[0] = 0;
    /* Create info window and run the individual demos */
    _ahFrameWin[0] = FRAMEWIN_Create("ARMSYS Demo", NULL, WM_CF_STAYONTOP, 
                                     _FrameWinPosX[0], _FrameWinPosY[0], _FrameWinSizeX[0], _FrameWinSizeY[0]);
    _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[0], WM_CF_STAYONTOP, 0, 0);
    WM_ExecIdle();
  #endif
  /* Run the individual demos !  */
  for (_iTest = 0; _apfTest[_iTest]; _iTest++) {
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    _iTestMinor = 0;
    _UpdateCmdWin();
    (*_apfTest[_iTest])();
    _CmdNext = 0;
    GUI_RestoreContext(&ContextOld);
  }
  /* Cleanup */
  #if GUI_WINSUPPORT
    for (i = 0; i < countof(_ahFrameWin); i++) {
      WM_DeleteWindow(_ahFrameWin[i]);
    }
    for (i = 0; i < countof(_ahInfoWin); i++) {
      WM_DeleteWindow(_ahInfoWin[i]);
    }
  #endif
}
Exemple #13
0
void GUIDEMO_main(void) {
  #if GUI_WINSUPPORT
    int i;
    int xSize, ySize, xPos, yPos;
  #endif
  #if (GUI_SUPPORT_CURSOR|GUI_SUPPORT_TOUCH)
    GUI_CURSOR_Show();
  #endif
  GUI_Clear();
  #if GUI_WINSUPPORT
    #if LCD_NUM_DISPLAYS > 1
      FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW);
      WM_SetDesktopColorEx(GUI_RED, 1);
      GUI_Delay(1000);
    #endif
    WM_SetCreateFlags(WM_CF_MEMDEV);  /* Automatically use memory devices on all windows */
    /* Calculate position and size of FrameWin[1] */
    _ButtonSizeX = 30;
    _ButtonSizeY = 20;
    /* Create the control window incl. buttons */
    _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP,
                                                LCD_GetXSize() - 80, LCD_GetYSize() - 60, 80, 60);
    _ahInfoWin[1] = WM_CreateWindowAsChild( 0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[1]), WM_CF_SHOW | WM_CF_STAYONTOP, &_cbCmdWin, 0);
    _ahButton[0] = BUTTON_CreateAsChild(4, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 
                                        'S' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    _ahButton[1] = BUTTON_CreateAsChild(40, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 
                                        'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV);
    BUTTON_SetText(_ahButton[0], "Stop");
    BUTTON_SetText(_ahButton[1], "Next");
    _UpdateCmdWin();
    WM_ExecIdle();
  #endif
  /* Show Intro */
  GUIDEMO_Intro();
  #if GUI_WINSUPPORT
    /* Calculate position and size of FrameWin[0] */
    xSize = LCD_GetXSize() / 2;
    ySize = 65;
    xPos  = LCD_GetXSize() - xSize;
    yPos  = 0;
    /* Create info window and run the individual demos */
    _ahFrameWin[0] = FRAMEWIN_Create("µC/GUI Demo", NULL, WM_CF_STAYONTOP, 
                                     xPos, yPos, xSize, ySize);
//    _ahInfoWin[0] = WM_GetFirstChild(_ahFrameWin[0]);
    _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[0]), WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0);
    WM_ExecIdle();
  #endif
  /* Run the individual demos !  */
  for (_iTest = 0; _apfTest[_iTest]; _iTest++) {
    GUI_CONTEXT ContextOld;
    GUI_SaveContext(&ContextOld);
    _iTestMinor = 0;
    _UpdateCmdWin();
    (*_apfTest[_iTest])();
    _CmdNext = 0;
    GUI_RestoreContext(&ContextOld);
  }
  /* Cleanup */
  #if GUI_WINSUPPORT
    for (i = 0; i < countof(_ahFrameWin); i++) {
      WM_DeleteWindow(_ahFrameWin[i]);
    }
    for (i = 0; i < countof(_ahInfoWin); i++) {
      WM_DeleteWindow(_ahInfoWin[i]);
    }
  #endif
}