예제 #1
0
xWindow * pxWindowCreate(int eWnd) {
	xWindowProps *xP;

	if (pxWindowManagerGetWindow(eWnd)) // window with such id is already created
		return NULL;

	xWindow *pxW = pxWidgetCreate(usWindowManagerGetWindowX(), usWindowManagerGetWindowY(), usWindowManagerGetWindowW(), usWindowManagerGetWindowH(), pxWindowManagerGet(), true);

	if (pxW) {

		pxW->eType = WidgetWindow;
		pxW->pxOnDispose = prvDispose;

		vWidgetSetBgColor(pxW, EMGUI_COLOR_WHITE, false);
		vWidgetSetVisible(pxW, false);

		xP = malloc(sizeof(xWindowProps));

		if (!xP) {
			vWidgetDispose(pxW);
			return NULL;
		}

		memset(xP, 0, sizeof(xWindowProps));

		pxW->pvProp = xP;

		xP->eId = eWnd;
		xP->strHeader = (char*)malloc(EMGUI_WINDOW_HEADER_LENGTH + 1);
		xP->strHeader[0] = '\0';

	}
	
	return pxW;
}
예제 #2
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;
}