void vWindowSetDisposable(xWindow *pxW, bool bState) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return; xP->bDisposable = bState; }
bool bWindowisDisposable(xWindow *pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return false; return xP->bDisposable; }
bool bWindowGetFullScreen(xWindow *pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return false; return xP->bFullScreen; }
const char* pcWindowGetHeader(xWindow *pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return NULL; return xP->strHeader; }
static bool prvDraw(xWidget *pxW){ xProgressBarProps *xP; if (!(xP = pxWidgetGetProps(pxW, WidgetProgressBar))) return FALSE; if(pxW->bValid) return FALSE; // Draw: bWidgetDraw(pxW); u16 usXfrom = pxW->usX0 + 1; u16 usXto = pxW->usX0 + ((pxW->usX1 - 1 - pxW->usX0) * xP->usExProc) / 100; u16 usYfrom = pxW->usY0 + usWidgetGetH(xP->pxBarLabel); u16 usYto = pxW->usY1 - 1; vFramebufferRectangle(pxW->usX0, usYfrom, pxW->usX1 - 1, usYto, 0, FALSE); usYfrom++; usYto--; while (usXfrom <= usXto - 1){ vFramebufferVLine(usXfrom, usYfrom, usYto, xP->usBarColor); ++usXfrom; } return TRUE; }
int iWindowGetID(xWindow * pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return -1; return xP->eId; }
void vWindowSetHeader(xWindow * pxW, char const* strH) { xWindowProps *xP; int iLen = MIN(strlen(strH), EMGUI_WINDOW_HEADER_LENGTH); if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return; memcpy(xP->strHeader, strH, iLen + 1); xP->strHeader[iLen] = '\0'; vWindowManagerUpdateWindow(); }
static bool prvDispose(xWindow * pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return false; if (xP->pxOnDispose) xP->pxOnDispose(pxW); if (xP->strHeader) free(xP->strHeader); return true; }
void vWindowSetFullScreen(xWindow *pxW, bool bFS) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return; if (bFS) { if (bWidgetSetCoords(pxW, 0, 0, EMGUI_LCD_WIDTH, EMGUI_LCD_HEIGHT, true)) xP->bFullScreen = bFS; } else { if (bWidgetSetCoords(pxW, usWindowManagerGetWindowX(), usWindowManagerGetWindowY(), usWindowManagerGetWindowW(), usWindowManagerGetWindowH(), true)) xP->bFullScreen = bFS; } vWindowManagerUpdateWindow(); }
bool bWindowOpen(xWindow *pxW) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return false; if (xP->pxOnOpenRequest) if (!xP->pxOnOpenRequest(pxW)) return false; vWidgetShow(pxW); if (xP->pxOnOpen) xP->pxOnOpen(pxW); return true; }
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; }
void vProgressBarSetProcExec(xWidget *pxW, u16 usExecProc){ xProgressBarProps *xP; char pcText[strlen(pcBarText) + 5]; if (!(xP = pxWidgetGetProps(pxW, WidgetProgressBar))) return ; if (usExecProc > 100) usExecProc = 100; if(xP->usExProc == usExecProc) return; sprintf(pcText, "%s %d%c", pcBarText, usExecProc, '%'); pcLabelSetText(xP->pxBarLabel, pcText); xP->usExProc = usExecProc; vWidgetInvalidate(pxW); }
void vWindowSetOnOpenRequestHandler(xWindow * pxW, WidgetEvent pxCallback) { xWindowProps *xP; if (!(xP = (xWindowProps*)pxWidgetGetProps(pxW, WidgetWindow))) return; xP->pxOnOpenRequest = pxCallback; }