static void prvResetDlgWnd(){ for(int c = 0; c < MODAL_DIALOG_MAX_BUTTONS; c++){ vWidgetHide(xButtons[c]); } pcLabelSetText(xMessageHeader, ""); pcLabelSetText(xMessage, ""); vWidgetHide(xPBar); }
static inline void prvShowPB(xModalDialog * xDlg){ if(xDlg->cProgress >= 0){ vWidgetShow(xPBar); vProgressBarSetProcExec(xPBar, xDlg->cProgress); }else{ vWidgetHide(xPBar); } }
bool bWindowClose(xWindow *pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return false; if (xP->pxOnCloseRequest) if (!xP->pxOnCloseRequest(pxW)) return false; vWidgetHide(pxW); if (xP->pxOnClose) xP->pxOnClose(pxW); if(xP->bDisposable) vWidgetDispose(pxW); return true; }
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; }