示例#1
0
xProgressBar* pxProgressBarCreate(u16 usX, u16 usY, u16 usW, u16 usH, xWidget *pxWidParent){
  xProgressBar *pxW;
  xProgressBarProps *xP;

  if (usH < usFontGetStrH(pcBarText, FONT_ASCII_16_X) + 4)
    usH = usFontGetStrH(pcBarText, FONT_ASCII_16_X) + 4;

  pxW = pxWidgetCreate(usX, usY, usW, usH, pxWidParent, TRUE);
  pxW->eType = WidgetProgressBar;
  vWidgetSetBgColor(pxW, 65535, FALSE);
  vWidgetSetTransparency(pxW, FALSE);
  vWidgesSetClickable(pxW, FALSE);
  pxW->pxDrawHandler = prvDraw;

  xP = pvMemoryMalloc(sizeof(xProgressBarProps), MEMORY_EXT);
  xP->usBarColor = ColorMessageHeaderBackground;
  xP->usExProc = 0;

  xP->pxBarLabel = pxLabelCreate(0, 0, usW, usFontGetStrH(pcBarText, FONT_ASCII_16_X) + 2, pcBarText, FONT_ASCII_16_X, strlen(pcBarText) + 5, pxW);
  vLabelSetTextAlign(xP->pxBarLabel, LABEL_ALIGN_CENTER);
  vLabelSetVerticalAlign(xP->pxBarLabel, LABEL_ALIGN_MIDDLE);

  pxW->pvProp = xP;

  return pxW;
}
示例#2
0
xWidget * pxModalDialogWindowCreate(){

  // X0, Y0 - координаты расположения виджетов
  u16 usX, usY;

  xThisWnd = pxWindowCreate(WINDOW_MODAL);
  vWidgetSetBgColor(xThisWnd, ColorEcgBackground, FALSE);
  vWindowSetOnOpenHandler(xThisWnd, prvOnOpenHandler);
  vWindowSetOnOpenRequestHandler(xThisWnd, prvOnOpenRequestHandler);
  vWindowSetOnCloseHandler(xThisWnd, prvOnCloseHandler);
  vWindowSetOnCloseRequestHandler(xThisWnd, prvOnCloseRequestHandler);

  xMessageHeader = pxLabelCreate(0, 0, usWidgetGetW(xThisWnd), usStatusBarGetH(), "ModalDialogHeader", FONT_ASCII_16_X, 0, xThisWnd);
  vWidgetSetBgColor(xMessageHeader, ColorMessageHeaderBackground, FALSE);
  vLabelSetTextAlign(xMessageHeader, LABEL_ALIGN_CENTER);
  vLabelSetVerticalAlign(xMessageHeader, LABEL_ALIGN_MIDDLE);
  vLabelSetTextColor(xMessageHeader, ColorMessageHeaderText);

  usY = (usInterfaceGetWindowH() * 4 )/10 - usStatusBarGetH();

  xMessage = pxLabelCreate(0, usWidgetGetH(xMessageHeader), usWidgetGetW(xThisWnd), usY, "ModalDialogText", FONT_ASCII_16_X, MODAL_DIALOG_MAX_MSG_LENGTH, xThisWnd);
  bLabelSetMultiline(xMessage, TRUE);
  vLabelSetTextAlign(xMessage, LABEL_ALIGN_CENTER);
  vLabelSetVerticalAlign(xMessage, LABEL_ALIGN_MIDDLE);

  usY = usWidgetGetY1(xMessage, FALSE);

  xPBar = pxProgressBarCreate(PB_BORDER, usY, usWidgetGetW(xThisWnd) - PB_BORDER * 2, 30, xThisWnd);
  vProgressBarSetProcExec(xPBar, 55);

  usY = (usInterfaceGetWindowH()/2 + LCD_TsBtn_SIZE/3);
  usX = 0;

  for(int c = 0; c < MODAL_DIALOG_MAX_BUTTONS; c++){
    xButtons[c] = pxMenuButtonCreate(usX, usY, pxPictureGet(Pic_ButtonOk), "", prvButtonHandler, xThisWnd);
    usX += LCD_TsBtn_SIZE;
    vWidgetHide(xButtons[c]);
  }
  return xThisWnd;
}